From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2938 invoked by alias); 29 Jul 2011 20:36:33 -0000 Received: (qmail 2809 invoked by uid 22791); 29 Jul 2011 20:36:32 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mailrelay010.isp.belgacom.be (HELO mailrelay010.isp.belgacom.be) (195.238.6.177) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 29 Jul 2011 20:36:17 +0000 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkACAEgXM05tgN0d/2dsb2JhbAAMKAEBBSkEWBEMGAICMgICFFEehFeUC8dLkRGBK4QGgRAEo18 Received: from 29.221-128-109.adsl-dyn.isp.belgacom.be (HELO [192.168.2.3]) ([109.128.221.29]) by relay.skynet.be with ESMTP; 29 Jul 2011 22:36:16 +0200 Subject: Re: Enhancement - show old and new thread info when switching during debugging From: Philippe Waroquiers To: pfee@talk21.com Cc: Joel Brobecker , gdb-patches@sourceware.org In-Reply-To: <1311957205.11694.YahooMailRC@web86707.mail.ird.yahoo.com> 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> <1311957205.11694.YahooMailRC@web86707.mail.ird.yahoo.com> Content-Type: text/plain; charset="UTF-8" Date: Fri, 29 Jul 2011 20:40:00 -0000 Message-ID: <1311971792.2199.14.camel@soleil> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit 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/msg00817.txt.bz2 On Fri, 2011-07-29 at 17:33 +0100, pfee@talk21.com wrote: > [Switching to Thread 0x7ffff7fd67000 (LWP 4282) from Thread 0x7ffff7fd8740 (LWP > 4279)] An alternative is to add a hook: (gdb) define hook-thread Type commands for definition of "hook-thread". End with a line saying just "end". >thread >end (gdb) info thre 2 Thread 0xb7fe3b70 (LWP 2321) 0x0070c416 in __kernel_vsyscall () * 1 Thread 0xb7fe46c0 (LWP 2318) main (argc=1, argv=0xbffff244) at sleepers.c:169 (gdb) thre 2 [Current thread is 1 (Thread 0xb7fe46c0 (LWP 2318))] [Switching to thread 2 (Thread 0xb7fe3b70 (LWP 2321))]#0 0x0070c416 in __kernel_vsyscall () (gdb) It would have been nice to do if $argc >= 1 thread end so that the thread command without arg would not output twice the current thread. It is not clear to me why the command hook does not get the command arguments. execute_cmd_pre_hook calls execute_user_command (c->hook_pre, (char *) 0); If execute_command calls first execute_cmd_pre_hook (c); then execute_user_command (c, arg); So, I suppose that by adding one argument to execute_cmd_pre_hook, the hook could pass arg to execute_user_command. (same for the post hook). If that looks a good idea, it might become my 3rd gdb patch :). Philippe