Add fcnInsteadOfAddr arg for proper xX in visualRefs from V, Vb and VV

This commit is contained in:
pancake 2018-11-25 01:55:46 +01:00
parent 0b582468ef
commit 272d01784e
5 changed files with 26 additions and 20 deletions

View File

@ -4053,8 +4053,8 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
ut64 old_off = core->offset;
ut64 off = r_core_anal_get_bbaddr (core, core->offset);
r_core_seek (core, off, 0);
if ((key == 'x' && !r_core_visual_refs (core, true)) ||
(key == 'X' && !r_core_visual_refs (core, false))) {
if ((key == 'x' && !r_core_visual_refs (core, true, true)) ||
(key == 'X' && !r_core_visual_refs (core, false, true))) {
r_core_seek (core, old_off, 0);
}
break;

View File

@ -2999,7 +2999,7 @@ repeat:
}
break;
case 'x':
r_core_visual_refs (core, true);
r_core_visual_refs (core, true, true);
core->panels->panel[core->panels->curnode].addr = core->offset;
setRefreshAll (panels);
break;

View File

@ -1040,7 +1040,7 @@ static int follow_ref(RCore *core, RList *xrefs, int choice) {
return 0;
}
R_API int r_core_visual_refs(RCore *core, bool xref) {
R_API int r_core_visual_refs(RCore *core, bool xref, bool fcnInsteadOfAddr) {
int ret = 0;
#if FCN_OLD
char ch;
@ -1053,7 +1053,7 @@ R_API int r_core_visual_refs(RCore *core, bool xref) {
char cstr[32];
ut64 addr = core->offset;
int printMode = 0;
bool xrefsMode = false;
bool xrefsMode = fcnInsteadOfAddr;
int lastPrintMode = 3;
if (core->print->cur_enabled) {
addr += core->print->cur;
@ -1798,10 +1798,10 @@ R_API void r_core_visual_browse(RCore *core) {
r_core_cmd0 (core, "s $(dm~...)");
break;
case 'x':
r_core_visual_refs (core, true);
r_core_visual_refs (core, true, true);
break;
case 'X':
r_core_visual_refs (core, false);
r_core_visual_refs (core, false, true);
break;
case 'h': // seek history
r_core_cmdf (core, "s!~...");
@ -2368,10 +2368,10 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
}
break;
case 'x':
r_core_visual_refs (core, true);
r_core_visual_refs (core, true, false);
break;
case 'X':
r_core_visual_refs (core, false);
r_core_visual_refs (core, false, false);
break;
case 'r':
// TODO: toggle shortcut hotkeys

View File

@ -2448,12 +2448,8 @@ static ut64 r_core_visual_anal_refresh (RCore *core) {
sprintf (old, "afi @ 0x%08"PFMT64x, addr);
r_core_cmd0 (core, old);
break;
case 3:
r_cons_printf ("Press 'q' to view call refs\n");
r_cons_printf ("-[ xrefs ]----------------------- 0x%08"PFMT64x"\n", addr);
//sprintf (old, "axl~0x%08"PFMT64x, addr);
r_core_cmd0 (core, "pd 1");
//r_core_cmd0 (core, old);
default:
// assert
break;
}
r_cons_flush ();
@ -2512,7 +2508,7 @@ R_API void r_core_visual_anal(RCore *core, const char *input) {
" h,q go back, quit\n"
" p,P switch next/prev print mode\n"
" v view selected function arguments and variables\n"
" x see xrefs to the selected function\n"
" x,X see xrefs to the selected function\n"
" tab toggle disasm column selection (to scroll in code)\n"
" ! run 'afls' to sort all functions by address\n"
" . seek to current function address\n"
@ -2616,9 +2612,19 @@ R_API void r_core_visual_anal(RCore *core, const char *input) {
break;
}
break;
case 'x': level = 3; break;
case 'c': level = 2; break;
case 'v': level = 1; variable_option = 0; break;
case 'x':
r_core_visual_refs (core, false, true);
break;
case 'X':
r_core_visual_refs (core, true, true);
break;
case 'c':
level = 2;
break;
case 'v':
level = 1;
variable_option = 0;
break;
case '_':
r_core_cmd0 (core, "s $(afl~...)");
break;

View File

@ -337,7 +337,7 @@ R_API int r_core_seek_size(RCore *core, ut64 addr, int bsize);
R_API int r_core_is_valid_offset (RCore *core, ut64 offset);
R_API int r_core_shift_block(RCore *core, ut64 addr, ut64 b_size, st64 dist);
R_API void r_core_visual_prompt_input (RCore *core);
R_API int r_core_visual_refs(RCore *core, bool xref);
R_API int r_core_visual_refs(RCore *core, bool xref, bool fcnInsteadOfAddr);
R_API void r_core_visual_append_help(RStrBuf *p, const char *title, const char **help);
R_API bool r_core_prevop_addr(RCore* core, ut64 start_addr, int numinstrs, ut64* prev_addr);
R_API ut64 r_core_prevop_addr_force(RCore *core, ut64 start_addr, int numinstrs);