gdb/2083: gdbserver segfaults: thread getmsg err: no event message for getmsg

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

gdb/2083: gdbserver segfaults: thread getmsg err: no event message for getmsg

chkr (Bugzilla)

>Number:         2083
>Category:       gdb
>Synopsis:       gdbserver segfaults: thread getmsg err: no event message for getmsg
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 16 00:28:01 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     [hidden email]
>Release:        GNU gdb 6.3
>Organization:
>Environment:
Linux: 2.6.13.1, ppc
gcc: (GCC) 3.3.3
gdb: This GDB was configured as "--host=i686-pc-linux-gnu --target=powerpc-vendor-linux-uclibc"
>Description:
When debugging remotely a program with several threads, most times the gdbserver crashes with the following output:

thread getmsg err: no event message for getmsg
Segmentation fault (core dumped)

and the corresponding gdb gets an timeout:
(gdb) c
Continuing.
[New Thread 1024]
Watchdog has expired.  Target detached.

Here are some more information about the problem:
- it seems that it happens only since I changed to the linux 2.6 kernel
- because it works sometimes and sometimes not, I assume a timing critical code path which results in a race condition
- turning on debug in gdbserver seems to help a little bit, but not for big processes with lots of threads
- http://lists.gnu.org/archive/html/bug-gdb/2003-05/msg00042.html describes a similiar probloem
- I've also tried to port the patch from this posting: http://sources.redhat.com/ml/gdb/2005-02/msg00058.html to ppc, it helps a little bit as well, but like the other hack it doesn't solve the problem for big processes with many threads
- I've used a small test program which I found on the gdb mailinglist: http://lists.gnu.org/archive/html/bug-gdb/2001-04/msg00042.html to reproduce the problem


I know that this problem is a little bit tricky, but I'll do all what I can to help you to solve it. So if you need more information to fix the problem or if you have some ideas where I can start looking at the problem feel free to tell me.

Thank you very much,
Christian
>How-To-Repeat:
1. compile the attached file with -lpthread for the ppc platform
2. start it on a ppc platform with the gdbserver
connect with gdb to the remote target
3. "continue"

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="bar.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bar.c"

I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxwdGhyZWFkLmg+CiNpbmNsdWRlIDxzeXMvdHlw
ZXMuaD4KI2luY2x1ZGUgPHNpZ25hbC5oPgojaW5jbHVkZSA8dW5pc3RkLmg+Cgp2b2lkKiBwcmlu
dF9kaWdpdCh2b2lkKiBhcmcpCnsKICAgIGludCBpLGosZGlnaXQ7CiAgICBkaWdpdCA9IChpbnQp
YXJnOwogICAgcHJpbnRmKCJcblBJRFslZF0sVEhSWyVkXTogZGlnaXQ9JWRcbiIsZ2V0cGlkKCks
cHRocmVhZF9zZWxmKCksZGlnaXQpOwoKICAgIGZvciAoaT0wOyBpIDwgMTAwMDAwMDsgaSsrKSB7
CiAgICAgICAgc2xlZXAoMSk7CiAgICAgICAgcHJpbnRmKCIlZCIsZGlnaXQpOwogICAgICAgIGZm
bHVzaChOVUxMKTsKICAgIH0KfQoKcHRocmVhZF90IHRocmlkWzEwXTsKCmludCBtYWluKGludCBh
cmdjLCBjaGFyKiogYXJndikKewogICAgaW50IGk9MDsKICAgIHByaW50ZigiXG5tYWluIHRocmVh
ZDpUSFJbJWRdXG4iLHB0aHJlYWRfc2VsZigpKTsKICAgIHNsZWVwKDMpOwogICAgcHRocmVhZF9j
cmVhdGUoJnRocmlkW2ldLE5VTEwscHJpbnRfZGlnaXQsKHZvaWQgKilpKTsgIGkrKzsKICAgIHB0
aHJlYWRfY3JlYXRlKCZ0aHJpZFtpXSxOVUxMLHByaW50X2RpZ2l0LCh2b2lkICopaSk7ICBpKys7
CiAgICBwdGhyZWFkX2NyZWF0ZSgmdGhyaWRbaV0sTlVMTCxwcmludF9kaWdpdCwodm9pZCAqKWkp
OyAgaSsrOwogICAgcHRocmVhZF9jcmVhdGUoJnRocmlkW2ldLE5VTEwscHJpbnRfZGlnaXQsKHZv
aWQgKilpKTsgI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