From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22624 invoked by alias); 30 Jul 2011 11:44:46 -0000 Received: (qmail 22616 invoked by uid 22791); 30 Jul 2011 11:44:46 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from nm3.bt.bullet.mail.ukl.yahoo.com (HELO nm3.bt.bullet.mail.ukl.yahoo.com) (217.146.183.201) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Sat, 30 Jul 2011 11:44:32 +0000 Received: from [217.146.183.196] by nm3.bt.bullet.mail.ukl.yahoo.com with NNFMP; 30 Jul 2011 11:44:30 -0000 Received: from [217.146.183.203] by tm2.bt.bullet.mail.ukl.yahoo.com with NNFMP; 30 Jul 2011 11:44:30 -0000 Received: from [127.0.0.1] by omp1001.bt.mail.ukl.yahoo.com with NNFMP; 30 Jul 2011 11:44:30 -0000 Received: (qmail 43103 invoked by uid 60001); 30 Jul 2011 11:44:30 -0000 Received: from [78.146.81.90] by web86705.mail.ird.yahoo.com via HTTP; Sat, 30 Jul 2011 12:44:30 BST References: <1311947955.89527.YahooMailRC@web86708.mail.ird.yahoo.com> <20110730024405.GJ5177@adacore.com> <201107301231.58274.pedro@codesourcery.com> Message-ID: <1312026270.62521.YahooMailRC@web86705.mail.ird.yahoo.com> Date: Sat, 30 Jul 2011 14:12:00 -0000 From: pfee@talk21.com Subject: Re: Enhancement - show old and new thread info when switching during debugging To: Pedro Alves , gdb-patches@sourceware.org Cc: Joel Brobecker , Tom Tromey In-Reply-To: <201107301231.58274.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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/msg00823.txt.bz2 > > So, I would think that adding something similar in > > thread.c:switch_to_thread would do the job. >=20 > 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. >=20 > - 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 >=20 > If you want a convenience variable, please model it on > $_thread --- see end of thread.c:_initialize_thread. >=20 > Note that the previously selected thread may not exist anymore, > it may have exited meanwhile, for example, or the inferior > exec'ed. >=20 > --=20 > Pedro Alves > Hi Pedro, I agree with your example, the previous_inferior_ptid in infrun.c, normal_s= top()=20 has the information I need. I'll try and use that to populate the new=20 convenience variable. I'll a try to construct a test program that creates a scenario where the=20 previous thread as died by the time normal_stop() executes. Thanks, Paul