From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22406 invoked by alias); 17 Oct 2006 22:52:52 -0000 Received: (qmail 22398 invoked by uid 22791); 17 Oct 2006 22:52:52 -0000 X-Spam-Check-By: sourceware.org Received: from nile.gnat.com (HELO nile.gnat.com) (205.232.38.5) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 17 Oct 2006 22:52:49 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-nile.gnat.com (Postfix) with ESMTP id F3B7248CE2C for ; Tue, 17 Oct 2006 18:52:47 -0400 (EDT) Received: from nile.gnat.com ([127.0.0.1]) by localhost (nile.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17917-01-2 for ; Tue, 17 Oct 2006 18:52:47 -0400 (EDT) Received: from takamaka.act-europe.fr (joel.gnat.com [205.232.38.116]) by nile.gnat.com (Postfix) with ESMTP id C393A48CD91 for ; Tue, 17 Oct 2006 18:52:47 -0400 (EDT) Received: by takamaka.act-europe.fr (Postfix, from userid 507) id B184E47F01; Tue, 17 Oct 2006 18:52:47 -0400 (EDT) Date: Tue, 17 Oct 2006 22:52:00 -0000 From: Joel Brobecker To: gdb-patches@sources.redhat.com Subject: [RFC/RFA] new command: maintenance print target-stack Message-ID: <20061017225247.GQ1903@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="XMCwj5IQnwKtuyBG" Content-Disposition: inline User-Agent: Mutt/1.4i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00204.txt.bz2 --XMCwj5IQnwKtuyBG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 996 Hello, While working to "auto-solib-add", I found that I was very frequently in need to dumping the current target stack (I just need the names), to see if the multi-thread layer has been pushed or not. So I implemented a new "maintenance" command, hoping that others might find it useful. (gdb) maintenance print target-stack The current target stack is: - multi-thread (multi-threaded child process.) - child (Unix child process) - exec (Local exec file) - None (None) Opinions? Eventually, we might want to actually dump more information if that's useful to others, but that's a start. 2006-10-17 Joel Brobecker * target.c (maintenance_print_target_stack): New function. (initialize_targets): Add new "maintenance print target-stack" command. Tested on x86-linux just to make sure, no regression. I will of course provide documentation for this if the idea is accepted. -- Joel --XMCwj5IQnwKtuyBG Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="target.c.diff" Content-length: 1188 Index: target.c =================================================================== RCS file: /cvs/src/src/gdb/target.c,v retrieving revision 1.127 diff -u -p -r1.127 target.c --- target.c 10 Oct 2006 03:17:53 -0000 1.127 +++ target.c 17 Oct 2006 22:41:16 -0000 @@ -2689,6 +2689,21 @@ do_monitor_command (char *cmd, target_rcmd (cmd, gdb_stdtarg); } +/* Print the name of each layers of our target stack. */ + +static void +maintenance_print_target_stack (char *cmd, int from_tty) +{ + struct target_ops *t; + + printf_filtered (_("The current target stack is:\n")); + + for (t = target_stack; t != NULL; t = t->beneath) + { + printf_filtered (" - %s (%s)\n", t->to_shortname, t->to_longname); + } +} + void initialize_targets (void) { @@ -2722,5 +2737,9 @@ result in significant performance improv add_com ("monitor", class_obscure, do_monitor_command, _("Send a command to the remote monitor (remote targets only).")); + add_cmd ("target-stack", class_maintenance, maintenance_print_target_stack, + _("Print the name of each layer of the internal target stack."), + &maintenanceprintlist); + target_dcache = dcache_init (); } --XMCwj5IQnwKtuyBG--