Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch rfc] "maint print dummy-frames" command
@ 2003-05-04 17:00 Andrew Cagney
  2003-05-05  3:28 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2003-05-04 17:00 UTC (permalink / raw)
  To: gdb-patches

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

Hello,

This adds a new maintenance command "maint print dummy-frames".  If 
you're trying to figure out why the dummy frame chain is messing up, 
this command can be useful.

Doco, ok?

Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 7177 bytes --]

Index: testsuite/ChangeLog
2003-05-04  Andrew Cagney  <cagney@redhat.com>

	* gdb.base/maint.exp: Add tests for "maint print dummy-frames".

Index: doc/ChangeLog
2003-05-04  Andrew Cagney  <cagney@redhat.com>

	* gdb.texinfo (Maintenance Commands): Document "maint print
	dummy-frames".

2003-05-04  Andrew Cagney  <cagney@redhat.com>

	* dummy-frame.c: Include "command.h" and "gdbcmd.h".
	(fprint_dummy_frames): New function.
	(maintenance_print_dummy_frames): New function.
	(_initialize_dummy_frame): Add command "maint print dummy-frames".
	* frame.c (fprint_frame_id): Make global.
	* frame.h (fprint_frame_id): Declare.
	* Makefile.in (dummy-frame.o): Update dependencies.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.373
diff -u -r1.373 Makefile.in
--- Makefile.in	4 May 2003 03:55:34 -0000	1.373
+++ Makefile.in	4 May 2003 16:49:12 -0000
@@ -1662,7 +1662,8 @@
 dpx2-nat.o: dpx2-nat.c $(defs_h) $(gdbcore_h) $(gdb_string_h)
 dsrec.o: dsrec.c $(defs_h) $(serial_h) $(srec_h)
 dummy-frame.o: dummy-frame.c $(defs_h) $(dummy_frame_h) $(regcache_h) \
-	$(frame_h) $(inferior_h) $(gdb_assert_h) $(frame_unwind_h)
+	$(frame_h) $(inferior_h) $(gdb_assert_h) $(frame_unwind_h) \
+	$(command_h) $(gdbcmd_h)
 dve3900-rom.o: dve3900-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
 	$(serial_h) $(inferior_h) $(command_h) $(gdb_string_h) $(regcache_h)
 dwarf2cfi.o: dwarf2cfi.c $(defs_h) $(gdbcore_h) $(symtab_h) $(symfile_h) \
Index: dummy-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dummy-frame.c,v
retrieving revision 1.19
diff -u -r1.19 dummy-frame.c
--- dummy-frame.c	29 Apr 2003 01:49:46 -0000	1.19
+++ dummy-frame.c	4 May 2003 16:49:44 -0000
@@ -29,6 +29,8 @@
 #include "inferior.h"
 #include "gdb_assert.h"
 #include "frame-unwind.h"
+#include "command.h"
+#include "gdbcmd.h"
 
 static void dummy_frame_this_id (struct frame_info *next_frame,
 				 void **this_prologue_cache,
@@ -417,4 +419,50 @@
     return &dummy_frame_unwind;
   else
     return NULL;
+}
+
+static void
+fprint_dummy_frames (struct ui_file *file)
+{
+  struct dummy_frame *s;
+  for (s = dummy_frame_stack; s != NULL; s = s->next)
+    {
+      gdb_print_host_address (s, file);
+      fprintf_unfiltered (file, ":");
+      fprintf_unfiltered (file, " pc=0x%s", paddr (s->pc));
+      fprintf_unfiltered (file, " fp=0x%s", paddr (s->fp));
+      fprintf_unfiltered (file, " sp=0x%s", paddr (s->sp));
+      fprintf_unfiltered (file, " top=0x%s", paddr (s->top));
+      fprintf_unfiltered (file, " id=");
+      fprint_frame_id (file, s->id);
+      fprintf_unfiltered (file, " call_lo=0x%s", paddr (s->call_lo));
+      fprintf_unfiltered (file, " call_hi=0x%s", paddr (s->call_hi));
+      fprintf_unfiltered (file, "\n");
+    }
+}
+
+static void
+maintenance_print_dummy_frames (char *args, int from_tty)
+{
+  if (args == NULL)
+    fprint_dummy_frames (gdb_stdout);
+  else
+    {
+      struct ui_file *file = gdb_fopen (args, "w");
+      if (file == NULL)
+	perror_with_name ("maintenance print dummy-frames");
+      fprint_dummy_frames (file);    
+      ui_file_delete (file);
+    }
+}
+
+extern void _initialize_dummy_frame (void);
+
+void
+_initialize_dummy_frame (void)
+{
+  add_cmd ("dummy-frames", class_maintenance, maintenance_print_dummy_frames,
+	   "Print the contents of the internal dummy-frame stack.",
+	   &maintenanceprintlist);
+
 }
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.110
diff -u -r1.110 frame.c
--- frame.c	29 Apr 2003 01:49:46 -0000	1.110
+++ frame.c	4 May 2003 16:49:51 -0000
@@ -139,7 +139,7 @@
 
 static int backtrace_below_main;
 
