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] MIPS Linux signals


On 06/01/2012 10:07 PM, Michael Eager wrote:

>>> #if defined (REALTIME_LO)
>>
>>   Is this #ifdef needed?  How about you rewrite this block using
>> MIPS-specific definitions (MIPS_SIGRTMIN, etc.)?  Please avoid hardcoded
>> magic numbers too -- e.g. what are the magic values 32 and 33 below and
>> how do they correlate to MIPS_SIGRTMIN, etc.?  I can't get it from the
>> change below.  Should they be made relative to MIPS_SIGRTMIN perhaps?
>> Are the values GDB_SIGNAL_REALTIME_* expand to not in order?
> 
> This code is copied from signals.c.  I don't really want to re-design
> the logic since I don't have a straight-forward way to test the code.
> 
> I'll recast this in terms of MIPS_SIGRTMIN, but all of your questions
> can be addressed to the code in signals.c.  I didn't find it clear, either.


The whole point of gdb_signal_from_target is to be host independent.
common/signals.c is all about host signal mapping.  REALTIME_LO
is either defined in the native header files in gdb/config/ (the nm-*.h
files), or, if not defined there, common/signals.c does:

#ifndef REALTIME_LO
# if defined(__SIGRTMIN)
#  define REALTIME_LO __SIGRTMIN
#  define REALTIME_HI (__SIGRTMAX + 1)
# elif defined(SIGRTMIN)
#  define REALTIME_LO SIGRTMIN
#  define REALTIME_HI (SIGRTMAX + 1)
# endif
#endif

So that '#if defined (REALTIME_LO)' is really wrong for the gdbarch hook.

The only nm header that defines REALTIME_LO presently,
making the config/signals.c #ifndef be bypassed, is config/nm-nto.h:

 /* Setup the valid realtime signal range.  */
 #define REALTIME_LO 41
 #define REALTIME_HI 56

So only when you build GDB hosted for QNX NTO would you see that
new REALTIME_LO block in the mips tdep file be compiled...  On all
other hosts, including native GNU/Linux MIPS, you'd miss the
conversions for all the realtime signals.

I'm doing adding a few more comments to the gdbarch hook, plus doing
a code change (that doesn't affect your patch) that hopefully makes
things a bit clearer.

-- 
Pedro Alves


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