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


 > > > This patch doesn't touch the issue of type prefixes, leaving that to
 > > > deal with separately.
 > > 
 > > If I'm reading this right, I have since realised that my patch to use
 > > common_val_print was no good because it only prints address and not values
 > > for things like references
 > 
 > Vladimir noticed that there's a deref_ref argument to common_val_print;
 > you passed zero, but if you pass one instead, it ought to do the right
 > thing.
 > 
 > Would you like to try the patch again with that change?

Yes, it works as you suggest.  The testsuite is unchanged (-stack-list-locals
only prints the type for integers and there are no tests for -stack-list-args).

It might be a good idea to create a test for a reference variable.  Previously
I suggested that a test for your change to val_print could be done in
mi-var-display.exp or mi-var-cmd.exp, but it needn't be as a variable object
and it could presumably be combined with this test in mi-stack.exp.


-- 
Nick                                           http://www.inet.net.nz/~nickrob



2006-05-17  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	17 May 2006 15:00:29 +1200	
*************** 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, 1, 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, 1, 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]