diff --git a/libr/debug/debug.c b/libr/debug/debug.c index c03eb9589d..5f31c35371 100644 --- a/libr/debug/debug.c +++ b/libr/debug/debug.c @@ -118,8 +118,10 @@ static int r_debug_bp_hit(RDebug *dbg, RRegItem *pc_ri, ut64 pc, RBreakpointItem /* inform the user of what happened */ if (dbg->hitinfo) { - eprintf ("hit %spoint at: %"PFMT64x "\n", - b->trace ? "trace" : "break", pc); + //eprintf ("hit %spoint at: %"PFMT64x "\n", + // b->trace ? "trace" : "break", pc); + r_cons_printf ("hit %spoint at: %"PFMT64x "\n", + b->trace ? "trace" : "break", pc); } /* now that we've cleaned up after the breakpoint, call the other diff --git a/libr/debug/p/debug_native.c b/libr/debug/p/debug_native.c index 80f9a177a5..52a9a76459 100644 --- a/libr/debug/p/debug_native.c +++ b/libr/debug/p/debug_native.c @@ -316,8 +316,11 @@ static bool tracelib(RDebug *dbg, const char *mode, PLIB_ITEM item) { case 'u': needle = dbg->glob_unlibs; break; } } - eprintf ("(%d) %sing library at %p (%s) %s\n", item->pid, mode, + //eprintf ("(%d) %sing library at %p (%s) %s\n", item->pid, mode, + //item->BaseOfDll, item->Path, item->Name); + r_cons_printf ("(%d) %sing library at %p (%s) %s\n", item->pid, mode, item->BaseOfDll, item->Path, item->Name); + r_cons_flush (); if (needle && strlen (needle)) { tmp = r_str_glob (item->Name, needle); } @@ -365,7 +368,9 @@ static RDebugReasonType r_debug_native_wait (RDebug *dbg, int pid) { dbg->corebind.cmdf (core, "o-%d", fd); } } else { - eprintf ("Loading unknown library.\n"); + //eprintf ("Loading unknown library.\n"); + r_cons_printf ("Loading unknown library.\n"); + r_cons_flush (); } } else if (reason == R_DEBUG_REASON_EXIT_LIB) { RDebugInfo *r = r_debug_native_info (dbg, ""); @@ -375,13 +380,19 @@ static RDebugReasonType r_debug_native_wait (RDebug *dbg, int pid) { } r_debug_info_free (r); } else { - eprintf ("Unloading unknown library.\n"); + //eprintf ("Unloading unknown library.\n"); + r_cons_printf ("Unloading unknown library.\n"); + r_cons_flush (); + } } else if (reason == R_DEBUG_REASON_NEW_TID) { RDebugInfo *r = r_debug_native_info (dbg, ""); if (r && r->thread) { PTHREAD_ITEM item = r->thread; - eprintf ("(%d) Created thread %d (start @ %p)\n", item->pid, item->tid, item->lpStartAddress); + //eprintf ("(%d) Created thread %d (start @ %p)\n", item->pid, item->tid, item->lpStartAddress); + r_cons_printf ("(%d) Created thread %d (start @ %p)\n", item->pid, item->tid, item->lpStartAddress); + r_cons_flush (); + r_debug_info_free (r); } @@ -389,7 +400,10 @@ static RDebugReasonType r_debug_native_wait (RDebug *dbg, int pid) { RDebugInfo *r = r_debug_native_info (dbg, ""); if (r && r->thread) { PTHREAD_ITEM item = r->thread; - eprintf ("(%d) Finished thread %d Exit code %d\n", (ut32)item->pid, (ut32)item->tid, (ut32)item->dwExitCode); + //eprintf ("(%d) Finished thread %d Exit code %d\n", (ut32)item->pid, (ut32)item->tid, (ut32)item->dwExitCode); + r_cons_printf ("(%d) Finished thread %d Exit code %d\n", (ut32)item->pid, (ut32)item->tid, (ut32)item->dwExitCode); + r_cons_flush (); + r_debug_info_free (r); } } diff --git a/libr/debug/p/native/w32.c b/libr/debug/p/native/w32.c index 2bcbb28f55..3457b06931 100644 --- a/libr/debug/p/native/w32.c +++ b/libr/debug/p/native/w32.c @@ -641,8 +641,11 @@ static int w32_dbg_wait(RDebug *dbg, int pid) { ret = R_DEBUG_REASON_NEW_PID; break; case EXIT_PROCESS_DEBUG_EVENT: - eprintf ("(%d) Process %d exited with exit code %d\n", (int)de.dwProcessId, (int)de.dwProcessId, + //eprintf ("(%d) Process %d exited with exit code %d\n", (int)de.dwProcessId, (int)de.dwProcessId, + // (int)de.u.ExitProcess.dwExitCode); + r_cons_printf ("(%d) Process %d exited with exit code %d\n", (int)de.dwProcessId, (int)de.dwProcessId, (int)de.u.ExitProcess.dwExitCode); + r_cons_flush (); //debug_load(); next_event = 0; exited_already = pid; @@ -692,12 +695,17 @@ static int w32_dbg_wait(RDebug *dbg, int pid) { ret = R_DEBUG_REASON_EXIT_LIB; break; case OUTPUT_DEBUG_STRING_EVENT: - eprintf ("(%d) Debug string\n", pid); + //eprintf ("(%d) Debug string\n", pid); + r_cons_printf ("(%d) Debug string\n", pid); + r_cons_flush (); + r_debug_native_continue (dbg, pid, tid, -1); next_event = 1; break; case RIP_EVENT: - eprintf ("(%d) RIP event\n", pid); + //eprintf ("(%d) RIP event\n", pid); + r_cons_printf ("(%d) RIP event\n", pid); + r_cons_flush (); r_debug_native_continue (dbg, pid, tid, -1); next_event = 1; // XXX unknown ret = R_DEBUG_REASON_TRAP;