From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26457 invoked by alias); 21 Sep 2011 15:39:30 -0000 Received: (qmail 26207 invoked by uid 22791); 21 Sep 2011 15:39:26 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 21 Sep 2011 15:39:12 +0000 Received: from nat-jpt.mentorg.com ([192.94.33.2] helo=PR1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1R6OtD-0000d3-9u from Yao_Qi@mentor.com ; Wed, 21 Sep 2011 08:39:11 -0700 Received: from [172.30.38.254] ([172.30.38.254]) by PR1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 22 Sep 2011 00:39:09 +0900 Message-ID: <4E7A051A.3050801@codesourcery.com> Date: Wed, 21 Sep 2011 15:39:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2 MIME-Version: 1.0 To: Pedro Alves CC: gdb@sourceware.org, Marc Khouzam Subject: Re: Displaced stepping not always working as expected References: <1316585323.4150.25.camel@yaolp> <201109211123.11622.pedro@codesourcery.com> In-Reply-To: <201109211123.11622.pedro@codesourcery.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-09/txt/msg00081.txt.bz2 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));