This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] infrun debug output: Print the random signal's enum name in debug output in addition to its number.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]