Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: gdb-patches@sourceware.org
Subject: [PATCH] -stack-info-frame/-stack-list-frames
Date: Wed, 23 Apr 2008 05:33:00 -0000	[thread overview]
Message-ID: <18446.45778.889114.789630@kahikatea.snap.net.nz> (raw)


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) \


             reply	other threads:[~2008-04-23  3:54 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-23  5:33 Nick Roberts [this message]
2008-04-23  5:48 ` Vladimir Prus
2008-04-23  6:03   ` Nick Roberts
2008-04-23  6:16     ` Vladimir Prus
2008-04-23  9:50       ` Nick Roberts
2008-04-23 10:32         ` Vladimir Prus
2008-04-23 13:23           ` Nick Roberts
2008-04-23 13:44             ` Daniel Jacobowitz
2008-04-23 23:04               ` Nick Roberts
2008-04-23 23:27                 ` Daniel Jacobowitz
2008-04-24  0:40                   ` Bob Rossi
2008-04-24  1:45                     ` Nick Roberts
2008-04-24  1:31                   ` Nick Roberts
2008-04-24  1:48                     ` Nick Roberts
2008-04-24 10:24                     ` Daniel Jacobowitz
2008-04-25  1:48                       ` Nick Roberts
2008-04-25  2:03                         ` Daniel Jacobowitz
2008-04-25 11:41                           ` Nick Roberts
2008-04-23 13:53             ` Vladimir Prus
2008-04-23 23:23               ` Nick Roberts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18446.45778.889114.789630@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox