Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [RFA] new command: maintenance print target-stack
Date: Wed, 24 Jan 2007 01:13:00 -0000	[thread overview]
Message-ID: <20070124011254.GG4667@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1292 bytes --]

Hello,

I proposed the addition of a new maintenance command a few months ago:
    http://www.sourceware.org/ml/gdb-patches/2006-10/msg00204.html

Only a couple of people answered, but both were positive. So I now
more formally propose the inclusion of this patch.

|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.
|

2007-01-24  Joel Brobecker  <brobecker@adacore.com>

        * 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.

OK to apply?

Thanks,
-- 
Joel

[-- Attachment #2: target.c.diff --]
[-- Type: text/plain, Size: 1188 bytes --]

Index: target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.133
diff -u -p -r1.133 target.c
--- target.c	23 Jan 2007 13:03:20 -0000	1.133
+++ target.c	24 Jan 2007 01:10:57 -0000
@@ -2769,6 +2769,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)
 {
@@ -2802,5 +2817,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 ();
 }

             reply	other threads:[~2007-01-24  1:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-24  1:13 Joel Brobecker [this message]
2007-01-24  4:19 ` Eli Zaretskii
2007-01-24 16:19   ` Joel Brobecker
2007-01-24 19:50     ` Eli Zaretskii
2007-01-24 20:03       ` Joel Brobecker
2007-01-24 20:05 ` Daniel Jacobowitz
2007-01-25 23:58   ` Joel Brobecker
2007-01-26  9:36     ` Eli Zaretskii
2007-01-26 22:04       ` Joel Brobecker
2007-01-27 10:33         ` Eli Zaretskii
2007-01-29 16:38           ` Joel Brobecker
2007-01-29 16:38   ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070124011254.GG4667@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox