This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] * linux-low.c (linux_wait_for_process): Don't clobber current_inferior
- From: dje at google dot com (Doug Evans)
- To: gdb-patches at sourceware dot org
- Date: Fri, 12 Dec 2008 12:07:10 -0800 (PST)
- Subject: [RFA] * linux-low.c (linux_wait_for_process): Don't clobber current_inferior
Hi.
linux-low.c:linux_wait_for_process has this:
if (debug_threads
&& WIFSTOPPED (*wstatp))
{
current_inferior = (struct thread_info *)
find_inferior_id (&all_threads, (*childp)->lwpid);
/* For testing only; i386_stop_pc prints out a diagnostic. */
if (the_low_target.get_pc != NULL)
get_stop_pc ();
}
Clobbering current_inferior in a debugging printf is asking for trouble.
[If current_inferior is supposed to be changed here, let's move it
outside the test for debug_threads.]
Ok to check in?
2008-12-12 Doug Evans <dje@google.com>
* linux-low.c (linux_wait_for_process): Don't clobber current_inferior
in debugging printf.
Index: linux-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v
retrieving revision 1.82
diff -u -p -r1.82 linux-low.c
--- linux-low.c 2 Dec 2008 07:57:37 -0000 1.82
+++ linux-low.c 12 Dec 2008 20:03:34 -0000
@@ -643,11 +642,13 @@ retry:
if (debug_threads
&& WIFSTOPPED (*wstatp))
{
+ struct thread_info *saved_inferior = current_inferior;
current_inferior = (struct thread_info *)
find_inferior_id (&all_threads, (*childp)->lwpid);
/* For testing only; i386_stop_pc prints out a diagnostic. */
if (the_low_target.get_pc != NULL)
get_stop_pc ();
+ current_inferior = saved_inferior;
}
}