From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22687 invoked by alias); 29 Jul 2011 16:33:44 -0000 Received: (qmail 22675 invoked by uid 22791); 29 Jul 2011 16:33:43 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from nm2-vm1.bt.bullet.mail.ird.yahoo.com (HELO nm2-vm1.bt.bullet.mail.ird.yahoo.com) (212.82.108.89) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Fri, 29 Jul 2011 16:33:27 +0000 Received: from [212.82.108.231] by nm2.bt.bullet.mail.ird.yahoo.com with NNFMP; 29 Jul 2011 16:33:25 -0000 Received: from [212.82.108.225] by tm4.bt.bullet.mail.ird.yahoo.com with NNFMP; 29 Jul 2011 16:33:25 -0000 Received: from [127.0.0.1] by omp1002.bt.mail.ird.yahoo.com with NNFMP; 29 Jul 2011 16:33:25 -0000 Received: (qmail 71937 invoked by uid 60001); 29 Jul 2011 16:33:25 -0000 Received: from [94.72.254.2] by web86707.mail.ird.yahoo.com via HTTP; Fri, 29 Jul 2011 17:33:25 BST References: <1311947955.89527.YahooMailRC@web86708.mail.ird.yahoo.com> <20110729155438.GH5177@adacore.com> <1311955683.74296.YahooMailRC@web86704.mail.ird.yahoo.com> <20110729161711.GI5177@adacore.com> Message-ID: <1311957205.11694.YahooMailRC@web86707.mail.ird.yahoo.com> Date: Fri, 29 Jul 2011 17:47:00 -0000 From: pfee@talk21.com Subject: Re: Enhancement - show old and new thread info when switching during debugging To: Joel Brobecker Cc: gdb-patches@sourceware.org In-Reply-To: <20110729161711.GI5177@adacore.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/msg00813.txt.bz2 > > I've copied output from GDB 7.3 before and after my patch into the bug > > report along with some notes on the implementation. >=20 > I think I understand what you are trying to say. What I am saying is > that you can find which thread you switched from, by going up the > debugger output until you find a "[Switching to Thread ...]" message. > So, the information is already there. I agree it's not ultra convenient, > but I personally think it's better than your approach (the new message > becomes way to long, IMO). >=20 > In your case, if going up the output is not good enough, I would > suggest two alternative solutions, in order of preference: > - Have GDB maintain variable $old_thread or $prev_thread that > you can then use to switch to the previous thread; >=20 > (gdb) thread $old_thread >=20 > would return you to the previous thread before the switch. > - At least print the new thread ID first; Ah, I see your point now also. The previous "Switching to" message may be lost if the terminal output buff= er=20 isn't long enough. I like your idea of being able to use a "thread $prev_thread" command. Tha= t's=20 better than my patch as I have printed out the hex target thread ID and dec= imal=20 LWP numbers but not the GDB thread ID. It's the GDB thread ID that used wit= h the=20 "thread" command. Hence even with my patch, the user would still have to i= ssue=20 "info threads", then match the LWP (or target ID) against GDB's ID. However I don't currently know how to interact with GDB convenience variabl= es.=20=20 You second suggestion is to reorder the output e.g. [Switching to Thread 0x7ffff7fd67000 (LWP 4282) from Thread 0x7ffff7fd8740 = (LWP=20 4279)] That would be simple to do. Would you recommend adjusting the printf state= ment=20 or learning how to create a new convenience variable? Thanks, Paul