-static void
+void
 fprint_frame_id (struct ui_file *file, struct frame_id id)
 {
   fprintf_unfiltered (file, "{stack=0x%s,code=0x%s}",
Index: frame.h
===================================================================
RCS file: /cvs/src/src/gdb/frame.h,v
retrieving revision 1.93
diff -u -r1.93 frame.h
--- frame.h	29 Apr 2003 01:49:46 -0000	1.93
+++ frame.h	4 May 2003 16:49:56 -0000
@@ -95,6 +95,10 @@
    above about frameless functions.  */
 extern int frame_id_inner (struct frame_id l, struct frame_id r);
 
+/* Write the internal representation of a frame ID on the specified
+   stream.  */
+extern void fprint_frame_id (struct ui_file *file, struct frame_id id);
+
 
 /* For every stopped thread, GDB tracks two frames: current and
    selected.  Current frame is the inner most frame of the selected
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.159
diff -u -r1.159 gdb.texinfo
--- doc/gdb.texinfo	4 May 2003 16:44:25 -0000	1.159
+++ doc/gdb.texinfo	4 May 2003 16:51:15 -0000
@@ -19373,6 +19373,28 @@
 Takes an optional parameter that is used as the text of the error or
 warning message.
 
+@kindex maint print dummy-frames
+@item maint print dummy-frames
+
+Prints the contents of @value{GDBN}'s internal dummy-frame stack.
+
+@smallexample
+(gdb) @kbd{b add}
+@dots{}
+(gdb) @kbd{print add(2,3)}
+Breakpoint 2, add (a=2, b=3) at @dots{}
+58	  return (a + b);
+The program being debugged stopped while in a function called from GDB.
+@dots{}
+(gdb) @kbd{maint print dummy-frames}
+0x1a57c80: pc=0x01014068 fp=0x0200bddc sp=0x0200bdd6
+ top=0x0200bdd4 id=@{stack=0x200bddc,code=0x101405c@}
+ call_lo=0x01014000 call_hi=0x01014001
+(gdb) 
+@end smallexample
+
+Takes an optional file parameter.
+
 @kindex maint print registers
 @kindex maint print raw-registers
 @kindex maint print cooked-registers
Index: testsuite/gdb.base/maint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/maint.exp,v
retrieving revision 1.18
diff -u -r1.18 maint.exp
--- testsuite/gdb.base/maint.exp	14 Feb 2003 01:13:45 -0000	1.18
+++ testsuite/gdb.base/maint.exp	4 May 2003 16:51:49 -0000
@@ -35,6 +35,7 @@
 #maintenance info -- Commands for showing internal info about the program being debugged
 #maintenance internal-error -- Give GDB an internal error.
 #
+#maintenance print dummy-frames -- Print the dummy frame stack
 #maintenance print statistics -- Print statistics about internal gdb state
 #maintenance print objfiles -- Print dump of current object file definitions
 #maintenance print psymbols -- Print dump of current partial symbol definitions
@@ -186,6 +187,9 @@
         timeout         { fail "(timeout) maint print statistics" }
         }
 
+# There aren't any ...
+gdb_test "maint print dummy-frames" ""
+
 send_gdb "maint print objfiles\n"
 
 # To avoid timeouts, we avoid expects with many .* patterns that match
@@ -523,6 +527,9 @@
         -re ".*$gdb_prompt $"       { fail "help maint print statistics" }
         timeout         { fail "(timeout) help maint print statistics" }
         }
+
+gdb_test "help maint print dummy-frames" \
+	"Print the contents of the internal dummy-frame stack."
 
 send_gdb "help maint print objfiles\n"
 gdb_expect  {

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

* Re: [patch rfc] "maint print dummy-frames" command
  2003-05-04 17:00 [patch rfc] "maint print dummy-frames" command Andrew Cagney
@ 2003-05-05  3:28 ` Eli Zaretskii
  2003-05-05 18:36   ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2003-05-05  3:28 UTC (permalink / raw)
  To: ac131313; +Cc: gdb-patches

> Date: Sun, 04 May 2003 12:59:58 -0400
> From: Andrew Cagney <ac131313@redhat.com>
> 
> This adds a new maintenance command "maint print dummy-frames".

Okay for the docs patch.


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

* Re: [patch rfc] "maint print dummy-frames" command
  2003-05-05  3:28 ` Eli Zaretskii
@ 2003-05-05 18:36   ` Andrew Cagney
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cagney @ 2003-05-05 18:36 UTC (permalink / raw)
  To: gdb-patches; +Cc: Eli Zaretskii

> Hello,
> 
> This adds a new maintenance command "maint print dummy-frames".  If you're trying to figure out why the dummy frame chain is messing up, this command can be useful.

I've checked this in.

Andrew


> Index: testsuite/ChangeLog
> 2003-05-04  Andrew Cagney  <cagney@redhat.com>
> 
> 	* gdb.base/maint.exp: Add tests for "maint print dummy-frames".
> 
> Index: doc/ChangeLog
> 2003-05-04  Andrew Cagney  <cagney@redhat.com>
> 
> 	* gdb.texinfo (Maintenance Commands): Document "maint print
> 	dummy-frames".
> 
> 2003-05-04  Andrew Cagney  <cagney@redhat.com>
> 
> 	* dummy-frame.c: Include "command.h" and "gdbcmd.h".
> 	(fprint_dummy_frames): New function.
> 	(maintenance_print_dummy_frames): New function.
> 	(_initialize_dummy_frame): Add command "maint print dummy-frames".
> 	* frame.c (fprint_frame_id): Make global.
> 	* frame.h (fprint_frame_id): Declare.
> 	* Makefile.in (dummy-frame.o): Update dependencies.



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

end of thread, other threads:[~2003-05-05 18:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-04 17:00 [patch rfc] "maint print dummy-frames" command Andrew Cagney
2003-05-05  3:28 ` Eli Zaretskii
2003-05-05 18:36   ` Andrew Cagney

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