mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-05 13:06:52 +00:00
Fix #20405 - Multiple fixes and improvements in projects ##projects
* io maps are now saved and restored * add an extra test and review/update others * Use omu in om* and run o*;om* in P * Better handling multiple P subcommands and help msg * Use more R_LOG instead of eprintf
This commit is contained in:
parent
21064e9473
commit
8c80cfe7d9
@ -284,8 +284,6 @@ static int java_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len
|
||||
op->fail = addr + sz;
|
||||
//IFDBG eprintf ("%s callto 0x%04x failto 0x%04x.\n", JAVA_OPS[op_byte].name, op->jump, op->fail);
|
||||
}
|
||||
//r_java_disasm(addr, data, len, output, outlen);
|
||||
//IFDBG eprintf ("%s\n", output);
|
||||
return op->size;
|
||||
}
|
||||
|
||||
|
@ -1046,6 +1046,16 @@ static void optimize(void) {
|
||||
free (oldstr);
|
||||
}
|
||||
|
||||
#if R2_580
|
||||
R_API char *r_cons_drain(void) {
|
||||
const char *buf = r_cons_get_buffer();
|
||||
size_t buf_size = r_cons_get_buffer_size();
|
||||
char *s = r_str_ndup (buf, buf_size);
|
||||
r_cons_reset ();
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
|
||||
R_API void r_cons_flush(void) {
|
||||
if (!r_cons_instance) {
|
||||
r_cons_instance = &g_cons_instance;
|
||||
|
@ -491,7 +491,7 @@ static void map_list(RCore *core, int mode, RPrint *print, int fd) {
|
||||
case '*':
|
||||
case 'r': {
|
||||
// Need FIFO order here
|
||||
char *om_cmd = r_str_newf ("om %d 0x%08"PFMT64x" 0x%08"PFMT64x
|
||||
char *om_cmd = r_str_newf ("omu %d 0x%08"PFMT64x" 0x%08"PFMT64x
|
||||
" 0x%08"PFMT64x" %s%s%s\n", map->fd, r_io_map_begin (map),
|
||||
r_io_map_size (map), map->delta, r_str_rwx_i (map->perm),
|
||||
R_STR_ISEMPTY (map->name)? "": " ", r_str_get (map->name));
|
||||
@ -1959,6 +1959,7 @@ static int cmd_open(void *data, const char *input) {
|
||||
case '-': // "o--"
|
||||
r_io_close_all (core->io);
|
||||
r_bin_file_delete_all (core->bin);
|
||||
r_core_cmd0 (core, "o-*;om-*");
|
||||
r_anal_purge (core->anal);
|
||||
r_flag_unset_all (core->flags);
|
||||
break;
|
||||
|
@ -6,11 +6,11 @@ static const char *help_msg_P[] = {
|
||||
"Usage:", "P[?.+-*cdilnsS] [file]", "Project management",
|
||||
"P", " [file]", "open project (formerly Po)",
|
||||
"P.", "", "show current loaded project (see prj.name)",
|
||||
"P+", " [file]", "save project (same as Ps, but doesnt checks for changes)",
|
||||
"P-", " [file]", "delete project (alias for Pd)",
|
||||
"P+", " [name]", "save project (same as Ps, but doesnt checks for changes)",
|
||||
"P-", " [name]", "delete project",
|
||||
"P*", "", "save project (same as Ps, but doesnt checks for changes)",
|
||||
"P!", "([cmd])", "open a shell in the project directory",
|
||||
"Pc", " [file]", "show project script to console",
|
||||
"Pc", " [file]", "show project script to console (R2_580 -> PS*)",
|
||||
"Pd", " [N]", "diff Nth commit",
|
||||
"Pi", " [file]", "show project information",
|
||||
"Pl", "", "list all projects",
|
||||
@ -18,7 +18,8 @@ static const char *help_msg_P[] = {
|
||||
"Pn", "[j]", "manage notes associated with the project",
|
||||
"Ps", " [file]", "save project (see dir.projects)",
|
||||
"PS", " [file]", "save script file",
|
||||
"Px", "-", "close the opened project",
|
||||
"PS*", "", "print the project script file (Like PS /dev/stdout)",
|
||||
"Px", "-", "close the opened project (R2_580 -> Pc)",
|
||||
"NOTE:", "", "the 'e prj.name' evar can save/open/rename/list projects.",
|
||||
"NOTE:", "", "see the other 'e??prj.' evars for more options.",
|
||||
"NOTE:", "", "project are stored in " R_JOIN_2_PATHS ("~", R2_HOME_PROJECTS),
|
||||
@ -62,6 +63,7 @@ static int cmd_project(void *data, const char *input) {
|
||||
file = arg;
|
||||
switch (input[0]) {
|
||||
case 'c': // "Pc"
|
||||
// R2_580 - old Px code moves here..
|
||||
if (input[1] == '?') {
|
||||
eprintf ("Usage: Pc [prjname]\n");
|
||||
} else if (input[1] == '\0' && fileproject) {
|
||||
@ -73,7 +75,7 @@ static int cmd_project(void *data, const char *input) {
|
||||
}
|
||||
break;
|
||||
case 'o': // "Po" DEPRECATED
|
||||
eprintf ("TODO: Po is deprecated, use 'P [prjname]' instead\n");
|
||||
R_LOG_WARN ("Po is deprecated, use 'P [prjname]' instead");
|
||||
// fallthru
|
||||
case ' ': // "P [prj]"
|
||||
if (input[1] == '&') { // "Po&"
|
||||
@ -103,10 +105,19 @@ static int cmd_project(void *data, const char *input) {
|
||||
}
|
||||
break;
|
||||
case '-': // "P-"
|
||||
if (R_STR_ISNOTEMPTY (file)) {
|
||||
r_core_project_delete (core, file);
|
||||
if (!strcmp (input + 1, "-")) {
|
||||
//r_project_close (core->prj);
|
||||
r_config_set (core->config, "prj.name", "");
|
||||
} else if (input[1]) {
|
||||
if (R_STR_ISNOTEMPTY (file)) {
|
||||
r_core_project_delete (core, file);
|
||||
} else {
|
||||
// r_project_close (core->prj);
|
||||
r_config_set (core->config, "prj.name", "");
|
||||
}
|
||||
} else {
|
||||
eprintf ("Usage: P- [prjname] # Use Pl to list the available projects.\n");
|
||||
// r_project_close (core->prj);
|
||||
r_config_set (core->config, "prj.name", "");
|
||||
}
|
||||
break;
|
||||
case '+': // "P+"
|
||||
@ -151,16 +162,18 @@ static int cmd_project(void *data, const char *input) {
|
||||
break;
|
||||
case 'S': // "PS"
|
||||
if (input[1] == ' ') {
|
||||
r_core_project_save_script (core, input + 2, R_CORE_PRJ_ALL);
|
||||
r_core_project_save_script (core, r_str_trim_head_ro (input + 2), R_CORE_PRJ_ALL);
|
||||
} else if (input[1] == '*') {
|
||||
r_core_project_save_script (core, "/dev/stdout", R_CORE_PRJ_ALL);
|
||||
} else {
|
||||
r_cons_eprintf ("Usage: PS [file]\n");
|
||||
r_cons_eprintf ("Usage: PS[*] [projectname]\n");
|
||||
}
|
||||
break;
|
||||
case 'n': // "Pn"
|
||||
if (input[1] == '?') {
|
||||
r_core_cmd_help (core, help_msg_Pn);
|
||||
} else if (!fileproject || !*fileproject) {
|
||||
r_cons_eprintf ("No project\n");
|
||||
} else if (R_STR_ISEMPTY (fileproject)) {
|
||||
R_LOG_ERROR ("No project");
|
||||
} else {
|
||||
switch (input[1]) {
|
||||
case '-': // "Pn-"
|
||||
@ -168,7 +181,7 @@ static int cmd_project(void *data, const char *input) {
|
||||
{
|
||||
FILE *fd = r_sandbox_fopen (str, "w");
|
||||
if (!fd) {
|
||||
eprintf ("Cannot open %s\n", str);
|
||||
R_LOG_ERROR ("Cannot open %s", str);
|
||||
} else {
|
||||
char *str = r_core_project_notes_file (core, fileproject);
|
||||
char *data = r_file_slurp (str, NULL);
|
||||
@ -189,7 +202,7 @@ static int cmd_project(void *data, const char *input) {
|
||||
free (data);
|
||||
}
|
||||
if (del > 0) {
|
||||
eprintf ("Deleted %d lines\n", del);
|
||||
R_LOG_ERROR ("Deleted %d lines", del);
|
||||
}
|
||||
free (str);
|
||||
fclose (fd);
|
||||
@ -204,7 +217,7 @@ static int cmd_project(void *data, const char *input) {
|
||||
if (str && *str && editor && *editor) {
|
||||
r_sys_cmdf ("%s %s", editor, str);
|
||||
} else {
|
||||
eprintf ("No cfg.editor configured\n");
|
||||
R_LOG_ERROR ("No cfg.editor configured");
|
||||
}
|
||||
free (str);
|
||||
} else {
|
||||
@ -292,18 +305,13 @@ static int cmd_project(void *data, const char *input) {
|
||||
}
|
||||
break;
|
||||
case '.': // "P."
|
||||
if (file && *file) {
|
||||
char *prj_name = r_core_project_name (core, file);
|
||||
if (R_STR_ISNOTEMPTY (prj_name)) {
|
||||
r_cons_println (prj_name);
|
||||
free (prj_name);
|
||||
}
|
||||
}
|
||||
r_cons_printf ("%s\n", fileproject);
|
||||
break;
|
||||
case 'x':
|
||||
r_project_close (core->prj);
|
||||
r_config_set (core->config, "prj.name", "");
|
||||
break;
|
||||
case 0: // "P"
|
||||
case 'P':
|
||||
case 'l':
|
||||
case 'j': // "Pj"
|
||||
|
@ -294,7 +294,7 @@ static bool r_core_project_load(RCore *core, const char *prj_name, const char *r
|
||||
}
|
||||
if (r_project_is_loaded (core->prj)) {
|
||||
eprintf ("o--;e prj.name=\n");
|
||||
return false;
|
||||
// return false;
|
||||
}
|
||||
if (!r_project_open (core->prj, prj_name, rcpath)) {
|
||||
return false;
|
||||
@ -374,6 +374,7 @@ R_API bool r_core_project_open(RCore *core, const char *prj_path) {
|
||||
bool ccs = interactive? r_cons_yesno ('y', "Close current session? (Y/n)"): true;
|
||||
if (ccs) {
|
||||
r_core_cmd0 (core, "o--");
|
||||
r_core_cmd0 (core, "P-");
|
||||
} else {
|
||||
R_LOG_ERROR ("Project not loaded");
|
||||
return false;
|
||||
@ -391,7 +392,8 @@ R_API bool r_core_project_open(RCore *core, const char *prj_path) {
|
||||
}
|
||||
}
|
||||
if (close_current_session) {
|
||||
r_core_cmd0 (core, "e prj.name=;o--");
|
||||
r_config_set (core->config, "prj.name", "");
|
||||
r_core_cmd0 (core, "o--");
|
||||
}
|
||||
/* load sdb stuff in here */
|
||||
bool ret = r_core_project_load (core, prj_name, prj_script);
|
||||
@ -403,17 +405,10 @@ R_API bool r_core_project_open(RCore *core, const char *prj_path) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
R_API char *r_core_project_name(RCore *core, const char *prjfile) {
|
||||
char buf[256], *file = NULL;
|
||||
if (*prjfile != '/') {
|
||||
return strdup (prjfile);
|
||||
}
|
||||
char *prj = get_project_script_path (core, prjfile);
|
||||
if (!prj) {
|
||||
R_LOG_ERROR ("Invalid project name '%s'", prjfile);
|
||||
return NULL;
|
||||
}
|
||||
FILE *fd = r_sandbox_fopen (prj, "r");
|
||||
static char *get_project_name(const char *prj_script) {
|
||||
char buf[1024];
|
||||
char *file = NULL;
|
||||
FILE *fd = r_sandbox_fopen (prj_script, "r");
|
||||
if (fd) {
|
||||
for (;;) {
|
||||
if (!fgets (buf, sizeof (buf), fd)) {
|
||||
@ -430,8 +425,21 @@ R_API char *r_core_project_name(RCore *core, const char *prjfile) {
|
||||
}
|
||||
fclose (fd);
|
||||
} else {
|
||||
R_LOG_ERROR ("Cannot open project info (%s)", prj);
|
||||
R_LOG_ERROR ("Cannot open project info (%s)", prj_script);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
R_API char *r_core_project_name(RCore *core, const char *prjfile) {
|
||||
if (*prjfile != '/') {
|
||||
return strdup (prjfile);
|
||||
}
|
||||
char *prj = get_project_script_path (core, prjfile);
|
||||
if (!prj) {
|
||||
R_LOG_ERROR ("Invalid project name '%s'", prjfile);
|
||||
return NULL;
|
||||
}
|
||||
char *file = get_project_name (prj);
|
||||
free (prj);
|
||||
if (R_STR_ISEMPTY (file)) {
|
||||
free (file);
|
||||
@ -479,6 +487,21 @@ static bool store_files_and_maps(RCore *core, RIODesc *desc, ut32 id) {
|
||||
}
|
||||
#endif
|
||||
|
||||
static char *r_cons_drain(void) {
|
||||
const char *buf = r_cons_get_buffer();
|
||||
size_t buf_size = r_cons_get_buffer_len();
|
||||
char *s = r_str_ndup (buf, buf_size);
|
||||
r_cons_reset ();
|
||||
return s;
|
||||
}
|
||||
static void flush(RStrBuf *sb) {
|
||||
char * s = r_cons_drain ();
|
||||
if (s) {
|
||||
r_strbuf_append (sb, s);
|
||||
free (s);
|
||||
}
|
||||
}
|
||||
|
||||
R_API bool r_core_project_save_script(RCore *core, const char *file, int opts) {
|
||||
char *hl, *ohl = NULL;
|
||||
|
||||
@ -487,116 +510,113 @@ R_API bool r_core_project_save_script(RCore *core, const char *file, int opts) {
|
||||
}
|
||||
|
||||
char *filename = r_str_word_get_first (file);
|
||||
int fd = -1;
|
||||
if (!strcmp (file, "/dev/stdout")) {
|
||||
fd = 1;
|
||||
} else {
|
||||
fd = r_sandbox_open (file, O_BINARY | O_RDWR | O_CREAT | O_TRUNC, 0644);
|
||||
}
|
||||
if (fd == -1) {
|
||||
free (filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
hl = r_cons_singleton ()->highlight;
|
||||
if (hl) {
|
||||
ohl = strdup (hl);
|
||||
r_cons_highlight (NULL);
|
||||
}
|
||||
int fdold = r_cons_singleton ()->fdout;
|
||||
r_cons_singleton ()->fdout = fd;
|
||||
RStrBuf *sb = r_strbuf_new ("");
|
||||
r_cons_singleton ()->context->is_interactive = false;
|
||||
r_cons_printf ("# r2 rdb project file\n");
|
||||
// new behaviour to project load routine (see io maps below).
|
||||
if (opts & R_CORE_PRJ_EVAL) {
|
||||
r_cons_printf ("# eval\n");
|
||||
r_config_list (core->config, NULL, 'r');
|
||||
r_cons_flush ();
|
||||
flush (sb);
|
||||
}
|
||||
r_core_cmd (core, "o*", 0);
|
||||
// save maps // r_core_cmd (core, "om*", 0);
|
||||
r_core_cmd (core, "om*", 0);
|
||||
r_core_cmd0 (core, "tcc*");
|
||||
if (opts & R_CORE_PRJ_FCNS) {
|
||||
r_cons_printf ("# functions\n");
|
||||
r_cons_printf ("fs functions\n");
|
||||
r_core_cmd (core, "afl*", 0);
|
||||
r_cons_flush ();
|
||||
flush (sb);
|
||||
}
|
||||
{
|
||||
r_cons_printf ("# registers\n");
|
||||
r_core_cmd (core, "ar*;arR", 0);
|
||||
r_cons_flush ();
|
||||
r_core_cmd (core, "ar*", 0);
|
||||
flush (sb);
|
||||
r_core_cmd (core, "arR", 0);
|
||||
flush (sb);
|
||||
}
|
||||
if (opts & R_CORE_PRJ_FLAGS) {
|
||||
r_cons_printf ("# flags\n");
|
||||
r_flag_space_push (core->flags, NULL);
|
||||
r_flag_list (core->flags, true, NULL);
|
||||
r_flag_space_pop (core->flags);
|
||||
r_cons_flush ();
|
||||
flush (sb);
|
||||
}
|
||||
#if PROJECT_EXPERIMENTAL
|
||||
if (opts & R_CORE_PRJ_IO_MAPS && core->io && core->io->files) {
|
||||
fdc = 3;
|
||||
r_id_storage_foreach (core->io->files, (RIDStorageForeachCb)store_files_and_maps, core);
|
||||
r_cons_flush ();
|
||||
flush (sb);
|
||||
}
|
||||
#endif
|
||||
{
|
||||
r_core_cmd (core, "fz*", 0);
|
||||
r_cons_flush ();
|
||||
flush (sb);
|
||||
}
|
||||
if (opts & R_CORE_PRJ_META) {
|
||||
r_cons_printf ("# meta\n");
|
||||
r_meta_print_list_all (core->anal, R_META_TYPE_ANY, 1, NULL);
|
||||
r_cons_flush ();
|
||||
flush (sb);
|
||||
r_core_cmd (core, "fV*", 0);
|
||||
r_cons_flush ();
|
||||
flush (sb);
|
||||
}
|
||||
if (opts & R_CORE_PRJ_XREFS) {
|
||||
r_core_cmd (core, "ax*", 0);
|
||||
r_cons_flush ();
|
||||
flush (sb);
|
||||
}
|
||||
if (opts & R_CORE_PRJ_FLAGS) {
|
||||
r_core_cmd (core, "f.**", 0);
|
||||
r_cons_flush ();
|
||||
flush (sb);
|
||||
}
|
||||
if (opts & R_CORE_PRJ_DBG_BREAK) {
|
||||
r_core_cmd (core, "db*", 0);
|
||||
r_cons_flush ();
|
||||
flush (sb);
|
||||
}
|
||||
if (opts & R_CORE_PRJ_ANAL_HINTS) {
|
||||
r_core_cmd (core, "ah*", 0);
|
||||
r_cons_flush ();
|
||||
flush (sb);
|
||||
}
|
||||
if (opts & R_CORE_PRJ_ANAL_TYPES) {
|
||||
r_cons_printf ("# types\n");
|
||||
r_core_cmd (core, "t*", 0);
|
||||
r_cons_flush ();
|
||||
flush (sb);
|
||||
}
|
||||
if (opts & R_CORE_PRJ_ANAL_MACROS) {
|
||||
r_cons_printf ("# macros\n");
|
||||
r_core_cmd (core, "(*", 0);
|
||||
r_cons_printf ("# aliases\n");
|
||||
r_core_cmd (core, "$*", 0);
|
||||
r_cons_flush ();
|
||||
flush (sb);
|
||||
}
|
||||
r_core_cmd (core, "wc*", 0);
|
||||
if (opts & R_CORE_PRJ_ANAL_SEEK) {
|
||||
r_cons_printf ("# seek\n"
|
||||
"s 0x%08" PFMT64x "\n",
|
||||
core->offset);
|
||||
r_cons_flush ();
|
||||
flush (sb);
|
||||
}
|
||||
|
||||
r_cons_singleton ()->fdout = fdold;
|
||||
r_cons_singleton ()->context->is_interactive = true;
|
||||
flush (sb);
|
||||
char *s = r_strbuf_drain (sb);
|
||||
if (!strcmp (filename, "/dev/stdout")) {
|
||||
r_cons_printf ("%s\n", s);
|
||||
} else {
|
||||
if (!r_file_dump (filename, (const ut8*)s, strlen (s), 0)) {
|
||||
R_LOG_ERROR ("Cannot save file");
|
||||
}
|
||||
}
|
||||
free (s);
|
||||
|
||||
if (ohl) {
|
||||
r_cons_highlight (ohl);
|
||||
free (ohl);
|
||||
}
|
||||
|
||||
close (fd);
|
||||
free (filename);
|
||||
|
||||
return true;
|
||||
@ -630,7 +650,7 @@ R_API bool r_core_project_save(RCore *core, const char *prj_name) {
|
||||
prj_dir = strdup (prj_name);
|
||||
}
|
||||
if (r_core_is_project (core, prj_name) && strcmp (prj_name, r_config_get (core->config, "prj.name"))) {
|
||||
R_LOG_ERROR ("A project with this name already exists. Use Ps-%s to delete it", prj_name);
|
||||
R_LOG_ERROR ("A project with this name already exists. Use P-%s to delete it", prj_name);
|
||||
free (script_path);
|
||||
free (prj_dir);
|
||||
return false;
|
||||
|
@ -156,10 +156,9 @@ R_API int r_core_visual_view_zigns(RCore *core) {
|
||||
return false;
|
||||
case ':': // TODO: move this into a separate helper function
|
||||
{
|
||||
char cmd[1024];
|
||||
char cmd[1024] = {0};
|
||||
r_cons_show_cursor (true);
|
||||
r_cons_set_raw (0);
|
||||
cmd[0] = '\0';
|
||||
r_line_set_prompt (":> ");
|
||||
if (r_cons_fgets (cmd, sizeof (cmd), 0, NULL) < 0) {
|
||||
cmd[0] = '\0';
|
||||
|
@ -884,6 +884,7 @@ R_API int r_cons_write(const char *str, int len);
|
||||
R_API void r_cons_newline(void);
|
||||
R_API void r_cons_filter(void);
|
||||
R_API void r_cons_flush(void);
|
||||
// R2_580 - R_API char *r_cons_drain(void);
|
||||
R_API void r_cons_print_fps(int col);
|
||||
R_API void r_cons_last(void);
|
||||
R_API int r_cons_less_str(const char *str, const char *exitkeys);
|
||||
|
@ -103,13 +103,16 @@ static int handle_switch_op(ut64 addr, const ut8 * bytes, char *output, int outl
|
||||
}
|
||||
|
||||
R_API int java_print_opcode(RBinJavaObj *obj, ut64 addr, int idx, const ut8 *bytes, int len, char *output, int outlen) {
|
||||
char *arg = NULL; //(char *) malloc (1024);
|
||||
if (idx < 0 || idx >= JAVA_OPS_COUNT) {
|
||||
return -1;
|
||||
}
|
||||
char *arg = NULL;
|
||||
int sz = 0;
|
||||
ut32 val_one = 0;
|
||||
ut32 val_two = 0;
|
||||
ut8 op_byte = JAVA_OPS[idx].byte;
|
||||
if (IN_SWITCH_OP) {
|
||||
return handle_switch_op (addr, bytes, output, outlen );
|
||||
return handle_switch_op (addr, bytes, output, outlen);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -264,8 +267,12 @@ R_API void U(r_java_set_obj)(RBinJavaObj *obj) {
|
||||
}
|
||||
|
||||
R_API int r_java_disasm(RBinJavaObj *obj, ut64 addr, const ut8 *bytes, int len, char *output, int outlen) {
|
||||
r_return_val_if_fail (bytes && output && outlen > 0, -1);
|
||||
//r_cons_printf ("r_java_disasm (allowed %d): 0x%02x, 0x%0x.\n", outlen, bytes[0], addr);
|
||||
return java_print_opcode (obj, addr, bytes[0], bytes, len, output, outlen);
|
||||
if (len > 0) {
|
||||
return java_print_opcode (obj, addr, bytes[0], bytes, len, output, outlen);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int parseJavaArgs(char *str, ut64 *args, int args_sz) {
|
||||
|
@ -12,7 +12,7 @@ typedef struct java_op {
|
||||
} JavaOp;
|
||||
|
||||
#define JAVA_OPS_COUNT 297
|
||||
extern const struct java_op JAVA_OPS[JAVA_OPS_COUNT] ;
|
||||
extern const struct java_op JAVA_OPS[JAVA_OPS_COUNT];
|
||||
R_API int java_print_opcode(RBinJavaObj *obj, ut64 addr, int idx, const ut8 *bytes, int len, char *output, int outlen);
|
||||
R_API int r_java_disasm(RBinJavaObj *obj, ut64 addr, const ut8 *bytes, int len, char *output, int outlen);
|
||||
R_API int r_java_assemble(ut64 addr, ut8 *bytes, const char *string);
|
||||
|
@ -1,6 +1,5 @@
|
||||
NAME=Resaving maps fails
|
||||
FILE=-
|
||||
BROKEN=1
|
||||
CMDS=<<EOF
|
||||
om 3 0x8000 0x200 0x200 r--
|
||||
om 3 0xc000 0x100 0x300 r--
|
||||
@ -16,17 +15,21 @@ om*
|
||||
rm a.r2
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
om 3 0x00000000 0x00000200 0x00000000 rwx
|
||||
om 3 0x00008000 0x00000200 0x00000200 r--
|
||||
om 3 0x0000c000 0x00000100 0x00000300 r--
|
||||
omu 3 0x00000000 0x00000200 0x00000000 rwx
|
||||
omu 3 0x00008000 0x00000200 0x00000200 r--
|
||||
omu 3 0x0000c000 0x00000100 0x00000300 r--
|
||||
dos
|
||||
om 3 0x00000000 0x00000200 0x00000000 rwx
|
||||
om 3 0x00008000 0x00000200 0x00000200 r--
|
||||
om 3 0x0000c000 0x00000100 0x00000300 r--
|
||||
omu 3 0x00000000 0x00000200 0x00000000 rwx
|
||||
omu 3 0x00008000 0x00000200 0x00000200 r--
|
||||
omu 3 0x0000c000 0x00000100 0x00000300 r--
|
||||
tre
|
||||
omu 3 0x00000000 0x00000200 0x00000000 rwx
|
||||
omu 3 0x00008000 0x00000200 0x00000200 r--
|
||||
omu 3 0x0000c000 0x00000100 0x00000300 r--
|
||||
EOF
|
||||
RUN
|
||||
|
||||
NAME=Resaving fails
|
||||
NAME=Reloading a project twice fails
|
||||
FILE=bins/mach0/ls-m1
|
||||
BROKEN=1
|
||||
CMDS=<<EOF
|
||||
@ -34,8 +37,22 @@ e prj.vc=false
|
||||
e scr.interactive=false
|
||||
e dir.projects = bins/other/projects
|
||||
p8 16
|
||||
P-ls
|
||||
P-
|
||||
P+ls
|
||||
p8 16
|
||||
P-
|
||||
p8 16
|
||||
pd 10
|
||||
P ls
|
||||
b 64
|
||||
s+10
|
||||
s-10
|
||||
s
|
||||
o
|
||||
s
|
||||
pd 10
|
||||
om.
|
||||
p8 16
|
||||
o
|
||||
om
|
||||
@ -402,15 +419,15 @@ EXPECT=<<EOF
|
||||
* 3 fd: 3 +0x00000000 0x00001337 - 0x00001a12 r-x fmap.LOAD0
|
||||
- 2 fd: 3 +0x000006e0 0x00201a17 - 0x00201c46 r-- fmap.LOAD1
|
||||
- 1 fd: 4 +0x00000000 0x00201c47 - 0x00201c4e rw- mmap.LOAD1
|
||||
om 4 0x00201c47 0x00000008 0x00000000 rw- mmap.LOAD1
|
||||
om 3 0x00201a17 0x00000230 0x000006e0 r-- fmap.LOAD1
|
||||
om 3 0x00001337 0x000006dc 0x00000000 r-x fmap.LOAD0
|
||||
omu 4 0x00201c47 0x00000008 0x00000000 rw- mmap.LOAD1
|
||||
omu 3 0x00201a17 0x00000230 0x000006e0 r-- fmap.LOAD1
|
||||
omu 3 0x00001337 0x000006dc 0x00000000 r-x fmap.LOAD0
|
||||
--
|
||||
om 4 0x00201c47 0x00000008 0x00000000 rw- mmap.LOAD1
|
||||
om 3 0x00201a17 0x00000230 0x000006e0 r-- fmap.LOAD1
|
||||
om 3 0x00001337 0x000006dc 0x00000000 r-x fmap.LOAD0
|
||||
om 3 0x002020f7 0x00000230 0x00000000 r-- fmap.LOAD1
|
||||
om 3 0x00001337 0x000006dc 0x00000000 r-x fmap.LOAD0
|
||||
omu 4 0x00201c47 0x00000008 0x00000000 rw- mmap.LOAD1
|
||||
omu 3 0x00201a17 0x00000230 0x000006e0 r-- fmap.LOAD1
|
||||
omu 3 0x00001337 0x000006dc 0x00000000 r-x fmap.LOAD0
|
||||
omu 3 0x002020f7 0x00000230 0x00000000 r-- fmap.LOAD1
|
||||
omu 3 0x00001337 0x000006dc 0x00000000 r-x fmap.LOAD0
|
||||
--
|
||||
5
|
||||
0x00201c47
|
||||
@ -420,10 +437,6 @@ om 3 0x00001337 0x000006dc 0x00000000 r-x fmap.LOAD0
|
||||
0x00001337
|
||||
EOF
|
||||
RUN
|
||||
|
||||
NAME=Save project with maddr
|
||||
FILE=bins/elf/analysis/main
|
||||
ARGS=-n -m 0x1337
|
||||
CMDS=<<EOF
|
||||
e prj.vc=false
|
||||
e dir.projects = .tmp/
|
||||
@ -431,21 +444,30 @@ o
|
||||
om
|
||||
om*
|
||||
?e --
|
||||
P- hond
|
||||
e prj.name
|
||||
P-hond
|
||||
P+ hond > /dev/null
|
||||
P-
|
||||
P hond > /dev/null
|
||||
om*
|
||||
?e --
|
||||
om*~?
|
||||
om*~[2]
|
||||
EOF
|
||||
?e --
|
||||
om*~?
|
||||
om*~[2]
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
3 * r-x 0x000021da bins/elf/analysis/main
|
||||
* 1 fd: 3 +0x00000000 0x00001337 - 0x00003510 r-x
|
||||
om 3 0x00001337 0x000021da 0x00000000 r-x
|
||||
3 * rwx 0x00000200 malloc://512
|
||||
* 1 fd: 3 +0x00000000 0x00000000 - 0x000001ff rwx
|
||||
omu 3 0x00000000 0x00000200 0x00000000 rwx
|
||||
--
|
||||
|
||||
omu 3 0x00000000 0x00000200 0x00000000 rwx
|
||||
--
|
||||
0
|
||||
1
|
||||
0x00000000
|
||||
EOF
|
||||
RUN
|
||||
|
||||
@ -493,30 +515,30 @@ EXPECT=<<EOF
|
||||
- 3 fd: 3 +0x0001ec00 0x140022000 - 0x140022fff r-- fmap..pdata
|
||||
- 2 fd: 3 +0x0001fc00 0x140023000 - 0x1400231ff r-- fmap..reloc
|
||||
- 1 fd: 4 +0x00000000 0x140023200 - 0x140023fff r-- mmap..reloc
|
||||
om 4 0x140023200 0x00000e00 0x00000000 r-- mmap..reloc
|
||||
om 3 0x140023000 0x00000200 0x0001fc00 r-- fmap..reloc
|
||||
om 3 0x140022000 0x00001000 0x0001ec00 r-- fmap..pdata
|
||||
om 5 0x14001fe00 0x00002200 0x00000000 rw- mmap..data
|
||||
om 3 0x14001e000 0x00001e00 0x0001ce00 r-- fmap..data
|
||||
om 6 0x14001dc00 0x00000400 0x00000000 r-- mmap..rdata
|
||||
om 3 0x14001b000 0x00002c00 0x0001a200 r-- fmap..rdata
|
||||
om 7 0x14001ae00 0x00000200 0x00000000 r-x mmap..text
|
||||
om 3 0x140001000 0x00019e00 0x00000400 r-x fmap..text
|
||||
omu 4 0x140023200 0x00000e00 0x00000000 r-- mmap..reloc
|
||||
omu 3 0x140023000 0x00000200 0x0001fc00 r-- fmap..reloc
|
||||
omu 3 0x140022000 0x00001000 0x0001ec00 r-- fmap..pdata
|
||||
omu 5 0x14001fe00 0x00002200 0x00000000 rw- mmap..data
|
||||
omu 3 0x14001e000 0x00001e00 0x0001ce00 r-- fmap..data
|
||||
omu 6 0x14001dc00 0x00000400 0x00000000 r-- mmap..rdata
|
||||
omu 3 0x14001b000 0x00002c00 0x0001a200 r-- fmap..rdata
|
||||
omu 7 0x14001ae00 0x00000200 0x00000000 r-x mmap..text
|
||||
omu 3 0x140001000 0x00019e00 0x00000400 r-x fmap..text
|
||||
--
|
||||
: ;-- entry0:
|
||||
: 0x14001a1d4 4883ec28 sub rsp, 0x28 ; hello world
|
||||
: 0x14001a1d8 e85b050000 call 0x14001a738
|
||||
: 0x14001a1dd 4883c428 add rsp, 0x28
|
||||
`=< 0x14001a1e1 e972feffff jmp 0x14001a058
|
||||
om 4 0x140023200 0x00000e00 0x00000000 r-- mmap..reloc
|
||||
om 3 0x140023000 0x00000200 0x0001fc00 r-- fmap..reloc
|
||||
om 3 0x140022000 0x00001000 0x0001ec00 r-- fmap..pdata
|
||||
om 5 0x14001fe00 0x00002200 0x00000000 rw- mmap..data
|
||||
om 3 0x14001e000 0x00001e00 0x0001ce00 r-- fmap..data
|
||||
om 6 0x14001dc00 0x00000400 0x00000000 r-- mmap..rdata
|
||||
om 3 0x14001b000 0x00002c00 0x0001a200 r-- fmap..rdata
|
||||
om 7 0x14001ae00 0x00000200 0x00000000 r-x mmap..text
|
||||
om 3 0x140001000 0x00019e00 0x00000400 r-x fmap..text
|
||||
omu 4 0x140023200 0x00000e00 0x00000000 r-- mmap..reloc
|
||||
omu 3 0x140023000 0x00000200 0x0001fc00 r-- fmap..reloc
|
||||
omu 3 0x140022000 0x00001000 0x0001ec00 r-- fmap..pdata
|
||||
omu 5 0x14001fe00 0x00002200 0x00000000 rw- mmap..data
|
||||
omu 3 0x14001e000 0x00001e00 0x0001ce00 r-- fmap..data
|
||||
omu 6 0x14001dc00 0x00000400 0x00000000 r-- mmap..rdata
|
||||
omu 3 0x14001b000 0x00002c00 0x0001a200 r-- fmap..rdata
|
||||
omu 7 0x14001ae00 0x00000200 0x00000000 r-x mmap..text
|
||||
omu 3 0x140001000 0x00019e00 0x00000400 r-x fmap..text
|
||||
--
|
||||
9
|
||||
0x140023200
|
||||
|
Loading…
x
Reference in New Issue
Block a user