Date: Tue, 01 Nov 2011 17:18:00 -0600 From: Lee Thomas <lthomas_lists@lthomas.net> To: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Patch for PR ports/157342: devel/gdb (Invalid selected thread) Message-ID: <e31576421723bbaed849e37d75d4f2e9@lthomas.net>
index | next in thread | raw e-mail
[-- Attachment #1 --]
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 #2 --]
--- /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;
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e31576421723bbaed849e37d75d4f2e9>
