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;

Attachment: gdb_fix.diff
Description: Binary data

_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to