Implement 'dd-' using code injection

This commit is contained in:
pancake 2013-09-18 03:44:11 +02:00
parent f1d70a76c8
commit 9a6c149768
2 changed files with 7 additions and 2 deletions

View File

@ -851,7 +851,8 @@ static int cmd_debug(void *data, const char *input) {
break; break;
case '-': case '-':
// close file // close file
r_core_syscallf (core, "close", "%d", atoi (input+2)); //r_core_syscallf (core, "close", "%d", atoi (input+2));
r_core_cmdf (core, "dis close %d", atoi (input+2));
// TODO: run // TODO: run
break; break;
case ' ': case ' ':
@ -865,6 +866,8 @@ static int cmd_debug(void *data, const char *input) {
r_cons_printf ("Usage: dd[*sdrw-?]\n" r_cons_printf ("Usage: dd[*sdrw-?]\n"
" dd list filedescriptors\n" " dd list filedescriptors\n"
" dd* list filedescriptors (in radare commands)\n" " dd* list filedescriptors (in radare commands)\n"
" dd-1 close stdout fd\n"
" dd file open and map that file into the UI\n"
" dd? show this help\n"); " dd? show this help\n");
break; break;
} }

View File

@ -246,7 +246,9 @@ R_API int r_debug_wait(RDebug *dbg) {
if (ret == R_DBG_REASON_SIGNAL) { if (ret == R_DBG_REASON_SIGNAL) {
/* handle signal on continuations here */ /* handle signal on continuations here */
int what = r_debug_signal_what (dbg, dbg->signum); int what = r_debug_signal_what (dbg, dbg->signum);
r_cons_printf ("[+] signal %d received\n", dbg->signum); const char *name = r_debug_signal_resolve_i (dbg, dbg->signum);
r_cons_printf ("[+] signal %d aka %s received\n",
dbg->signum, name);
if (what & R_DBG_SIGNAL_SKIP) { if (what & R_DBG_SIGNAL_SKIP) {
dbg->signum = 0; dbg->signum = 0;
// TODO: use ptrace-setsiginfo to ignore signal // TODO: use ptrace-setsiginfo to ignore signal