Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] new command: maintenance print target-stack
@ 2007-01-24  1:13 Joel Brobecker
  2007-01-24  4:19 ` Eli Zaretskii
  2007-01-24 20:05 ` Daniel Jacobowitz
  0 siblings, 2 replies; 12+ messages in thread
From: Joel Brobecker @ 2007-01-24  1:13 UTC (permalink / raw)
  To: gdb-patches

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

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

* Re: [RFA] new command: maintenance print target-stack
  2007-01-24  1:13 [RFA] new command: maintenance print target-stack Joel Brobecker
@ 2007-01-24  4:19 ` Eli Zaretskii
  2007-01-24 16:19   ` Joel Brobecker
  2007-01-24 20:05 ` Daniel Jacobowitz
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2007-01-24  4:19 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

> Date: Tue, 23 Jan 2007 20:12:55 -0500
> From: Joel Brobecker <brobecker@adacore.com>
> 
> 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.

At the time, you also promised to write a suitable patch for the
manual.  What happened to that promise now? ;-)


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

* Re: [RFA] new command: maintenance print target-stack
  2007-01-24  4:19 ` Eli Zaretskii
@ 2007-01-24 16:19   ` Joel Brobecker
  2007-01-24 19:50     ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Joel Brobecker @ 2007-01-24 16:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

> > 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.
> 
> At the time, you also promised to write a suitable patch for the
> manual.  What happened to that promise now? ;-)

Did I really promise some doco as well? Must have been a moment of
weakness... ;-)

No worries about the documentation. I promise (again!) that I will write
something as soon as the patch is finalized and checked in (that way,
I'm sure I document what gets checked in).

-- 
Joel


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

* Re: [RFA] new command: maintenance print target-stack
  2007-01-24 16:19   ` Joel Brobecker
@ 2007-01-24 19:50     ` Eli Zaretskii
  2007-01-24 20:03       ` Joel Brobecker
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2007-01-24 19:50 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

> Date: Wed, 24 Jan 2007 11:20:36 -0500
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: gdb-patches@sourceware.org
> 
> Did I really promise some doco as well? Must have been a moment of
> weakness... ;-)

Yes, it did sound strange ;-)

