This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC/PATCH] Add new internal variable $_signo
- From: Pedro Alves <palves at redhat dot com>
- To: Sergio Durigan Junior <sergiodj at redhat dot com>
- Cc: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>, "'GDB Patches'" <gdb-patches at sourceware dot org>
- Date: Fri, 14 Jun 2013 21:21:44 +0100
- Subject: Re: [RFC/PATCH] Add new internal variable $_signo
- References: <m3obb9y1aw dot fsf at redhat dot com> <002801ce68dd$845cd2e0$8d1678a0$ at muller@ics-cnrs.unistra.fr> <m3zjuswp4k dot fsf at redhat dot com>
On 06/14/2013 06:58 PM, Sergio Durigan Junior wrote:
> Hi Pierre,
>
> Thanks for the review.
>
> On Friday, June 14 2013, Pierre Muller wrote:
>
>> Is it that I didn't understand the patch correctly or
>> do you use the GDB signal number in infrun.c
>> while you use the native signal integer value in the
>> corelow.c case?
>
> Yes, you are right.
>
>> Aren't those two values sometimes different?
>
> They probably are in some cases.
>
>> Wouldn't it be more consistent to only use the GDB internal number?
>
> Hm, now that you raised the question, I am wondering. I believe it is
> more consistent to use the GDB internal number when we are printing
> something, yeah.
>
> However, in the $_signo case, we are actually displaying the number
> itself, so your comment applies to my patch, but backwards: I should
> actually be converting the GDB internal number to the actual signal
> number on infrun.c.
>
>> In fact, this "inconsistency" is not specific to your patch,
>> the siggy from corelow.c is printed out, while other signals are always
>> first converted to GDB enum values before being printed (and apparently not
>> in
>> integer form but using the gdb_signal_to_name function.
>>
>> Shouldn't we use gdb_signal_to_name (sig) in core_open
>> and set $_signo also to sig?
>
> I don't think $_signo should be set to "sig", it should remain "siggy".
> What should happen (IIUC everything) is that the infrun.c uses should be
> converted to the actual signal number (by using gdb_signal_to_host).
gdb_signal_to_host is the fallback (and having a fallback is sort of a
hack). The right signal number is the target's not the host's. We
have gdbarch_gdb_signal_from_target for the opposite direction, but not
gdbarch_gdb_signal_to_target... Having to bake the target OS's signal
numbers into GDB is a bit unfortunate, though we could get around it
at some point if we wanted by extending the RSP, and/or adding a python
hook.
--
Pedro Alves