This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] -stack-info-frame/-stack-list-frames
- From: Nick Roberts <nickrob at snap dot net dot nz>
- To: gdb-patches at sourceware dot org
- Date: Wed, 23 Apr 2008 15:53:54 +1200
- Subject: [PATCH] -stack-info-frame/-stack-list-frames
Here's a patch to add the frame address to the output of -stack-info-frame and
-stack-list-frames and async output when execution stops. It also outputs the
source language for -stack-info-frame, these change making it more like "info
frame":
-exec-run
^running
(gdb)
*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="1",frame={addr="0x08048539",frame_addr="0xbfa67af0",func="mysquare",args=[{name="x",value="8"}],file="myprog.c",fullname="/home/nickrob/myprog.c",line="67"}
(gdb)
-stack-list-frames
^done,stack=[frame={level="0",addr="0x08048539",frame_addr="0xbfa67af0",func="mysquare",file="myprog.c",fullname="/home/nickrob/myprog.c",line="67"},frame={level="1",addr="0x08048753",frame_addr="0xbfa68ba0",func="main",file="myprog.c",fullname="/home/nickrob/myprog.c",line="176"}]
(gdb)
-stack-info-frame
^done,frame={level="0",addr="0x08048539",frame_addr="0xbfa67af0",func="mysquare",file="myprog.c",fullname="/home/nickrob/myprog.c",line="67"},lang="c"
(gdb)
I'll provide test and documentation patches when this change is approved in
principle.
--
Nick http://www.inet.net.nz/~nickrob
2008-04-23 Nick Roberts <nickrob@snap.net.nz>
* mi/mi-cmd-stack.c (mi_cmd_stack_info_frame): Add "lang" field
for source language of frame.
* stack.c (print_frame_info): Add field for frame address.
* Makefile.in (stack.o): Add dependency on language.h.
*** mi-cmd-stack.c.~1.35.~ 2008-01-10 01:45:14.000000000 +1300
--- mi-cmd-stack.c 2008-04-23 15:35:28.000000000 +1200
***************
*** 29,34 ****
--- 29,35 ----
#include "stack.h"
#include "dictionary.h"
#include "gdb_string.h"
+ #include "language.h"
static void list_args_or_locals (int locals, int values, struct frame_info *fi);
*************** mi_cmd_stack_select_frame (char *command
*** 335,343 ****
enum mi_cmd_result
mi_cmd_stack_info_frame (char *command, char **argv, int argc)
{
if (argc > 0)
error (_("mi_cmd_stack_info_frame: No arguments required"));
! print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0);
return MI_CMD_DONE;
}
--- 336,352 ----
enum mi_cmd_result
mi_cmd_stack_info_frame (char *command, char **argv, int argc)
{
+ struct frame_info *fi;
+ struct symtab *s;
+
if (argc > 0)
error (_("mi_cmd_stack_info_frame: No arguments required"));
! fi = get_selected_frame (NULL);
! print_frame_info (fi, 1, LOC_AND_ADDRESS, 0);
!
! s = find_pc_symtab (get_frame_pc (fi));
! ui_out_field_string (uiout, "lang", language_str (s->language));
!
return MI_CMD_DONE;
}
*** stack.c.~1.165~ 2008-04-23 15:49:32.000000000 +1200
--- stack.c 2008-04-23 15:32:09.000000000 +1200
*************** print_frame_info (struct frame_info *fra
*** 482,487 ****
--- 482,488 ----
annotate_frame_address ();
ui_out_field_core_addr (uiout, "addr", get_frame_pc (frame));
annotate_frame_address_end ();
+ ui_out_field_core_addr (uiout, "frame_addr", get_frame_base (frame));
}
if (get_frame_type (frame) == DUMMY_FRAME)
*************** print_frame_info (struct frame_info *fra
*** 546,551 ****
--- 547,555 ----
if (addressprint && mid_statement)
{
ui_out_field_core_addr (uiout, "addr", get_frame_pc (frame));
+ if (ui_out_is_mi_like_p (uiout))
+ ui_out_field_core_addr (uiout, "frame_addr",
+ get_frame_base (frame));
ui_out_text (uiout, "\t");
}
*************** print_frame (struct frame_info *frame, i
*** 670,675 ****
--- 674,681 ----
annotate_frame_address ();
ui_out_field_core_addr (uiout, "addr", get_frame_pc (frame));
annotate_frame_address_end ();
+ if (ui_out_is_mi_like_p (uiout))
+ ui_out_field_core_addr (uiout, "frame_addr", get_frame_base (frame));
ui_out_text (uiout, " in ");
}
annotate_frame_function_name ();
*** Makefile.in.~1.1002.~ 2008-04-19 18:03:52.000000000 +1200
--- Makefile.in 2008-04-23 15:39:52.000000000 +1200
*************** stack.o: stack.c $(defs_h) $(value_h) $(
*** 2867,2873 ****
$(target_h) $(source_h) $(breakpoint_h) $(demangle_h) $(inferior_h) \
$(annotate_h) $(ui_out_h) $(block_h) $(stack_h) $(dictionary_h) \
$(exceptions_h) $(reggroups_h) $(regcache_h) $(solib_h) \
! $(valprint_h) $(gdb_assert_h) $(gdb_string_h)
std-regs.o: std-regs.c $(defs_h) $(user_regs_h) $(frame_h) $(gdbtypes_h) \
$(value_h) $(gdb_string_h)
symfile.o: symfile.c $(defs_h) $(bfdlink_h) $(symtab_h) $(gdbtypes_h) \
--- 2867,2873 ----
$(target_h) $(source_h) $(breakpoint_h) $(demangle_h) $(inferior_h) \
$(annotate_h) $(ui_out_h) $(block_h) $(stack_h) $(dictionary_h) \
$(exceptions_h) $(reggroups_h) $(regcache_h) $(solib_h) \
! $(valprint_h) $(gdb_assert_h) $(gdb_string_h) $(language_h)
std-regs.o: std-regs.c $(defs_h) $(user_regs_h) $(frame_h) $(gdbtypes_h) \
$(value_h) $(gdb_string_h)
symfile.o: symfile.c $(defs_h) $(bfdlink_h) $(symtab_h) $(gdbtypes_h) \