From 00905d52fe94f8ad61bfb36a7a427ae6b9578aa7 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Mon, 5 May 2003 18:33:11 +0000 Subject: [PATCH] Index: testsuite/ChangeLog 2003-05-05 Andrew Cagney * gdb.base/maint.exp: Add tests for "maint print dummy-frames". Index: doc/ChangeLog 2003-05-05 Andrew Cagney * gdb.texinfo (Maintenance Commands): Document "maint print dummy-frames". 2003-05-05 Andrew Cagney * 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. --- gdb/ChangeLog | 10 +++++++ gdb/Makefile.in | 3 +- gdb/doc/ChangeLog | 5 ++++ gdb/doc/gdb.texinfo | 22 +++++++++++++++ gdb/dummy-frame.c | 48 ++++++++++++++++++++++++++++++++ gdb/frame.c | 2 +- gdb/frame.h | 4 +++ gdb/testsuite/ChangeLog | 4 +++ gdb/testsuite/gdb.base/maint.exp | 7 +++++ 9 files changed, 103 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cf8b1a0203..0e6d58cd18 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2003-05-05 Andrew Cagney + + * 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. + 2003-05-05 Andrew Cagney * gdbarch.sh (DEPRECATED_REGISTER_SIZE): Rename REGISTER_SIZE. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 46b4f40cb2..43d544dab1 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1662,7 +1662,8 @@ doublest.o: doublest.c $(defs_h) $(doublest_h) $(floatformat_h) \ 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) \ diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 3a4789a41b..9ad87b5631 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -5,6 +5,11 @@ FIX_CALL_DUMMY, CALL_DUMMY_BREAKPOINT_OFFSET and CALL_DUMMY_BREAKPOINT_OFFSET deprecated. +2003-05-04 Andrew Cagney + + * gdb.texinfo (Maintenance Commands): Document "maint print + dummy-frames". + 2003-05-04 Andrew Cagney * gdb.texinfo (GDB/MI Symbol Query): Use @{ and @}. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 370ad3aa6e..7bb99c630f 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -19373,6 +19373,28 @@ Create a core file? (y or n) @kbd{n} 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 diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index e6c9ca6199..e16056c441 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -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, @@ -419,3 +421,49 @@ dummy_frame_p (CORE_ADDR pc) 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); + +} diff --git a/gdb/frame.c b/gdb/frame.c index 4af3d6c547..b881a74d34 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -139,7 +139,7 @@ static int frame_debug; 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}", diff --git a/gdb/frame.h b/gdb/frame.h index cb629d995c..a8f05f35f8 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -95,6 +95,10 @@ extern int frame_id_eq (struct frame_id l, struct frame_id r); 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 diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a9a0436bd9..d85e0ceafe 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2003-05-05 Andrew Cagney + + * gdb.base/maint.exp: Add tests for "maint print dummy-frames". + 2003-05-05 Andrew Cagney * gdb.base/watchpoint.exp: Rename CALL_DUMMY_BREAKPOINT_OFFSET to diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index d828650869..f82bf0202b 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -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 @@ gdb_expect { 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 @@ -524,6 +528,9 @@ gdb_expect { 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 { -re "Print dump of current object file definitions\\..*$gdb_prompt $"\ -- 2.34.1