mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-23 14:28:07 +00:00
Fix #10731 - Implement diq and use it in Visual debugger mode
This commit is contained in:
parent
87741bd3b9
commit
b3d0224071
@ -174,6 +174,7 @@ static const char *help_msg_di[] = {
|
||||
"Usage: di", "", "Debugger target information",
|
||||
"di", "", "Show debugger target information",
|
||||
"di*", "", "Same as above, but in r2 commands",
|
||||
"diq", "", "Same as above, but in one line",
|
||||
"dij", "", "Same as above, but in JSON format",
|
||||
NULL
|
||||
};
|
||||
@ -4723,7 +4724,9 @@ static int cmd_debug(void *data, const char *input) {
|
||||
P ("kernel_stack=\n%s\n", rdi->kernel_stack);
|
||||
}
|
||||
}
|
||||
if (stop != -1) P ("stopreason=%d\n", stop);
|
||||
if (stop != -1) {
|
||||
P ("stopreason=%d\n", stop);
|
||||
}
|
||||
break;
|
||||
case '*': // "di*"
|
||||
if (rdi) {
|
||||
@ -4772,6 +4775,15 @@ static int cmd_debug(void *data, const char *input) {
|
||||
break;
|
||||
#undef P
|
||||
#undef PS
|
||||
case 'q':
|
||||
{
|
||||
const char *r = r_debug_reason_to_string (core->dbg->reason.type);
|
||||
if (!r) {
|
||||
r = "none";
|
||||
}
|
||||
r_cons_printf ("%s at 0x%08"PFMT64x"\n", r, core->dbg->stopaddr);
|
||||
}
|
||||
break;
|
||||
case '?': // "dij"
|
||||
default:
|
||||
r_core_cmd_help (core, help_msg_di);
|
||||
|
@ -3156,7 +3156,7 @@ dodo:
|
||||
const char sign = (delta < 0)? '+': '-';
|
||||
const int absdelta = R_ABS (delta);
|
||||
snprintf (debugstr, sizeof (debugstr),
|
||||
"?0;f tmp;ssr SP;%s %d@$$%c%d;"
|
||||
"diq;?0;f tmp;ssr SP;%s %d@$$%c%d;"
|
||||
"?1;%s;"
|
||||
"?1;ss tmp;f-tmp;afal;pd $r",
|
||||
pxa? "pxa": pxw, size, sign, absdelta,
|
||||
|
@ -249,8 +249,7 @@ static int r_debug_native_continue(RDebug *dbg, int pid, int tid, int sig) {
|
||||
}
|
||||
return tid;
|
||||
#elif __APPLE__
|
||||
bool ret;
|
||||
ret = xnu_continue (dbg, pid, tid, sig);
|
||||
bool ret = xnu_continue (dbg, pid, tid, sig);
|
||||
if (!ret) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -304,16 +304,18 @@ static int handle_exception_message (RDebug *dbg, exc_msg *msg, int *ret_code) {
|
||||
ret = R_DEBUG_REASON_SEGFAULT;
|
||||
*ret_code = KERN_FAILURE;
|
||||
kr = task_suspend (msg->task.name);
|
||||
if (kr != KERN_SUCCESS)
|
||||
if (kr != KERN_SUCCESS) {
|
||||
eprintf ("failed to suspend task bad access\n");
|
||||
}
|
||||
eprintf ("EXC_BAD_ACCESS\n");
|
||||
break;
|
||||
case EXC_BAD_INSTRUCTION:
|
||||
ret = R_DEBUG_REASON_ILLEGAL;
|
||||
*ret_code = KERN_FAILURE;
|
||||
kr = task_suspend (msg->task.name);
|
||||
if (kr != KERN_SUCCESS)
|
||||
if (kr != KERN_SUCCESS) {
|
||||
eprintf ("failed to suspend task bad instruction\n");
|
||||
}
|
||||
eprintf ("EXC_BAD_INSTRUCTION\n");
|
||||
break;
|
||||
case EXC_ARITHMETIC:
|
||||
@ -327,8 +329,9 @@ static int handle_exception_message (RDebug *dbg, exc_msg *msg, int *ret_code) {
|
||||
break;
|
||||
case EXC_BREAKPOINT:
|
||||
kr = task_suspend (msg->task.name);
|
||||
if (kr != KERN_SUCCESS)
|
||||
if (kr != KERN_SUCCESS) {
|
||||
eprintf ("failed to suspend task breakpoint\n");
|
||||
}
|
||||
ret = R_DEBUG_REASON_BREAKPOINT;
|
||||
break;
|
||||
default:
|
||||
@ -388,8 +391,9 @@ static int __xnu_wait (RDebug *dbg, int pid) {
|
||||
MACH_PORT_NULL);
|
||||
if (reply.Head.msgh_remote_port != 0 && kr != MACH_MSG_SUCCESS) {
|
||||
kr = mach_port_deallocate(mach_task_self (), reply.Head.msgh_remote_port);
|
||||
if (kr != KERN_SUCCESS)
|
||||
if (kr != KERN_SUCCESS) {
|
||||
eprintf ("failed to deallocate reply port\n");
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -407,6 +411,7 @@ static int __xnu_wait (RDebug *dbg, int pid) {
|
||||
}
|
||||
break; // to avoid infinite loops
|
||||
}
|
||||
dbg->stopaddr = r_debug_reg_get (dbg, "PC");
|
||||
return reason;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user