diff options
author | Doug Evans <dje@google.com> | 2009-02-01 23:31:03 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2009-02-01 23:31:03 +0000 |
commit | f00150c95d261f2fac4fbab21d60eceb2ccb7d3e (patch) | |
tree | 8125185686eb132d5fda0af5da87b9b38bebb5bb /gdb/target.c | |
parent | 273f4430f86503a7e746f8710c6165f794a360bd (diff) | |
download | gdb-f00150c95d261f2fac4fbab21d60eceb2ccb7d3e.zip gdb-f00150c95d261f2fac4fbab21d60eceb2ccb7d3e.tar.gz gdb-f00150c95d261f2fac4fbab21d60eceb2ccb7d3e.tar.bz2 |
* target.h (target_waitstatus_to_string): Declare.
* target.c (target_waitstatus_to_string): New function. Copied from
debug_to_wait. Add missing entries for TARGET_WAITKIND_SYSCALL_ENTRY,
TARGET_WAITKIND_SYSCALL_RETURN, TARGET_WAITKIND_IGNORE,
TARGET_WAITKIND_NO_HISTORY.
(debug_to_wait): Call it.
* infrun.c (wait_for_inferior): If debug_infrun, print result of
target_wait.
(fetch_inferior_event): Ditto.
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 75 |
1 files changed, 44 insertions, 31 deletions
diff --git a/gdb/target.c b/gdb/target.c index 78a0a1b..a289e89 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2603,50 +2603,63 @@ debug_to_resume (ptid_t ptid, int step, enum target_signal siggnal) target_signal_to_name (siggnal)); } -static ptid_t -debug_to_wait (ptid_t ptid, struct target_waitstatus *status) -{ - ptid_t retval; +/* Return a pretty printed form of target_waitstatus. + Space for the result is malloc'd, caller must free. */ - retval = debug_target.to_wait (ptid, status); +char * +target_waitstatus_to_string (const struct target_waitstatus *ws) +{ + const char *kind_str = "status->kind = "; - fprintf_unfiltered (gdb_stdlog, - "target_wait (%d, status) = %d, ", PIDGET (ptid), - PIDGET (retval)); - fprintf_unfiltered (gdb_stdlog, "status->kind = "); - switch (status->kind) + switch (ws->kind) { case TARGET_WAITKIND_EXITED: - fprintf_unfiltered (gdb_stdlog, "exited, status = %d\n", - status->value.integer); - break; + return xstrprintf ("%sexited, status = %d", + kind_str, ws->value.integer); case TARGET_WAITKIND_STOPPED: - fprintf_unfiltered (gdb_stdlog, "stopped, signal = %s\n", - target_signal_to_name (status->value.sig)); - break; + return xstrprintf ("%sstopped, signal = %s", + kind_str, target_signal_to_name (ws->value.sig)); case TARGET_WAITKIND_SIGNALLED: - fprintf_unfiltered (gdb_stdlog, "signalled, signal = %s\n", - target_signal_to_name (status->value.sig)); - break; + return xstrprintf ("%ssignalled, signal = %s", + kind_str, target_signal_to_name (ws->value.sig)); case TARGET_WAITKIND_LOADED: - fprintf_unfiltered (gdb_stdlog, "loaded\n"); - break; + return xstrprintf ("%sloaded", kind_str); case TARGET_WAITKIND_FORKED: - fprintf_unfiltered (gdb_stdlog, "forked\n"); - break; + return xstrprintf ("%sforked", kind_str); case TARGET_WAITKIND_VFORKED: - fprintf_unfiltered (gdb_stdlog, "vforked\n"); - break; + return xstrprintf ("%svforked", kind_str); case TARGET_WAITKIND_EXECD: - fprintf_unfiltered (gdb_stdlog, "execd\n"); - break; + return xstrprintf ("%sexecd", kind_str); + case TARGET_WAITKIND_SYSCALL_ENTRY: + return xstrprintf ("%ssyscall-entry", kind_str); + case TARGET_WAITKIND_SYSCALL_RETURN: + return xstrprintf ("%ssyscall-return", kind_str); case TARGET_WAITKIND_SPURIOUS: - fprintf_unfiltered (gdb_stdlog, "spurious\n"); - break; + return xstrprintf ("%sspurious", kind_str); + case TARGET_WAITKIND_IGNORE: + return xstrprintf ("%signore", kind_str); + case TARGET_WAITKIND_NO_HISTORY: + return xstrprintf ("%sno-history", kind_str); default: - fprintf_unfiltered (gdb_stdlog, "unknown???\n"); - break; + return xstrprintf ("%sunknown???", kind_str); } +} + +static ptid_t +debug_to_wait (ptid_t ptid, struct target_waitstatus *status) +{ + ptid_t retval; + char *status_string; + + retval = debug_target.to_wait (ptid, status); + + fprintf_unfiltered (gdb_stdlog, + "target_wait (%d, status) = %d, ", PIDGET (ptid), + PIDGET (retval)); + + status_string = target_waitstatus_to_string (status); + fprintf_unfiltered (gdb_stdlog, "%s\n", status_string); + xfree (status_string); return retval; } |