Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org
Subject: [RFA] * linux-low.c (linux_wait_for_process): Don't clobber current_inferior
Date: Fri, 12 Dec 2008 20:07:00 -0000	[thread overview]
Message-ID: <20081212200710.51E071C7A0E@localhost> (raw)

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;
     }
 }
 


             reply	other threads:[~2008-12-12 20:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-12 20:07 Doug Evans [this message]
2008-12-12 20:47 ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081212200710.51E071C7A0E@localhost \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox