This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: MI: type prefixes for values
- From: Nick Roberts <nickrob at snap dot net dot nz>
- To: Daniel Jacobowitz <drow at false dot org>
- Cc: Vladimir Prus <ghost at cs dot msu dot su>, gdb-patches at sources dot redhat dot com
- Date: Tue, 16 May 2006 15:45:39 +1200
- Subject: Re: MI: type prefixes for values
- References: <17427.54333.236860.258115@kahikatea.snap.net.nz> <dvemrm$al0$1@sea.gmane.org> <20060317191207.GA19068@nevyn.them.org> <dvliph$urc$1@sea.gmane.org> <20060324030332.GB2853@nevyn.them.org> <e00anu$f6m$1@sea.gmane.org> <20060324202056.GA26748@nevyn.them.org> <e12k8s$dci$1@sea.gmane.org> <e2scu2$vvn$1@sea.gmane.org> <20060505192535.GM31029@nevyn.them.org> <20060515165354.GG28924@nevyn.them.org>
> > > 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;