Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC/RFA] new command: maintenance print target-stack
@ 2006-10-17 22:52 Joel Brobecker
  2006-10-20 17:01 ` Kevin Buettner
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2006-10-17 22:52 UTC (permalink / raw)
  To: gdb-patches

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

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

-- 
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.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 ();
 }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC/RFA] new command: maintenance print target-stack
  2006-10-17 22:52 [RFC/RFA] new command: maintenance print target-stack Joel Brobecker
@ 2006-10-20 17:01 ` Kevin Buettner
  2006-10-22 20:03   ` Mark Kettenis
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2006-10-20 17:01 UTC (permalink / raw)
  To: gdb-patches

On Tue, 17 Oct 2006 18:52:47 -0400
Joel Brobecker <brobecker@adacore.com> wrote:

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

As a developer, I know that I'd find this to be useful from time to
time.  I'm in favor of this patch.

Kevin


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC/RFA] new command: maintenance print target-stack
  2006-10-20 17:01 ` Kevin Buettner
@ 2006-10-22 20:03   ` Mark Kettenis
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Kettenis @ 2006-10-22 20:03 UTC (permalink / raw)
  To: kevinb; +Cc: gdb-patches

> Date: Fri, 20 Oct 2006 10:01:00 -0700
> From: Kevin Buettner <kevinb@redhat.com>
> 
> On Tue, 17 Oct 2006 18:52:47 -0400
> Joel Brobecker <brobecker@adacore.com> wrote:
> 
> > 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.
> 
> As a developer, I know that I'd find this to be useful from time to
> time.  I'm in favor of this patch.

No objections from me either.  I don't think we make any guarantees
about the availibility of the maintenance commands, so we can always
improve this later (if necessary).

Mark


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-10-22 20:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-17 22:52 [RFC/RFA] new command: maintenance print target-stack Joel Brobecker
2006-10-20 17:01 ` Kevin Buettner
2006-10-22 20:03   ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox