This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MI: type prefixes for values


 > Also, I note that gdb is currently inconsitent even within itself:
 > 
 >     (gdb)
 >     -thread-select 2
 >     ^done,new-thread-id="2",frame={level="0",func="thread",
 >     args=[{name="p",value="0x0"}],..........
 >    (gdb)
 >    -stack-list-arguments 1 0 0
 >    ^done,stack-args=[frame={level="0",
 >    args=[{name="p",value="(void *) 0x0"}]}]
 > 
 > Note that first output has "0x0" as value of 'p', and the second has 
 > "(void *)0x0". 

Here's a patch that doesn't print the type with the value for 
-stack-list-arguments and -stack-list-list-locals (they both use
list_args_or_locals).

The screenshot http://www.inet.net.nz/~nickrob/gdb-ui.png shows the
duplication that arises from the current code (in the upper right hand
window (locals of emacs) of the Emacs frame).

Nick


2006-03-12  Nick Roberts  <nickrob@snap.net.nz>

	* mi/mi-cmd-stack.c (list_args_or_locals): Use common_val_print
	instead of print_variable_value so that type doesn't get printed
	with value.


*** mi-cmd-stack.c	05 Jan 2006 10:56:18 +1300	1.29
--- mi-cmd-stack.c	12 Mar 2006 19:44:08 +1300	
*************** list_args_or_locals (int locals, int val
*** 278,283 ****
--- 278,284 ----
  	    {
  	      struct cleanup *cleanup_tuple = NULL;
  	      struct symbol *sym2;
+ 	      struct value *val;
  	      if (values != PRINT_NO_VALUES)
  		cleanup_tuple =
  		  make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
*************** list_args_or_locals (int locals, int val
*** 300,312 ****
  		      && TYPE_CODE (type) != TYPE_CODE_STRUCT
  		      && TYPE_CODE (type) != TYPE_CODE_UNION)
  		    {
! 		      print_variable_value (sym2, fi, stb->stream);
  		      ui_out_field_stream (uiout, "value", stb);
  		    }
  		  do_cleanups (cleanup_tuple);
  		  break;
  		case PRINT_ALL_VALUES:
! 		  print_variable_value (sym2, fi, stb->stream);
  		  ui_out_field_stream (uiout, "value", stb);
  		  do_cleanups (cleanup_tuple);
  		  break;
--- 301,317 ----
  		      && TYPE_CODE (type) != TYPE_CODE_STRUCT
  		      && TYPE_CODE (type) != TYPE_CODE_UNION)
  		    {
! 		      val = read_var_value (sym2, fi);
! 		      common_val_print
! 			(val, stb->stream, 0, 0, 2, Val_no_prettyprint);
  		      ui_out_field_stream (uiout, "value", stb);
  		    }
  		  do_cleanups (cleanup_tuple);
  		  break;
  		case PRINT_ALL_VALUES:
! 		  val = read_var_value (sym2, fi);
! 		  common_val_print
! 		    (val, stb->stream, 0, 0, 2, Val_no_prettyprint);
  		  ui_out_field_stream (uiout, "value", stb);
  		  do_cleanups (cleanup_tuple);
  		  break;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]