cannot debug multi-threaded programs with gdb
Hi,
I've been trying to debug a simple multi-threaded test program using gdb, and it always fails as follows:
[New Thread 1024 (LWP
39)]
Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 1024 (LWP
39)]
warning: Warning: GDB can't find the start of the function at 0xffffffff.
I've tried various different compilers, gdb, glibc version but the problem is the same. Note that I can debug non-threaded c/c++ programs without any problem. My environment is as follows:
CPU: NEC VR5432
kernel: linux-2.4.10 + patches
glibc: 2.2.3 + patches
gdb: 5.2/3 from CVS
gcc: 3.1 (also tried 3.0.1)
binutils: Version 2.11.90.0.25
Does anyone have any idea what is wrong and how to fix it.
Regards, Stuart
Quoted 15 lines · Stuart Hughes
Hi,
I've been trying to debug a simple multi-threaded test program using gdb, and it always fails as follows:
[New Thread 1024 (LWP
39)]Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 1024 (LWP
39)]
warning: Warning: GDB can't find the start of the function at0xffffffff.
Quoted 7 lines
I've tried various different compilers, gdb, glibc version but the problem is the same. Note that I can debug non-threaded c/c++ programs without any problem. My environment is as follows:
CPU: NEC VR5432
kernel: linux-2.4.10 + patches
glibc: 2.2.3 + patches
Not enough patches I'd bet. Glibc 2.2.3 had an incorrect size listed for elf_gregset_t, and it was fixed in 2.2.5. That would cause this problem.
Quoted 9 lines
gdb: 5.2/3 from CVS
gcc: 3.1 (also tried 3.0.1)
binutils: Version 2.11.90.0.25Does anyone have any idea what is wrong and how to fix it.
Regards, Stuart
Signature · 2 lines
Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer
Hi Daniel,
Thanks for your help. I also just found a posting by you from January explaining this. I tried it out, and it works like a dream. FWIW I've attached a patch I applied to glibc.
Regards, Stuart
Quoted 35 lines · Daniel Jacobowitz
Quoted 15 lines · Stuart Hughes
Hi,
I've been trying to debug a simple multi-threaded test program using gdb, and it always fails as follows:
[New Thread 1024 (LWP
39)]Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 1024 (LWP
39)]
warning: Warning: GDB can't find the start of the function at0xffffffff.Quoted 7 lines
I've tried various different compilers, gdb, glibc version but the problem is the same. Note that I can debug non-threaded c/c++ programs without any problem. My environment is as follows:
CPU: NEC VR5432 kernel: linux-2.4.10 + patches glibc: 2.2.3 + patchesNot enough patches I'd bet. Glibc 2.2.3 had an incorrect size listed for
elf_gregset_t, and it was fixed in 2.2.5. That would cause this problem.Quoted 6 lines
gdb: 5.2/3 from CVS gcc: 3.1 (also tried 3.0.1) binutils: Version 2.11.90.0.25Does anyone have any idea what is wrong and how to fix it.
Quoted 7 lines
Quoted 3 lines
Regards, Stuart
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
sysdeps/unix/sysv/linux/mips/sys/procfs.h renamed from sysdeps/unix/sysv/linux/mips/sys/procfs.h.orig +2 -2
@@ -101,8 +101,8 @@typedef void *psaddr_t ;/* Register sets. Linux has different names. */ -typedef gregset_t prgregset_t ; -typedef fpregset_t prfpregset_t ; +typedef elf_gregset_t prgregset_t ; +typedef elf_fpregset_t prfpregset_t ;/* We don't have any differences between processes and threads, therefore habe only ine PID type. */