mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-04 19:47:31 +00:00
Random fixes and improvements for visual debug traces
This commit is contained in:
parent
82d1e96b7a
commit
41c7ba5cd2
@ -4224,7 +4224,7 @@ static char *get_corefile_name (const char *raw_name, int pid) {
|
||||
}
|
||||
|
||||
static int cmd_debug_step (RCore *core, const char *input) {
|
||||
ut64 addr;
|
||||
ut64 addr = core->offset;;
|
||||
ut8 buf[64];
|
||||
RAnalOp aop;
|
||||
int i, times = 1;
|
||||
@ -4243,7 +4243,7 @@ static int cmd_debug_step (RCore *core, const char *input) {
|
||||
// XXX(jjd): is this necessary?
|
||||
r_debug_reg_sync (core->dbg, R_REG_TYPE_GPR, false);
|
||||
ut64 pc = r_debug_reg_get (core->dbg, "PC");
|
||||
r_debug_trace_pc (core->dbg, addr);
|
||||
r_debug_trace_pc (core->dbg, pc);
|
||||
if (!r_debug_step (core->dbg, times)) {
|
||||
eprintf ("Step failed\n");
|
||||
core->break_loop = true;
|
||||
@ -4470,8 +4470,21 @@ static int cmd_debug(void *data, const char *input) {
|
||||
}
|
||||
break;
|
||||
case 'd': // "dtd"
|
||||
if (input[2] == ' ') {
|
||||
int min = r_num_math (core->num, input + 2);
|
||||
if (input[2] == 'q') {
|
||||
int min = r_num_math (core->num, input + 3);
|
||||
RListIter *iter;
|
||||
RDebugTracepoint *trace;
|
||||
int n = 0;
|
||||
r_list_foreach (core->dbg->trace->traces, iter, trace) {
|
||||
// if (trace->count >= min) {
|
||||
if (n >= min) {
|
||||
r_cons_printf ("0x%08"PFMT64x"\n", trace->addr);
|
||||
break;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
} else{ if (input[2] == ' ') {
|
||||
int min = r_num_math (core->num, input + 3);
|
||||
RListIter *iter;
|
||||
RDebugTracepoint *trace;
|
||||
int n = 0;
|
||||
@ -4486,6 +4499,7 @@ static int cmd_debug(void *data, const char *input) {
|
||||
// TODO: reimplement using the api
|
||||
r_core_cmd0 (core, "pd 1 @@= `dtq`");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'g': // "dtg"
|
||||
dot_trace_traverse (core, core->dbg->tree, input[2]);
|
||||
|
@ -2771,17 +2771,32 @@ static void r_core_visual_anal_refresh_oneshot (RCore *core) {
|
||||
r_core_task_enqueue_oneshot (core, (RCoreTaskOneShot) r_core_visual_anal_refresh, core);
|
||||
}
|
||||
|
||||
static void r_core_visual_debugtraces_help(RCore *core) {
|
||||
r_cons_clear00 ();
|
||||
r_cons_printf (
|
||||
"vbd: Visual Browse Debugtraces:\n\n"
|
||||
" q - quit the bit editor\n"
|
||||
" Q - Quit (jump into the disasm view)\n"
|
||||
" j/k - Select next/previous trace\n"
|
||||
" : - enter command\n");
|
||||
r_cons_flush ();
|
||||
r_cons_any_key (NULL);
|
||||
}
|
||||
|
||||
R_API void r_core_visual_debugtraces(RCore *core, const char *input) {
|
||||
int i, delta = 0;
|
||||
for (;;) {
|
||||
r_cons_printf ("[0x%08x]> dbg.trace\n", delta);
|
||||
char *trace_addr_str = r_core_cmd_strf (core, "dtdq %d", delta);
|
||||
ut64 trace_addr = r_num_get (NULL, trace_addr_str);
|
||||
free (trace_addr_str);
|
||||
r_cons_printf ("[0x%08"PFMT64x"]> %d dbg.trace\n", trace_addr, delta);
|
||||
for (i = 0; i < delta; i++) {
|
||||
r_core_cmdf (core, ".dte %d", i);
|
||||
}
|
||||
r_core_cmd0 (core, "x 64@rsp");
|
||||
r_core_cmd0 (core, "x 64@r:SP");
|
||||
r_core_cmd0 (core, "dri");
|
||||
// limit by rows here
|
||||
int rows = r_cons_get_size (NULL);
|
||||
//int rows = r_cons_get_size (NULL);
|
||||
r_core_cmdf (core, "dtd %d", delta);
|
||||
r_cons_visual_flush ();
|
||||
char ch ;
|
||||
@ -2800,16 +2815,23 @@ R_API void r_core_visual_debugtraces(RCore *core, const char *input) {
|
||||
}
|
||||
ch = r_cons_arrow_to_hjkl (ch); // get ESC+char, return 'hjkl' char
|
||||
switch (ch) {
|
||||
case 'Q': // tab
|
||||
{
|
||||
ut64 oseek = core->offset;
|
||||
core->vmode = false;
|
||||
r_core_seek (core, trace_addr, true);
|
||||
r_core_visual (core, "");
|
||||
r_core_seek (core, oseek, true);
|
||||
}
|
||||
break;
|
||||
case 'q':
|
||||
goto beach;
|
||||
break;
|
||||
case '?':
|
||||
break;
|
||||
case ']':
|
||||
r_config_set (core->config, "hex.cols", r_config_get_i (core->config, "hex.cols") + 1);
|
||||
r_config_set_i (core->config, "hex.cols", r_config_get_i (core->config, "hex.cols") + 1);
|
||||
break;
|
||||
case '[':
|
||||
r_config_set (core->config, "hex.cols", r_config_get_i (core->config, "hex.cols") - 1);
|
||||
r_config_set_i (core->config, "hex.cols", r_config_get_i (core->config, "hex.cols") - 1);
|
||||
break;
|
||||
case 'J':
|
||||
delta += 10;
|
||||
@ -2832,6 +2854,9 @@ R_API void r_core_visual_debugtraces(RCore *core, const char *input) {
|
||||
r_core_visual_prompt (core);
|
||||
r_cons_any_key (NULL);
|
||||
break;
|
||||
case '?':
|
||||
r_core_visual_debugtraces_help (core);
|
||||
break;
|
||||
}
|
||||
}
|
||||
beach:
|
||||
|
Loading…
Reference in New Issue
Block a user