> No worries about the documentation. I promise (again!) that I will write
> something as soon as the patch is finalized and checked in (that way,
> I'm sure I document what gets checked in).

I'd really, really ask not to check in code without the docs to
accompany it.  I'd like to avoid even the slightest chance that a
snapshot gets tarred and fetched by someone between the code and the
documentation checkins.

If you want to wait with the documentation until the code is approved,
it's fine by me, but please at that time post a unified patch that
includes both the code and doco, and commit both after my approval.

TIA


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

* Re: [RFA] new command: maintenance print target-stack
  2007-01-24 19:50     ` Eli Zaretskii
@ 2007-01-24 20:03       ` Joel Brobecker
  0 siblings, 0 replies; 12+ messages in thread
From: Joel Brobecker @ 2007-01-24 20:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

> If you want to wait with the documentation until the code is approved,
> it's fine by me, but please at that time post a unified patch that
> includes both the code and doco, and commit both after my approval.

Sure, you got it.

-- 
Joel


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

* Re: [RFA] new command: maintenance print target-stack
  2007-01-24  1:13 [RFA] new command: maintenance print target-stack Joel Brobecker
  2007-01-24  4:19 ` Eli Zaretskii
@ 2007-01-24 20:05 ` Daniel Jacobowitz
  2007-01-25 23:58   ` Joel Brobecker
  2007-01-29 16:38   ` Joel Brobecker
  1 sibling, 2 replies; 12+ messages in thread
From: Daniel Jacobowitz @ 2007-01-24 20:05 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On Tue, Jan 23, 2007 at 08:12:55PM -0500, Joel Brobecker wrote:
> 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.

OK, with documentation.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: [RFA] new command: maintenance print target-stack
  2007-01-24 20:05 ` Daniel Jacobowitz
@ 2007-01-25 23:58   ` Joel Brobecker
  2007-01-26  9:36     ` Eli Zaretskii
  2007-01-29 16:38   ` Joel Brobecker
  1 sibling, 1 reply; 12+ messages in thread
From: Joel Brobecker @ 2007-01-25 23:58 UTC (permalink / raw)
  To: gdb-patches

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

> > 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.
> 
> OK, with documentation.

Thanks, Daniel.

Eli,

Here is a first cut at documenting this new command.

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

        * gdb.texinfo (Maintenance Commands): Add documentation for
        the new "maint print target-stack" command.

Would that be ok?

Thanks,
-- 
Joel

[-- Attachment #2: targ.diff --]
[-- Type: text/plain, Size: 752 bytes --]

Index: gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.379
diff -u -p -r1.379 gdb.texinfo
--- gdb.texinfo	20 Jan 2007 16:51:55 -0000	1.379
+++ gdb.texinfo	25 Jan 2007 23:55:36 -0000
@@ -22667,6 +22667,12 @@ average, and median entry size, total me
 savings, and various measures of the hash table size and chain
 lengths.
 
+@kindex maint print target-stack
+@cindex target stack description
+@item maint print target-stack
+Print a short description of each layer that was pushed on the target stack,
+starting from the top stack down to the bottom one.
+
 @kindex maint print type
 @cindex type chain of a data type
 @item maint print type @var{expr}

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

* Re: [RFA] new command: maintenance print target-stack
  2007-01-25 23:58   ` Joel Brobecker
@ 2007-01-26  9:36     ` Eli Zaretskii
  2007-01-26 22:04       ` Joel Brobecker
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2007-01-26  9:36 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

> Date: Thu, 25 Jan 2007 18:58:57 -0500
> From: Joel Brobecker <brobecker@adacore.com>
>  
> +@kindex maint print target-stack
> +@cindex target stack description
> +@item maint print target-stack
> +Print a short description of each layer that was pushed on the target stack,
> +starting from the top stack down to the bottom one.

This is okay, except that the term "target stack", and what is pushed
onto it, is not explained anywhere in the manual, not even in
gdbint.texinfo.  Can you add a sentence or two saying what it is?

Also, the first usage of "target stack" should be in @dfn, which is
our way of saying that this is a new term.

Thanks.


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

* Re: [RFA] new command: maintenance print target-stack
  2007-01-26  9:36     ` Eli Zaretskii
@ 2007-01-26 22:04       ` Joel Brobecker
  2007-01-27 10:33         ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Joel Brobecker @ 2007-01-26 22:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

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

> This is okay, except that the term "target stack", and what is pushed
> onto it, is not explained anywhere in the manual, not even in
> gdbint.texinfo.  Can you add a sentence or two saying what it is?
> 
> Also, the first usage of "target stack" should be in @dfn, which is
> our way of saying that this is a new term.

Good points. I was lucky to find something in target.h, so I shamelessly
copied it. How does this look?

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

        * gdb.texinfo (Maintenance Commands): Add documentation for
        the new "maint print target-stack" command.

-- 
Joel

[-- Attachment #2: doco.diff --]
[-- Type: text/plain, Size: 1130 bytes --]

Index: gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.379
diff -u -p -r1.379 gdb.texinfo
--- gdb.texinfo	20 Jan 2007 16:51:55 -0000	1.379
+++ gdb.texinfo	26 Jan 2007 21:55:27 -0000
@@ -22667,6 +22667,19 @@ average, and median entry size, total me
 savings, and various measures of the hash table size and chain
 lengths.
 
+@kindex maint print target-stack
+@cindex target stack description
+@item maint print target-stack
+A @dfn{target} is an interface between the debugger and a particular
+kind of file or process.  Targets can be stacked in @dfn{strata},
+so that more than one target can potentially respond to a request.
+In particular, memory accesses will walk down the stack of targets
+until they find a target that is interested in handling that particular
+address.
+
+This command prints a short description of each layer that was pushed on
+the @dfn{target stack}, starting from the top layer down to the bottom one.
+
 @kindex maint print type
 @cindex type chain of a data type
 @item maint print type @var{expr}

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

* Re: [RFA] new command: maintenance print target-stack
  2007-01-26 22:04       ` Joel Brobecker
@ 2007-01-27 10:33         ` Eli Zaretskii
  2007-01-29 16:38           ` Joel Brobecker
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2007-01-27 10:33 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

> Date: Fri, 26 Jan 2007 16:59:17 -0500
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: gdb-patches@sourceware.org
> 
> Good points. I was lucky to find something in target.h, so I shamelessly
> copied it. How does this look?

This is okay, thanks.


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

* Re: [RFA] new command: maintenance print target-stack
  2007-01-27 10:33         ` Eli Zaretskii
@ 2007-01-29 16:38           ` Joel Brobecker
  0 siblings, 0 replies; 12+ messages in thread
From: Joel Brobecker @ 2007-01-29 16:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

> > Good points. I was lucky to find something in target.h, so I shamelessly
> > copied it. How does this look?
> 
> This is okay, thanks.

Thanks Eli. Checked in.

-- 
Joel


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

* Re: [RFA] new command: maintenance print target-stack
  2007-01-24 20:05 ` Daniel Jacobowitz
  2007-01-25 23:58   ` Joel Brobecker
@ 2007-01-29 16:38   ` Joel Brobecker
  1 sibling, 0 replies; 12+ messages in thread
From: Joel Brobecker @ 2007-01-29 16:38 UTC (permalink / raw)
  To: gdb-patches

> > 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.
> 
> OK, with documentation.

Thanks Daniel. Both code and documentation checked in.

-- 
Joel


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

end of thread, other threads:[~2007-01-29 16:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-24  1:13 [RFA] new command: maintenance print target-stack Joel Brobecker
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

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