debug of multithreaded program turns to be impossible during execution

Avi Gozlan <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <71C49BB0B847984EAADFE43F93C6BF083ADA7BE0@DAG-EX10.ad.checkpoint.com>
Hello,

I'm debugging a multithreaded program using GDB. Various threads are created and exit during execution. GDB copes successfully with the multiple threads (e.g. 'thread apply 3 bt' reports successfully backtrace of thread 3), but then at one point loses control of the program:

(gdb) c
Continuing.
[New Thread 0x41401940 (LWP 13370)]
 [Thread 0x40a00940 (LWP 13333) exited]
[New Thread 0x41e02940 (LWP 13371)]
...
[New Thread 0x45a08940 (LWP 13377)]
[New Thread 0x46409940 (LWP 13378)]
 [Thread 0x41e02940 (LWP 13371) exited]
 [Switching to Thread 0x45a08940 (LWP 13377)]
Cannot remove breakpoints because program is no longer writable.
Further execution is probably impossible.
0x00002aaaab98348f in start_thread () from /lib64/libpthread.so.0
ptrace: No such process.

Surprisingly, although debugging is no more possible, the program is not dead:

(gdb) q
A debugging session is active.

        Inferior 1 [process 13296] will be killed.

Quit anyway? (y or n) y
[Thread 0x46409940 (LWP 13378) exited]
[Thread 0x45a08940 (LWP 13377) exited]
...
[Thread 0x2aaaaccbe580 (LWP 13296) exited]

Some details:
GDB version: 7.6
OS: RHEL 5.1 based
GLIBC: glibc-2.5-18
/lib64/libthread-1.0.so is not stripped.

Your assistance will be appreciated.
Thanks,
Avi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.