From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21061 invoked by alias); 23 Apr 2008 03:54:31 -0000 Received: (qmail 21049 invoked by uid 22791); 23 Apr 2008 03:54:30 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.25) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 23 Apr 2008 03:54:02 +0000 Received: from kahikatea.snap.net.nz (120.31.255.123.static.snap.net.nz [123.255.31.120]) by viper.snap.net.nz (Postfix) with ESMTP id 55E573DA4BE for ; Wed, 23 Apr 2008 15:53:59 +1200 (NZST) Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id D83F28FC6D; Wed, 23 Apr 2008 15:53:55 +1200 (NZST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18446.45778.889114.789630@kahikatea.snap.net.nz> Date: Wed, 23 Apr 2008 05:33:00 -0000 To: gdb-patches@sourceware.org Subject: [PATCH] -stack-info-frame/-stack-list-frames X-Mailer: VM 7.19 under Emacs 22.2.50.2 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-04/txt/msg00496.txt.bz2 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 * 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) \