mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-03 10:51:01 +00:00
* Rename dbg.dwarf into asm.dwarf
- Display source lines at right of opcodes * Rename asm.reflines* into asm.lines* - asm.lineswide = false by default
This commit is contained in:
parent
668a77f7ee
commit
b8c3a23892
@ -99,7 +99,7 @@ To remove this message, put `dbxenv suppress_startup_message 7.5' in your .dbxrc
|
||||
Heisenbug: A bug that disappears or alters its behavior when one attempts to probe or isolate it.
|
||||
radare is for lulzhats
|
||||
Use 'e' and 't' in Visual mode to edit configuration and track flags
|
||||
Use rabin -rios to get the import/export/other symbols of any binary
|
||||
Use rabin2 -rios to get the import/export/other symbols of any binary
|
||||
Remember to maintain your ~/.radare_history
|
||||
Microloft Visual Radare.NET 2008. Now OOXML Powered!
|
||||
Enjoy the 'two girls one backup' viral video
|
||||
|
@ -8,3 +8,12 @@ R_API int r_bin_meta_get_line(RBin *bin, ut64 addr, char *file, int len, int *li
|
||||
return bin->cur->meta->get_line (bin, addr, file, len, line);
|
||||
return R_FALSE;
|
||||
}
|
||||
|
||||
R_API char *r_bin_meta_get_source_line(RBin *bin, ut64 addr) {
|
||||
char file[4096];
|
||||
int line;
|
||||
char *out = NULL;
|
||||
if (r_bin_meta_get_line (bin, addr, file, sizeof (file), &line))
|
||||
out = r_file_slurp_line (file, line, 0);
|
||||
return out;
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ static int rabin_show_info() {
|
||||
"e asm.os=%s\n"
|
||||
"e asm.arch=%s\n"
|
||||
"e asm.bits=%i\n"
|
||||
"e dbg.dwarf=%s\n",
|
||||
"e asm.dwarf=%s\n",
|
||||
info->rclass, info->big_endian?"true":"false", info->os, info->arch,
|
||||
info->bits, R_BIN_DBG_STRIPPED (info->dbg_info)?"false":"true");
|
||||
} else printf ("[File info]\n"
|
||||
|
@ -21,7 +21,7 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
file[0]='\0';
|
||||
if (!r_bin_meta_get_line(bin, r_num_get(NULL, argv[2]), file, 1023, &line)) {
|
||||
if (!r_bin_meta_get_line (bin, r_num_get(NULL, argv[2]), file, 1023, &line)) {
|
||||
eprintf ("Cannot get metadata\n");
|
||||
return 1;
|
||||
}
|
||||
|
@ -345,10 +345,10 @@ R_API int r_core_anal_fcn_list(struct r_core_t *core, int rad) {
|
||||
|
||||
R_API int r_core_anal_graph(struct r_core_t *core, ut64 addr, int lines) {
|
||||
RList *pbb = NULL;
|
||||
int reflines = r_config_get_i(&core->config, "asm.reflines");
|
||||
int reflines = r_config_get_i(&core->config, "asm.lines");
|
||||
int bytes = r_config_get_i(&core->config, "asm.bytes");
|
||||
|
||||
r_config_set_i(&core->config, "asm.reflines", 0);
|
||||
r_config_set_i(&core->config, "asm.lines", 0);
|
||||
r_config_set_i(&core->config, "asm.bytes", 0);
|
||||
r_cons_printf ("digraph code {\n");
|
||||
r_cons_printf ("\tgraph [bgcolor=white];\n");
|
||||
@ -359,7 +359,7 @@ R_API int r_core_anal_graph(struct r_core_t *core, ut64 addr, int lines) {
|
||||
if (pbb) r_list_destroy (pbb);
|
||||
r_cons_printf ("}\n");
|
||||
r_cons_flush ();
|
||||
r_config_set_i(&core->config, "asm.reflines", reflines);
|
||||
r_config_set_i(&core->config, "asm.lines", reflines);
|
||||
r_config_set_i(&core->config, "asm.bytes", bytes);
|
||||
return R_TRUE;
|
||||
}
|
||||
|
@ -700,15 +700,16 @@ static int cmd_print(void *data, const char *input) {
|
||||
int show_offset = r_config_get_i (&core->config, "asm.offset");
|
||||
int show_bytes = r_config_get_i (&core->config, "asm.bytes");
|
||||
int show_color = r_config_get_i (&core->config, "scr.color");
|
||||
int show_lines = r_config_get_i (&core->config, "asm.reflines");
|
||||
int linesout = r_config_get_i (&core->config, "asm.reflinesout");
|
||||
int show_lines = r_config_get_i (&core->config, "asm.lines");
|
||||
int show_dwarf = r_config_get_i (&core->config, "asm.dwarf");
|
||||
int linesout = r_config_get_i (&core->config, "asm.linesout");
|
||||
int show_comments = r_config_get_i (&core->config, "asm.comments");
|
||||
int pseudo = r_config_get_i (&core->config, "asm.pseudo");
|
||||
int linesopts = 0;
|
||||
|
||||
if (r_config_get_i (&core->config, "asm.reflinesstyle"))
|
||||
if (r_config_get_i (&core->config, "asm.linesstyle"))
|
||||
linesopts |= R_ANAL_REFLINE_STYLE;
|
||||
if (r_config_get_i (&core->config, "asm.reflineswide"))
|
||||
if (r_config_get_i (&core->config, "asm.lineswide"))
|
||||
linesopts |= R_ANAL_REFLINE_WIDE;
|
||||
|
||||
/* XXX: This is only for pd/pD ??? */
|
||||
@ -722,7 +723,7 @@ static int cmd_print(void *data, const char *input) {
|
||||
}
|
||||
} else l = 9999;
|
||||
|
||||
switch(input[0]) {
|
||||
switch (input[0]) {
|
||||
case 'D':
|
||||
case 'd':
|
||||
// TODO: move to a function...we need a flag instead of thousand config_foo's
|
||||
@ -733,7 +734,9 @@ static int cmd_print(void *data, const char *input) {
|
||||
char str[128];
|
||||
char line[128];
|
||||
char *comment;
|
||||
struct r_asm_aop_t asmop;
|
||||
char *opstr;
|
||||
char *osl = NULL; // old source line
|
||||
RAsmAop asmop;
|
||||
struct r_anal_aop_t analop;
|
||||
struct r_anal_refline_t *reflines;
|
||||
|
||||
@ -757,7 +760,7 @@ static int cmd_print(void *data, const char *input) {
|
||||
ret = r_asm_disassemble (&core->assembler, &asmop, buf+idx, len-idx);
|
||||
if (ret<1) {
|
||||
ret = 1;
|
||||
eprintf("** invalid opcode at 0x%08llx **\n", core->assembler.pc + ret);
|
||||
eprintf ("** invalid opcode at 0x%08llx **\n", core->assembler.pc + ret);
|
||||
continue;
|
||||
}
|
||||
r_anal_aop (&core->anal, &analop, addr, buf+idx, (int)(len-idx));
|
||||
@ -802,11 +805,29 @@ static int cmd_print(void *data, const char *input) {
|
||||
}
|
||||
}
|
||||
if (pseudo) {
|
||||
r_parse_parse(&core->parser, asmop.buf_asm, str);
|
||||
r_cons_printf("%s\n", str);
|
||||
} else r_cons_printf("%s\n", asmop.buf_asm);
|
||||
r_parse_parse (&core->parser, asmop.buf_asm, str);
|
||||
opstr = str;
|
||||
} else opstr = asmop.buf_asm;
|
||||
r_cons_strcat (opstr);
|
||||
if (show_color)
|
||||
r_cons_printf (Color_RESET);
|
||||
r_cons_strcat (Color_RESET);
|
||||
if (show_dwarf) {
|
||||
char *sl = r_bin_meta_get_source_line (&core->bin, addr);
|
||||
int len = strlen (opstr);
|
||||
if (len<30)
|
||||
len = 30-len;
|
||||
if (sl)
|
||||
if (!osl || (osl && strcmp (sl, osl))) {
|
||||
while (len--)
|
||||
r_cons_strcat (" ");
|
||||
if (show_color)
|
||||
r_cons_printf (Color_TURQOISE" ; %s"Color_RESET, sl);
|
||||
else r_cons_printf (" ; %s\n", sl);
|
||||
free (osl);
|
||||
osl = sl;
|
||||
}
|
||||
}
|
||||
r_cons_strcat ("\n");
|
||||
if (show_lines && analop.type == R_ANAL_OP_TYPE_RET) {
|
||||
if (strchr(line, '>'))
|
||||
memset(line, ' ', strlen(line));
|
||||
@ -815,6 +836,7 @@ static int cmd_print(void *data, const char *input) {
|
||||
}
|
||||
}
|
||||
free (reflines);
|
||||
free (osl);
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
|
@ -138,11 +138,12 @@ R_API int r_core_config_init(RCore *core) {
|
||||
r_config_set (cfg, "asm.pseudo", "false"); // DEPRECATED ???
|
||||
r_config_set (cfg, "asm.bytes", "true");
|
||||
r_config_set (cfg, "asm.offset", "true");
|
||||
r_config_set (cfg, "asm.reflines", "true");
|
||||
r_config_set (cfg, "asm.reflinesout", "true");
|
||||
r_config_set (cfg, "asm.reflinesstyle", "false");
|
||||
r_config_set (cfg, "asm.reflineswide", "true");
|
||||
r_config_set (cfg, "asm.lines", "true");
|
||||
r_config_set (cfg, "asm.linesout", "true");
|
||||
r_config_set (cfg, "asm.linesstyle", "false");
|
||||
r_config_set (cfg, "asm.lineswide", "false");
|
||||
r_config_set (cfg, "asm.comments", "true");
|
||||
r_config_set (cfg, "asm.dwarf", "false");
|
||||
r_config_set (cfg, "cmd.open", "");
|
||||
r_config_set (cfg, "cmd.prompt", "");
|
||||
r_config_set (cfg, "cmd.vprompt", "");
|
||||
@ -311,7 +312,6 @@ R_API int r_core_config_init(RCore *core) {
|
||||
config_set_i("dbg.focus", 0); // focus on ps.pid or not (ignore events of rest of procs)
|
||||
config_set("dbg.syms", "true");
|
||||
config_set("dbg.stepo", "false"); // step over for !contu (debug_step())
|
||||
config_set("dbg.dwarf", "false");
|
||||
config_set("dbg.maps", "true");
|
||||
config_set("dbg.sections", "true");
|
||||
config_set("dbg.strings", "false");
|
||||
|
@ -164,6 +164,7 @@ R_API void r_bin_set_user_ptr(RBin *bin, void *user);
|
||||
|
||||
/* bin_meta.c */
|
||||
R_API int r_bin_meta_get_line(RBin *bin, ut64 addr, char *file, int len, int *line);
|
||||
R_API char *r_bin_meta_get_source_line(RBin *bin, ut64 addr);
|
||||
|
||||
/* bin_write.c */
|
||||
R_API ut64 r_bin_wr_scn_resize(RBin *bin, const char *name, ut64 size);
|
||||
|
Loading…
Reference in New Issue
Block a user