From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30323 invoked by alias); 30 Jul 2011 11:32:17 -0000 Received: (qmail 30315 invoked by uid 22791); 30 Jul 2011 11:32:16 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 30 Jul 2011 11:32:01 +0000 Received: (qmail 25376 invoked from network); 30 Jul 2011 11:32:00 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 30 Jul 2011 11:32:00 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: Enhancement - show old and new thread info when switching during debugging Date: Sat, 30 Jul 2011 11:44:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-8-generic; KDE/4.6.2; x86_64; ; ) Cc: Joel Brobecker , Tom Tromey , pfee@talk21.com References: <1311947955.89527.YahooMailRC@web86708.mail.ird.yahoo.com> <20110730024405.GJ5177@adacore.com> In-Reply-To: <20110730024405.GJ5177@adacore.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201107301231.58274.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-07/txt/msg00821.txt.bz2 On Saturday 30 July 2011 03:44:05, Joel Brobecker wrote: > So, I would think that adding something similar in > thread.c:switch_to_thread would do the job. It wouldn't. What he wants is the last user selected thread, not the thread that happens to be current when switch_to_thread is called. - user resumes with thread 1 selected - thread 2 hits breakpoint, gdb switches to thread 2 - breakpoint doesn't cause stop, target is re-resumed - thread 3 hits breakpoint, gdb switches to thread 3 - breakpoint causes stop, previous_inferior_ptid is thread 1, but the last switch_to_thread would have recorded $previous_thread as thread 2 If you want a convenience variable, please model it on $_thread --- see end of thread.c:_initialize_thread. Note that the previously selected thread may not exist anymore, it may have exited meanwhile, for example, or the inferior exec'ed. -- Pedro Alves