lin-thread cannot handle thread exit
Michael Snyder
msnyder@cygnus.com
Tue Mar 7 15:27:00 GMT 2000
Mark Kettenis wrote:
>
> Hi Michael,
>
> The thread_db assisted debugging code doesn't handle exiting threads
> properly, at least in combination with glibc 2.1.3. There are at
> least two problems that prevent this from working:
>
> 1. In lin-thread.c:enable_thread_event_reporting(), GDB requests
> TD_DEATH events to be reported, and sets a breakpoint at the
> appropriate location. The problem is that the LinuxThreads
> implementation included with glibc 2.1.3 triggers that breakpoint
> after it has flagged the thread as terminated. As a conseuqence
> when GDB tries to fetch the registers for that thread it doesn't
> succeed, and GDB complains about a breakpoint at location 0x0 that
> it doesn't know of.
>
> 2. If I disable the reporting of TD_DEATH events, things still don't
> work. The problem is that when the thread really exits, a
> TARGET_WAITKIND_EXITED event is reported to GDB in. So the answer to
> the question ``Can I get this event mistakenly from a thread?'' in
> lin-thread.c:thread_db_wait() is ``Yes''. Since the
> TARGET_WAITKIND_EXITED event is passed on to other code in GDB, GDB
> thinks that the entire process has died.
>
> Ignoring those "spurious" TARGET_WAITKIND_EXITED events doesn't help
> since some parts of GDB still think that the thread is still alive
> then.
>
> Looking through the code, it seems that there quite a few "loose
> ends". Is this still "work in progress"?
Hi Mark,
The lin-thread / thread_db module was completed under time
pressure and took much longer to get working than expected;
plus of course it is a brand new native thread "port"
(although I had access to Eric Paire's work as an example).
So no, it isn't formally regarded as a "work in progress",
except in the sense that GDB itself is a work in progress,
but it isn't exactly mature code either.
I appreciate your helping to find problems with it, and
I'd like to know what else in the code you regard as a
"loose end". One of my problems is that I'm not really
an experienced writer of multi-threaded apps -- I'm just
the person on the GDB team with the most experience with
GDB multi-thread debugging.
Thanks,
Michael
More information about the Gdb
mailing list