Bug 14523 - [MIPS] unexpected signal with gdb target
Summary: [MIPS] unexpected signal with gdb target
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 7.5
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-27 10:29 UTC by Fred_gdb
Modified: 2013-07-01 12:36 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Patch for gdb 7.5 to map signal 128 to GDB_SIGNAL_UNKNOWN (406 bytes, patch)
2012-08-29 21:00 UTC, Maarten ter Huurne
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fred_gdb 2012-08-27 10:29:23 UTC
Hi,

Native gdb on mipsel board crashes at startup with an "unexpected signal" message 
( this issue is not reproduced with gdbserver mipsel . )

Could it be this fix ? I saw a discussion on a patch :

[PATCH] MIPS Linux signals
http://sources.redhat.com/ml/gdb-patches/2012-06/msg00041.html

 is it integrated ? is it a similar issue ?

If so, How can I download this fix ?  ( I am not user friendly of svn / cvs. if you have detail , I am interested  ... )


Best Regards,
Frédéric
Comment 1 eager 2012-08-27 18:02:26 UTC
Patch mentioned only affects debugging core files, not use of gdbserver.
Comment 2 Fred_gdb 2012-08-28 09:46:14 UTC
log error , 


# gdb /usr/bin/my_soft 
GNU gdb (GDB) 7.5.50.20120813
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mipsel-linux-uclibc".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/my_soft ...done.
(gdb) r
Starting program: /usr/bin/my_soft 
GDB bug: target.c (gdb_signal_from_host): unrecognized real-time signal





This is not reproduced on gdb target 7.3 

It seems in gdb/common/signals.c , 
there was some code removed flagged in #ifndef GDBSERVER
Comment 3 Maarten ter Huurne 2012-08-29 20:58:18 UTC
The problem was introduced between 7.3 and 7.4, to be exact in commit 7ade46b0 in the official git mirror, a change set by Ulrich Weigand committed on Wed Apr 27 13:29:11 2011 +0000.

On some platforms, such as Linux MIPS, NSIG is 128 and SIGRTMAX is also 128. However, there is no GDB_SIGNAL_REALTIME_128 constant, so target signal 128 is considered a real-time signal but not mappable to a GDB signal, which triggers the error condition in gdb_signal_from_host() in gdb/common/signals.c.

I worked around the problem by mapping signal 128 to GDB_SIGNAL_UNKNOWN. See attached patch. I don't know if this can be considered a solution or whether introducing GDB_SIGNAL_REALTIME_128 would be preferred instead.
Comment 4 Maarten ter Huurne 2012-08-29 21:00:53 UTC
Created attachment 6621 [details]
Patch for gdb 7.5 to map signal 128 to GDB_SIGNAL_UNKNOWN
Comment 5 Fred_gdb 2012-09-04 07:56:52 UTC
Perfect !

That's exactly fix my issue.

Thanks
Comment 6 James Hogan 2013-06-28 22:09:54 UTC
The following commit in uClibc:

http://git.uclibc.org/uClibc/commit/?id=2da958760f798224065508431787e3a83b7fe2ae

Should prevent this problem from occurring after gdb is rebuilt against it. uClibc now matches glibc in defining __SIGRTMAX=127 instead of 128.

Of course whether gdb should still understand SIG128 is a different question (since SIG128 has existed until now).

Cheers
James
Comment 7 Sergio Durigan Junior 2013-07-01 12:29:43 UTC
The following patch is being discussed in the Linux kernel.

<http://www.mail-archive.com/stable@vger.kernel.org/msg45489.html>

It is related to this issue.
Comment 8 Sergio Durigan Junior 2013-07-01 12:36:29 UTC
For the record, I have submitted a patch series which touches this code, and will likely cause the bug to reappear.  The link to the specific MIPS patch is:

<http://sourceware.org/ml/gdb-patches/2013-07/msg00014.html>

I was strongly considering incrementing GDB's internal signal representation to accommodate the 128th realtime signal, and after reading this bug my willingness became stronger.  I will keep posting updates to this bug as I discuss the matter with the community.