Remove Rapatch (#215)
* Remove Rapatch * Remove help message * Fix remaining issues * Remove patch.o * Remove remaining patch Co-authored-by: Maijin <maijin21@gmail.com>
This commit is contained in:
parent
feb7feb19a
commit
8d09f8d6d5
14 changed files with 74 additions and 391 deletions
|
|
@ -1,21 +0,0 @@
|
|||
# This is an example file for rapatch
|
||||
|
||||
#0x8048000 : mov eax, 33
|
||||
#0x8048005 # This is awesome
|
||||
!echo ++ Patching binary
|
||||
. import.rdb
|
||||
|
||||
0x8048000 "Hello World"
|
||||
0x8048200 223399
|
||||
entry0 {
|
||||
printf@alias(${imp.printf});
|
||||
|
||||
main@global(128,128) {
|
||||
printf("%d\n", 33);
|
||||
printf("1234567890\n");
|
||||
printf("hello world\n");
|
||||
: mov eax,1
|
||||
: int 0x80
|
||||
}
|
||||
}
|
||||
#entry0+4 : nop;nop;nop
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
RAPATCH
|
||||
=======
|
||||
|
||||
Human friendly text format to apply patches to binary files.
|
||||
|
||||
Patch format
|
||||
------------
|
||||
|
||||
Those patches must be written in files and the syntax looks like the following:
|
||||
|
||||
```
|
||||
^# -> comments
|
||||
. -> execute command
|
||||
! -> execute command
|
||||
OFFSET { code block }
|
||||
OFFSET "string"
|
||||
OFFSET 01020304
|
||||
OFFSET : assembly
|
||||
+ {code}|"str"|0210|: asm
|
||||
```
|
||||
|
||||
Example scripts
|
||||
---------------
|
||||
This script will run the `?e ..` command in rizin and then write the string 'Hello' at 0x200 offset
|
||||
```
|
||||
# rapatch example
|
||||
:?e hello world
|
||||
0x200 "Hello"
|
||||
```
|
||||
|
||||
Running rapatches
|
||||
-----------------
|
||||
|
||||
$ rizin -P rapatch.txt target-program.txt
|
||||
|
||||
Or for scripted patching like `patch(1)`:
|
||||
|
||||
$ rizin -w -q -P rapatch.txt target-program.txt
|
||||
|
|
@ -7,7 +7,7 @@ RZ_DEPS+=rz_debug rz_hash rz_bin rz_lang rz_io rz_analysis rz_parse rz_bp rz_egg
|
|||
RZ_DEPS+=rz_reg rz_search rz_syscall rz_socket rz_magic rz_crypto
|
||||
|
||||
OBJS=core.o cmd.o cfile.o cconfig.o visual.o cio.o yank.o libs.o agraph.o
|
||||
OBJS+=fortune.o hack.o vasm.o patch.o cbin.o rtr.o cmd_api.o cmd_descs.o
|
||||
OBJS+=fortune.o hack.o vasm.o cbin.o rtr.o cmd_api.o cmd_descs.o
|
||||
OBJS+=carg.o canalysis.o cautocmpl.o project.o gdiff.o casm.o disasm.o cplugin.o
|
||||
OBJS+=vmenus.o vmenus_graph.o vmenus_zigns.o zdiff.o citem.o
|
||||
OBJS+=task.o panels.o vmarks.o analysis_tp.o analysis_objc.o blaze.o
|
||||
|
|
|
|||
|
|
@ -936,10 +936,6 @@ static const RzCmdDescHelp we_handler_old_help = {
|
|||
.summary = "Extend write operations (insert bytes instead of replacing)",
|
||||
};
|
||||
|
||||
static const RzCmdDescHelp wp_handler_old_help = {
|
||||
.summary = "Apply rizin patch file. See wp? fmi",
|
||||
};
|
||||
|
||||
static const RzCmdDescHelp wu_handler_old_help = {
|
||||
.summary = "Apply unified hex patch (see output of cu)",
|
||||
};
|
||||
|
|
@ -1658,8 +1654,6 @@ RZ_IPI void newshell_cmddescs_init(RzCore *core) {
|
|||
rz_warn_if_fail (wh_handler_old_cd);
|
||||
RzCmdDesc *we_handler_old_cd = rz_cmd_desc_oldinput_new (core->rcmd, w_cd, "we", rz_we_handler_old, &we_handler_old_help);
|
||||
rz_warn_if_fail (we_handler_old_cd);
|
||||
RzCmdDesc *wp_handler_old_cd = rz_cmd_desc_oldinput_new (core->rcmd, w_cd, "wp", rz_wp_handler_old, &wp_handler_old_help);
|
||||
rz_warn_if_fail (wp_handler_old_cd);
|
||||
RzCmdDesc *wu_handler_old_cd = rz_cmd_desc_oldinput_new (core->rcmd, w_cd, "wu", rz_wu_handler_old, &wu_handler_old_help);
|
||||
rz_warn_if_fail (wu_handler_old_cd);
|
||||
RzCmdDesc *wr_handler_old_cd = rz_cmd_desc_oldinput_new (core->rcmd, w_cd, "wr", rz_wr_handler_old, &wr_handler_old_help);
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ RZ_IPI RzCmdStatus rz_write_base64_decode_handler(RzCore *core, int argc, const
|
|||
RZ_IPI RzCmdStatus rz_write_base64_encode_handler(RzCore *core, int argc, const char **argv);
|
||||
RZ_IPI int rz_wh_handler_old(void *data, const char *input);
|
||||
RZ_IPI int rz_we_handler_old(void *data, const char *input);
|
||||
RZ_IPI int rz_wp_handler_old(void *data, const char *input);
|
||||
RZ_IPI int rz_wu_handler_old(void *data, const char *input);
|
||||
RZ_IPI int rz_wr_handler_old(void *data, const char *input);
|
||||
RZ_IPI int rz_wA_handler_old(void *data, const char *input);
|
||||
|
|
|
|||
|
|
@ -799,10 +799,6 @@
|
|||
cname: we_handler_old
|
||||
summary: Extend write operations (insert bytes instead of replacing)
|
||||
type: RZ_CMD_DESC_TYPE_OLDINPUT
|
||||
- name: wp
|
||||
cname: wp_handler_old
|
||||
summary: Apply rizin patch file. See wp? fmi
|
||||
type: RZ_CMD_DESC_TYPE_OLDINPUT
|
||||
- name: wu
|
||||
cname: wu_handler_old
|
||||
summary: Apply unified hex patch (see output of cu)
|
||||
|
|
|
|||
|
|
@ -121,20 +121,6 @@ static const char *help_msg_wop[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
// TODO
|
||||
static const char *help_msg_wp[] = {
|
||||
"Usage:", "wp", "[-|rzpatch-file]",
|
||||
"^#", "", "comments",
|
||||
".", "", "execute command",
|
||||
"!", "", "execute command",
|
||||
"", "", "OFFSET { code block }",
|
||||
"", "", "OFFSET \"string\"",
|
||||
"", "", "OFFSET 01020304",
|
||||
"", "", "OFFSET : assembly",
|
||||
"", "", "+ {code}|\"str\"|0210|: asm",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *help_msg_wt[] = {
|
||||
"Usage:", "wt[a] file [size]", " Write 'size' bytes in current block to 'file'",
|
||||
"wta", " [filename]", "append to 'filename'",
|
||||
|
|
@ -1231,28 +1217,6 @@ RZ_IPI int rz_we_handler_old(void *data, const char *input) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
RZ_IPI int rz_wp_handler_old(void *data, const char *input) {
|
||||
RzCore *core = (RzCore *)data;
|
||||
if (input[0] == '-' || (input[0] == ' ' && input[1] == '-')) {
|
||||
char *out = rz_core_editor (core, NULL, NULL);
|
||||
if (out) {
|
||||
rz_core_patch (core, out);
|
||||
free (out);
|
||||
}
|
||||
} else {
|
||||
if (input[0] == ' ' && input[1]) {
|
||||
char *data = rz_file_slurp (input + 1, NULL);
|
||||
if (data) {
|
||||
rz_core_patch (core, data);
|
||||
free (data);
|
||||
}
|
||||
} else {
|
||||
rz_core_cmd_help (core, help_msg_wp);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
RZ_IPI int rz_wu_handler_old(void *data, const char *input) {
|
||||
// TODO: implement it in an API RzCore.write_unified_hexpatch() is ETOOLONG
|
||||
if (input[0]==' ') {
|
||||
|
|
@ -2050,9 +2014,6 @@ RZ_IPI int rz_cmd_write(void *data, const char *input) {
|
|||
case 'e': // "we"
|
||||
rz_we_handler_old (core, input + 1);
|
||||
break;
|
||||
case 'p': // "wp"
|
||||
rz_wp_handler_old (core, input + 1);
|
||||
break;
|
||||
case 'u': // "wu"
|
||||
rz_wu_handler_old (core, input + 1);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ rz_core_sources = [
|
|||
'libs.c',
|
||||
#'linux_heap_glibc.c',
|
||||
'panels.c',
|
||||
'patch.c',
|
||||
'cplugin.c',
|
||||
'project.c',
|
||||
'rtr.c',
|
||||
|
|
|
|||
|
|
@ -1,154 +0,0 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-only
|
||||
|
||||
#include <rz_core.h>
|
||||
|
||||
RZ_API int rz_core_patch_line(RzCore *core, char *str) {
|
||||
char *p, *q;
|
||||
p = strchr (str + 1, ' ');
|
||||
if (!p) {
|
||||
return 0;
|
||||
}
|
||||
*p = 0;
|
||||
for (++p; *p == ' '; p++) {
|
||||
; // XXX: skipsspaces here
|
||||
}
|
||||
|
||||
switch (*p) {
|
||||
case '"':
|
||||
q = strchr (p + 1,'"');
|
||||
if (q) {
|
||||
*q = 0;
|
||||
}
|
||||
rz_core_cmdf (core, "s %s", str);
|
||||
rz_core_cmdf (core, "\"w %s\"", p+1);
|
||||
break;
|
||||
case ':':
|
||||
rz_core_cmdf (core, "s %s", str);
|
||||
rz_core_cmdf (core, "\"wa %s\"", p);
|
||||
break;
|
||||
case 'v':
|
||||
q = strchr (p + 1,' ');
|
||||
if (q) {
|
||||
*q = 0;
|
||||
for (++q; *q == ' '; q++) {
|
||||
; // XXX: skipsspaces here
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
rz_core_cmdf (core, "s %s", str);
|
||||
rz_core_cmdf (core, "wv%s %s", p + 1, q);
|
||||
break;
|
||||
default:
|
||||
rz_core_cmdf (core, "s %s", str);
|
||||
rz_core_cmdf (core, "wx %s", p);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int __core_patch_bracket(RzCore *core, const char *str, ut64 *noff) {
|
||||
char tmp[128];
|
||||
char *s, *p, *q, *off;
|
||||
RzBuffer *b = rz_buf_new ();
|
||||
if (!b) {
|
||||
return 0;
|
||||
}
|
||||
p = off = strdup (str);
|
||||
if (!p) {
|
||||
rz_buf_free (b);
|
||||
return 0;
|
||||
}
|
||||
for (;*p;) {
|
||||
if (*p == '\n') {
|
||||
*p++ = 0;
|
||||
} else {
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
if (*str == '}') {
|
||||
break;
|
||||
}
|
||||
if ((q = strstr (str, "${"))) {
|
||||
char *end = strchr (q+2,'}');
|
||||
if (end) {
|
||||
*q = *end = 0;
|
||||
*noff = rz_num_math (core->num, q+2);
|
||||
rz_buf_append_bytes (b, (const ut8*)str, strlen (str));
|
||||
snprintf (tmp, sizeof (tmp), "0x%08"PFMT64x, *noff);
|
||||
rz_buf_append_bytes (b, (const ut8*)tmp, strlen (tmp));
|
||||
rz_buf_append_bytes (b, (const ut8*)end+1, strlen (end+1));
|
||||
}
|
||||
} else {
|
||||
rz_buf_append_bytes (b, (const ut8*)str, strlen (str));
|
||||
}
|
||||
str = p;
|
||||
}
|
||||
|
||||
s = rz_buf_to_string (b);
|
||||
rz_egg_load (core->egg, s, 0);
|
||||
free (s);
|
||||
|
||||
(void)rz_egg_compile (core->egg);
|
||||
(void)rz_egg_assemble (core->egg);
|
||||
|
||||
rz_buf_free (b);
|
||||
b = rz_egg_get_bin (core->egg);
|
||||
|
||||
if (strcmp (off, "+")) {
|
||||
*noff = rz_num_math (core->num, off);
|
||||
}
|
||||
ut64 tmpsz;
|
||||
const ut8 *tmpbuf = rz_buf_data (b, &tmpsz);
|
||||
rz_core_write_at (core, *noff, tmpbuf, tmpsz);
|
||||
*noff += rz_buf_size (b);
|
||||
free (off);
|
||||
return 1;
|
||||
}
|
||||
|
||||
RZ_API int rz_core_patch(RzCore *core, const char *patch) {
|
||||
char *p, *p0, *str;
|
||||
ut64 noff = 0LL;
|
||||
|
||||
p = p0 = str = strdup (patch);
|
||||
if (!p) {
|
||||
return 0;
|
||||
}
|
||||
for (; *p; p++) {
|
||||
/* read until newline */
|
||||
if (!*p || *p == '\n') {
|
||||
*p++ = 0;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (*str) {
|
||||
case '#':
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\0':
|
||||
break;
|
||||
case ':':
|
||||
rz_core_cmd0 (core, str+1);
|
||||
break;
|
||||
case '.':
|
||||
case '!':
|
||||
rz_core_cmd0 (core, str);
|
||||
break;
|
||||
case '{':
|
||||
(void)__core_patch_bracket (core, str, &noff);
|
||||
break;
|
||||
default:
|
||||
rz_core_patch_line (core, str);
|
||||
break;
|
||||
}
|
||||
if (!*p) {
|
||||
break;
|
||||
}
|
||||
str = p;
|
||||
}
|
||||
// eprintf ("%d\n", *p);
|
||||
// eprintf ("Missing newline\n");
|
||||
free (p0);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -766,8 +766,6 @@ RZ_API int rz_core_search_preludes(RzCore *core, bool log);
|
|||
RZ_API int rz_core_search_prelude(RzCore *core, ut64 from, ut64 to, const ut8 *buf, int blen, const ut8 *mask, int mlen);
|
||||
RZ_API RzList* /*<RzIOMap*>*/ rz_core_get_boundaries_prot (RzCore *core, int protection, const char *mode, const char *prefix);
|
||||
|
||||
RZ_API int rz_core_patch (RzCore *core, const char *patch);
|
||||
|
||||
RZ_API void rz_core_hack_help(const RzCore *core);
|
||||
RZ_API int rz_core_hack(RzCore *core, const char *op);
|
||||
RZ_API bool rz_core_dump(RzCore *core, const char *file, ut64 addr, ut64 size, int append);
|
||||
|
|
|
|||
|
|
@ -123,7 +123,6 @@ static int main_help(int line) {
|
|||
" -qq quit after running all -c and -i\n"
|
||||
" -Q quiet mode (no prompt) and quit faster (quickLeak=true)\n"
|
||||
" -p [p.rzdb] load project file\n"
|
||||
" -P [file] apply rapatch file and quit\n"
|
||||
" -r [rz_run] specify rz_run profile to load (same as -e dbg.profile=X)\n"
|
||||
" -R [rrz_testule] specify custom rz_run directive\n"
|
||||
" -s [addr] initial seek\n"
|
||||
|
|
@ -332,7 +331,6 @@ RZ_API int rz_main_rizin(int argc, const char **argv) {
|
|||
char *cmdn, *tmp;
|
||||
RzCoreFile *fh = NULL;
|
||||
RzIODesc *iod = NULL;
|
||||
const char *patchfile = NULL;
|
||||
const char *prj = NULL;
|
||||
int debug = 0;
|
||||
int zflag = 0;
|
||||
|
|
@ -440,7 +438,7 @@ RZ_API int rz_main_rizin(int argc, const char **argv) {
|
|||
bool load_l = true;
|
||||
|
||||
RzGetopt opt;
|
||||
rz_getopt_init (&opt, argc, argv, "=02AMCwxfF:H:hm:e:nk:NdqQs:p:b:B:a:Lui:I:l:P:R:r:c:D:vVSTzuXt");
|
||||
rz_getopt_init (&opt, argc, argv, "=02AMCwxfF:H:hm:e:nk:NdqQs:p:b:B:a:Lui:I:l:R:r:c:D:vVSTzuXt");
|
||||
while ((c = rz_getopt_next (&opt)) != -1) {
|
||||
switch (c) {
|
||||
case '=':
|
||||
|
|
@ -574,14 +572,6 @@ RZ_API int rz_main_rizin(int argc, const char **argv) {
|
|||
case 'p':
|
||||
prj = *opt.arg ? opt.arg : NULL;
|
||||
break;
|
||||
case 'P':
|
||||
if (RZ_STR_ISEMPTY (opt.arg)) {
|
||||
eprintf ("Cannot open empty rapatch path\n");
|
||||
ret = 1;
|
||||
goto beach;
|
||||
}
|
||||
patchfile = opt.arg;
|
||||
break;
|
||||
case 'Q':
|
||||
quiet = true;
|
||||
quietLeak = true;
|
||||
|
|
@ -1362,102 +1352,90 @@ RZ_API int rz_main_rizin(int argc, const char **argv) {
|
|||
rz_config_set (r->config, "scr.prompt", "false");
|
||||
}
|
||||
r->num->value = 0;
|
||||
if (patchfile) {
|
||||
char *data = rz_file_slurp (patchfile, NULL);
|
||||
if (data) {
|
||||
ret = rz_core_patch (r, data);
|
||||
rz_core_seek (r, 0, true);
|
||||
free (data);
|
||||
} else {
|
||||
eprintf ("[p] Cannot open '%s'\n", patchfile);
|
||||
if (zerosep) {
|
||||
rz_cons_zero ();
|
||||
}
|
||||
if (seek != UT64_MAX) {
|
||||
rz_core_seek (r, seek, true);
|
||||
}
|
||||
|
||||
// no flagspace selected by default the beginning
|
||||
rz_flag_space_set (r->flags, NULL);
|
||||
if (!debug && r->bin && r->bin->cur && r->bin->cur->o && r->bin->cur->o->info) {
|
||||
if (r->bin->cur->o->info->arch) {
|
||||
rz_core_cmd0 (r, "aeip");
|
||||
}
|
||||
}
|
||||
if ((patchfile && !quiet) || !patchfile) {
|
||||
if (zerosep) {
|
||||
rz_cons_zero ();
|
||||
}
|
||||
if (seek != UT64_MAX) {
|
||||
rz_core_seek (r, seek, true);
|
||||
}
|
||||
for (;;) {
|
||||
rz_core_prompt_loop (r);
|
||||
ret = r->num->value;
|
||||
debug = rz_config_get_i (r->config, "cfg.debug");
|
||||
if (ret != -1 && rz_cons_is_interactive ()) {
|
||||
char *question;
|
||||
bool no_question_debug = ret & 1;
|
||||
bool no_question_save = (ret & 2) >> 1;
|
||||
bool y_kill_debug = (ret & 4) >> 2;
|
||||
bool y_save_project = (ret & 8) >> 3;
|
||||
|
||||
// no flagspace selected by default the beginning
|
||||
rz_flag_space_set (r->flags, NULL);
|
||||
if (!debug && r->bin && r->bin->cur && r->bin->cur->o && r->bin->cur->o->info) {
|
||||
if (r->bin->cur->o->info->arch) {
|
||||
rz_core_cmd0 (r, "aeip");
|
||||
}
|
||||
}
|
||||
for (;;) {
|
||||
rz_core_prompt_loop (r);
|
||||
ret = r->num->value;
|
||||
debug = rz_config_get_i (r->config, "cfg.debug");
|
||||
if (ret != -1 && rz_cons_is_interactive ()) {
|
||||
char *question;
|
||||
bool no_question_debug = ret & 1;
|
||||
bool no_question_save = (ret & 2) >> 1;
|
||||
bool y_kill_debug = (ret & 4) >> 2;
|
||||
bool y_save_project = (ret & 8) >> 3;
|
||||
|
||||
if (rz_core_task_running_tasks_count (&r->tasks) > 0) {
|
||||
if (rz_cons_yesno ('y', "There are running background tasks. Do you want to kill them? (Y/n)")) {
|
||||
rz_core_task_break_all (&r->tasks);
|
||||
rz_core_task_join (&r->tasks, r->tasks.main_task, -1);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
if (no_question_debug) {
|
||||
if (rz_config_get_i (r->config, "dbg.exitkills") && y_kill_debug){
|
||||
rz_debug_kill (r->dbg, r->dbg->pid, r->dbg->tid, 9); // KILL
|
||||
}
|
||||
} else {
|
||||
if (rz_cons_yesno ('y', "Do you want to quit? (Y/n)")) {
|
||||
if (rz_config_get_i (r->config, "dbg.exitkills") &&
|
||||
rz_cons_yesno ('y', "Do you want to kill the process? (Y/n)")) {
|
||||
rz_debug_kill (r->dbg, r->dbg->pid, r->dbg->tid, 9); // KILL
|
||||
} else {
|
||||
rz_debug_detach (r->dbg, r->dbg->pid);
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
prj = rz_config_get (r->config, "prj.file");
|
||||
RzProjectErr prj_err = RZ_PROJECT_ERR_SUCCESS;
|
||||
if (no_question_save) {
|
||||
if (prj && *prj && y_save_project){
|
||||
prj_err = rz_project_save_file (r, prj);
|
||||
}
|
||||
if (rz_core_task_running_tasks_count (&r->tasks) > 0) {
|
||||
if (rz_cons_yesno ('y', "There are running background tasks. Do you want to kill them? (Y/n)")) {
|
||||
rz_core_task_break_all (&r->tasks);
|
||||
rz_core_task_join (&r->tasks, r->tasks.main_task, -1);
|
||||
} else {
|
||||
question = rz_str_newf ("Do you want to save the '%s' project? (Y/n)", prj);
|
||||
if (prj && *prj && rz_cons_yesno ('y', "%s", question)) {
|
||||
prj_err = rz_project_save_file (r, prj);
|
||||
}
|
||||
free (question);
|
||||
}
|
||||
if (prj_err != RZ_PROJECT_ERR_SUCCESS) {
|
||||
eprintf ("Failed to save project: %s\n", rz_project_err_message (prj_err));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (rz_config_get_i (r->config, "scr.confirmquit")) {
|
||||
if (!rz_cons_yesno ('n', "Do you want to quit? (Y/n)")) {
|
||||
if (debug) {
|
||||
if (no_question_debug) {
|
||||
if (rz_config_get_i (r->config, "dbg.exitkills") && y_kill_debug){
|
||||
rz_debug_kill (r->dbg, r->dbg->pid, r->dbg->tid, 9); // KILL
|
||||
}
|
||||
} else {
|
||||
if (rz_cons_yesno ('y', "Do you want to quit? (Y/n)")) {
|
||||
if (rz_config_get_i (r->config, "dbg.exitkills") &&
|
||||
rz_cons_yesno ('y', "Do you want to kill the process? (Y/n)")) {
|
||||
rz_debug_kill (r->dbg, r->dbg->pid, r->dbg->tid, 9); // KILL
|
||||
} else {
|
||||
rz_debug_detach (r->dbg, r->dbg->pid);
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// rz_core_project_save (r, prj);
|
||||
if (debug && rz_config_get_i (r->config, "dbg.exitkills")) {
|
||||
rz_debug_kill (r->dbg, 0, false, 9); // KILL
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
prj = rz_config_get (r->config, "prj.file");
|
||||
RzProjectErr prj_err = RZ_PROJECT_ERR_SUCCESS;
|
||||
if (no_question_save) {
|
||||
if (prj && *prj && y_save_project){
|
||||
prj_err = rz_project_save_file (r, prj);
|
||||
}
|
||||
} else {
|
||||
question = rz_str_newf ("Do you want to save the '%s' project? (Y/n)", prj);
|
||||
if (prj && *prj && rz_cons_yesno ('y', "%s", question)) {
|
||||
prj_err = rz_project_save_file (r, prj);
|
||||
}
|
||||
free (question);
|
||||
}
|
||||
if (prj_err != RZ_PROJECT_ERR_SUCCESS) {
|
||||
eprintf ("Failed to save project: %s\n", rz_project_err_message (prj_err));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rz_config_get_i (r->config, "scr.confirmquit")) {
|
||||
if (!rz_cons_yesno ('n', "Do you want to quit? (Y/n)")) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// rz_core_project_save (r, prj);
|
||||
if (debug && rz_config_get_i (r->config, "dbg.exitkills")) {
|
||||
rz_debug_kill (r->dbg, 0, false, 9); // KILL
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (mustSaveHistory (r->config)) {
|
||||
|
|
|
|||
|
|
@ -86,8 +86,6 @@ Quit before showing the prompt. Right after all the -e -c and -i arguments are e
|
|||
Same as q, but exiting without freeing RCore, this produces leaks at exit time, but saves some precious ms to run the testsuite in fast mode.
|
||||
.It Fl p Ar prj
|
||||
Set project file
|
||||
.It Fl P Ar file
|
||||
Apply rapatch file and quit (see doc/rapatch.md for more details)
|
||||
.It Fl r Ar rz-run
|
||||
Specify dbg.profile rz-run profile to use when spawning a program for debugging
|
||||
.It Fl R Ar rz-run-directive
|
||||
|
|
|
|||
|
|
@ -89,25 +89,6 @@ EXPECT=<<EOF
|
|||
EOF
|
||||
RUN
|
||||
|
||||
NAME=wp
|
||||
FILE=-
|
||||
CMDS=<<EOF
|
||||
echo 0x10 "hello" > .rz-wp.test
|
||||
echo 0x20 01020304 >> .rz-wp.test
|
||||
cat .rz-wp.test
|
||||
wp .rz-wp.test
|
||||
rm .rz-wp.test
|
||||
ps @ 0x10
|
||||
p8 3 @ 0x20
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
0x10 "hello"
|
||||
0x20 01020304
|
||||
hello
|
||||
010203
|
||||
EOF
|
||||
RUN
|
||||
|
||||
NAME=wu
|
||||
FILE=-
|
||||
CMDS=<<EOF
|
||||
|
|
|
|||
|
|
@ -167,14 +167,6 @@ Missing file to open
|
|||
EOF
|
||||
RUN
|
||||
|
||||
NAME=rizin empty -P
|
||||
FILE=-
|
||||
CMDS=!rizin -P ""
|
||||
EXPECT_ERR=<<EOF
|
||||
Cannot open empty rapatch path
|
||||
EOF
|
||||
RUN
|
||||
|
||||
NAME=rizin project with explicit file
|
||||
FILE=-
|
||||
CMDS=<<EOF
|
||||
|
|
|
|||
Loading…
Reference in a new issue