This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] infrun debug output: Print the random signal's enum name in debug output in addition to its number.
- From: Sergio Durigan Junior <sergiodj at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 21 Oct 2013 18:21:56 -0200
- Subject: Re: [PATCH] infrun debug output: Print the random signal's enum name in debug output in addition to its number.
- Authentication-results: sourceware.org; auth=none
- References: <1382383217-2635-1-git-send-email-palves at redhat dot com>
On Monday, October 21 2013, Pedro Alves wrote:
> The other day while debugging something related to random signals, I
> got confused with "set debug infrun 1" output, for it said:
>
> infrun: TARGET_WAITKIND_STOPPED
> infrun: stop_pc = 0x323d4e8b94
> infrun: random signal 20
>
> On GNU/Linux, 20 is SIGTSTP. For some reason, it took me a few
> minutes to realize that 20 is actually a GDB signal number, not a
> target signal number (duh!). In any case, I propose making GDB's
> output clearer here:
>
> One way would be to use gdb_signal_to_name, like already used
> elsewhere:
>
> infrun: TARGET_WAITKIND_STOPPED
> infrun: stop_pc = 0x323d4e8b94
> infrun: random signal SIGCHLD (20)
>
> but I think that'd confuse me too. So I thought of printing the enum
> string instead:
>
> infrun: TARGET_WAITKIND_STOPPED
> infrun: stop_pc = 0x323d4e8b94
> infrun: random signal GDB_SIGNAL_CHLD (20)
I like that approach.
> Suprisingly (to me), there's no method to get a string version of the
> enum symbol, so this adds one.
Just a comment, but WDYT of also printing the target signal number? It
may not be so straightforward to convert between both, and knowing the
target's representation may help in some situations.
Otherwise, looks good to me. Thanks!
--
Sergio