Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb@sourceware.org, Marc Khouzam <marc.khouzam@ericsson.com>
Subject: Re: Displaced stepping not always working as expected
Date: Wed, 21 Sep 2011 15:39:00 -0000	[thread overview]
Message-ID: <4E7A051A.3050801@codesourcery.com> (raw)
In-Reply-To: <201109211123.11622.pedro@codesourcery.com>

On 09/21/2011 06:23 PM, Pedro Alves wrote:
> On Wednesday 21 September 2011 07:08:43, Yao Qi wrote:
>> The line of log looks strange to me.  Why LWP 763 switch to itself?
> 
> This is non-stop mode, and fetch_inferior_event always prints the
> "context switch":
> 
>   if (non_stop
>       && ecs->ws.kind != TARGET_WAITKIND_IGNORE
>       && ecs->ws.kind != TARGET_WAITKIND_EXITED
>       && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED)
>     /* In non-stop mode, each thread is handled individually.  Switch
>        early, so the global state is set correctly for this
>        thread.  */
>     context_switch (ecs->ptid);
> 

Pedro,
I don't quite understand this piece of code and the comments here, but I
think that debug log "context switch from Thread A to Thread A" is not
useful, if not confusing.  How about this patch?

-- 
Yao (齐尧) 

	gdb/
	* infrun.c (context_switch): Print debug message when switching to
	a different thread.

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 9a2de5c..225034c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2852,7 +2852,7 @@ nullify_last_target_wait_ptid (void)
 static void
 context_switch (ptid_t ptid)
 {
-  if (debug_infrun)
+  if (debug_infrun && !ptid_equal (ptid, inferior_ptid))
     {
       fprintf_unfiltered (gdb_stdlog, "infrun: Switching context from %s ",
 			  target_pid_to_str (inferior_ptid));


  reply	other threads:[~2011-09-21 15:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-20 19:54 Marc Khouzam
2011-09-21  6:09 ` Yao Qi
2011-09-21 10:23   ` Pedro Alves
2011-09-21 15:39     ` Yao Qi [this message]
2011-09-21 15:44       ` Pedro Alves
2011-09-21 10:20 ` Pedro Alves
2011-09-21 20:46   ` Marc Khouzam

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=4E7A051A.3050801@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb@sourceware.org \
    --cc=marc.khouzam@ericsson.com \
    --cc=pedro@codesourcery.com \
    /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