This is the mail archive of the gdb-prs@sources.redhat.com 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]

threads/1938: gdb gives incorrect thread numbering and is unstable


>Number:         1938
>Category:       threads
>Synopsis:       gdb gives incorrect thread numbering and is unstable
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue May 03 20:38:00 UTC 2005
>Closed-Date:
>Last-Modified:
>Originator:     Phil Erickson
>Release:        6.1post-1.20040607.62rh
>Organization:
>Environment:
Red Hat Enterprise 4 distribution:

uname -a
Linux XXXX 2.6.9-5.EL #1 Wed Jan 5 19:22:18 EST 2005 i686 i686 i386 GNU/Linux
>Description:
When run on a multithreaded program, gdb gives impossibly large negative thread IDs.  Additionally, debugging the program often results in segfaults and other stack instabilities.
>How-To-Repeat:
Compile the attached program with:

cc -g -o test_threads test_threads.c -lpthread

Run it with:

gdb ./test_threads

The following output is seen (notice the negative thread IDs):

gdb ./test_threads
GNU gdb Red Hat Linux (6.1post-1.20040607.62rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...(no debugging symbols found)...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) run
Starting program: /mnt1/workspace/pje/test_nuwa/prototypes/install/MidaswAnalysisDistribution/midasw_c/test_threads
(no debugging symbols found)...[Thread debugging using libthread_db enabled]
[New Thread -1207966016 (LWP 4600)]
(no debugging symbols found)...(no debugging symbols found)...[New Thread -1207972944 (LWP 4603)]
Launching threads..I am thread 1
[New Thread -1218462800 (LWP 4604)]
Main thread still alive
I am thread 2
I am thread 1
I am thread 2
I am thread 1

Program received signal SIGINT, Interrupt.
[Switching to Thread -1207966016 (LWP 4600)]
0x003c17a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
(gdb) quit
The program is running.  Exit anyway? (y or n) y

>Fix:
None!  (This needs to be fixed since essentially it has broken all ability to debug multithreaded programs)
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test_threads.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test_threads.c"

I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDx0aW1lLmg+CgojaW5jbHVkZSA8cHRocmVhZC5o
PgojaW5jbHVkZSA8c2VtYXBob3JlLmg+Cgp2b2lkICp0aHJlYWQxKCkKewogICAgc3RydWN0IHRp
bWVzcGVjIHRpbWVvdXQgPSB7MS4wLCAwLjB9OwoKICAgIHdoaWxlICgxKSB7CglwcmludGYoIkkg
YW0gdGhyZWFkIDFcbiIpOwoJbmFub3NsZWVwKCZ0aW1lb3V0LCBOVUxMKTsKICAgIH0KfQoKdm9p
ZCAqdGhyZWFkMigpCnsKICAgIHN0cnVjdCB0aW1lc3BlYyB0aW1lb3V0ID0gezIuMCwgMC4wfTsK
CiAgICB3aGlsZSAoMSkgewoJcHJpbnRmKCJJIGFtIHRocmVhZCAyXG4iKTsKCW5hbm9zbGVlcCgm
dGltZW91dCwgTlVMTCk7CiAgICB9Cn0KCmludCBtYWluKCkKewogICAgcHRocmVhZF90IGZpcnN0
X3RocmVhZCwgc2Vjb25kX3RocmVhZDsKICAgIHN0cnVjdCB0aW1lc3BlYyB0aW1lb3V0ID0gezUu
MCwgMC4wfTsKICAgIHB0aHJlYWRfYXR0cl90IHRocl9hdHRyOwoKICAgIHB0aHJlYWRfYXR0cl9p
bml0KCZ0aHJfYXR0cik7CiAgICBwdGhyZWFkX2F0dHJfc2V0ZGV0YWNoc3RhdGUoJnRocl9hdHRy
LCBQVEhSRUFEX0NSRUFURV9ERVRBQ0hFRCk7CgogICAgcHJpbnRmKCJMYXVuY2hpbmcgdGhyZWFk
cy4uIik7CiAgICBwdGhyZWFkX2NyZWF0ZSgmZmlyc3RfdGhyZWFkLCAmdGhyX2F0dHIsIHRocmVh
ZDEsIE5VTEwpOwogICAgcHRocmVhZF9jcmVhdGUoJnNlY29uZF90aHJlYWQsICZ0aHJfYXR0ciwg
dGhyZWFkMiwgTlVMTCk7CiAgICB3aGlsZSAoMSkgewoJcHJpbnRmKCJNYWluIHRocmVhZCBzdGls
bCBhbGl2ZVxuIik7CgluYW5vc2xlZXAoJnRpbWVvdXQsIE5VTEwpOwogICAgfQp9Cg==


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