Patch for PR ports/157342: devel/gdb (Invalid selected thread)
Lee Thomas
lthomas_lists at lthomas.net
Tue Nov 1 23:18:01 UTC 2011
Hello, everyone.
I believe the following (and attached) patch to devel/gdb fixes PR
ports/157342: "devel/gdb: Problem with running simple pthreads program
under gdb-7.2 (Invalid selected thread)"
It works for me for the gdb from ports (7.3.1) on FreeBSD 9.0-RC1
amd64, but I don't have any other machines to test it on. Could someone
please A) review this patch, B) test it, and/or C) tell me who to send
it to / what the correct procedure is for getting it reviewed and/or
applied? Thank you for your help.
Regards,
Lee Thomas
--- /freebsd_ports/devel/gdb/files/fbsd-threads.c 2011-10-29
13:04:09.000000000 -0400
+++ /gdb_threads_fix/devel/gdb/files/fbsd-threads.c 2011-10-29
16:53:16.000000000 -0400
@@ -733,11 +733,15 @@
if (ourstatus->value.sig == TARGET_SIGNAL_TRAP)
check_event(ret);
/* this is a hack, if an event won't cause gdb to stop, for
example,
- SIGARLM, gdb resumes the process immediatly without setting
+ SIGALRM, gdb resumes the process immediatly without setting
inferior_ptid to the new thread returned here, this is a bug
because inferior_ptid may already not exist there, and
passing
- a none existing thread to fbsd_thread_resume causes error. */
- if (!fbsd_thread_alive (ops, inferior_ptid))
+ a non-existing thread to fbsd_thread_resume causes error.
However,
+ if the exiting thread is the currently selected thread,
+ then that is handled later in handle_inferior_event(), and we
must
+ not delete the currently selected thread.
+ */
+ if (!fbsd_thread_alive (ops, inferior_ptid) &&
!ptid_equal(inferior_ptid, ret))
{
delete_thread (inferior_ptid);
inferior_ptid = ret;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdb_fix.diff
Type: application/octet-stream
Size: 1216 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20111101/16d9f52a/gdb_fix.obj
More information about the freebsd-hackers
mailing list