+2013-10-23 Pedro Alves <palves@redhat.com>
+
+ * common/gdb_signals.h (gdb_signal_to_symbol_string): Declare.
+ * common/signals.c: Include "gdb_assert.h".
+ (signals): New field 'symbol'.
+ (SET): Use the 'symbol' parameter.
+ (gdb_signal_to_symbol_string): New function.
+ * infrun.c (handle_inferior_event) <random signal>: In debug
+ output, print the random signal enum as string in addition to its
+ number.
+ * target/waitstatus.c (target_waitstatus_to_string): Print the
+ signal's enum value as string instead of the (POSIX) signal name.
+
2013-10-23 Gary Benson <gbenson@redhat.com>
PR 16013
extern enum gdb_signal gdb_signal_from_host (int);
extern int gdb_signal_to_host (enum gdb_signal);
+/* Return the enum symbol name of SIG as a string, to use in debug
+ output. */
+extern const char *gdb_signal_to_symbol_string (enum gdb_signal sig);
+
/* Return the string for a signal. */
extern const char *gdb_signal_to_string (enum gdb_signal);
#endif
#include "gdb_signals.h"
+#include "gdb_assert.h"
struct gdbarch;
gdb_signal. */
static const struct {
+ const char *symbol;
const char *name;
const char *string;
} signals [] =
{
-#define SET(symbol, constant, name, string) { name, string },
+#define SET(symbol, constant, name, string) { #symbol, name, string },
#include "gdb/signals.def"
#undef SET
};
+const char *
+gdb_signal_to_symbol_string (enum gdb_signal sig)
+{
+ gdb_assert ((int) sig >= GDB_SIGNAL_FIRST && (int) sig <= GDB_SIGNAL_LAST);
+
+ return signals[sig].symbol;
+}
/* Return the string for a signal. */
const char *
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
- "infrun: resume (step=%d, signal=%d), "
+ "infrun: resume (step=%d, signal=%s), "
"trap_expected=%d, current thread [%s] at %s\n",
- step, sig, tp->control.trap_expected,
+ step, gdb_signal_to_symbol_string (sig),
+ tp->control.trap_expected,
target_pid_to_str (inferior_ptid),
paddress (gdbarch, pc));
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
- "infrun: proceed (addr=%s, signal=%d, step=%d)\n",
- paddress (gdbarch, addr), siggnal, step);
+ "infrun: proceed (addr=%s, signal=%s, step=%d)\n",
+ paddress (gdbarch, addr),
+ gdb_signal_to_symbol_string (siggnal), step);
if (non_stop)
/* In non-stop, each thread is handled individually. The context
/* Signal not for debugging purposes. */
int printed = 0;
struct inferior *inf = find_inferior_pid (ptid_get_pid (ecs->ptid));
+ enum gdb_signal stop_signal = ecs->event_thread->suspend.stop_signal;
if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: random signal %d\n",
- ecs->event_thread->suspend.stop_signal);
+ fprintf_unfiltered (gdb_stdlog, "infrun: random signal (%s)\n",
+ gdb_signal_to_symbol_string (stop_signal));
stopped_by_random_signal = 1;
kind_str, ws->value.integer);
case TARGET_WAITKIND_STOPPED:
return xstrprintf ("%sstopped, signal = %s",
- kind_str, gdb_signal_to_name (ws->value.sig));
+ kind_str,
+ gdb_signal_to_symbol_string (ws->value.sig));
case TARGET_WAITKIND_SIGNALLED:
return xstrprintf ("%ssignalled, signal = %s",
- kind_str, gdb_signal_to_name (ws->value.sig));
+ kind_str,
+ gdb_signal_to_symbol_string (ws->value.sig));
case TARGET_WAITKIND_LOADED:
return xstrprintf ("%sloaded", kind_str);
case TARGET_WAITKIND_FORKED: