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


On Mon, Mar 20, 2006 at 09:40:49AM +0300, Vladimir Prus wrote:
> > On Fri, Mar 17, 2006 at 07:07:17PM +0300, Vladimir Prus wrote:
> >> Nick Roberts wrote:
> >> 
> >> > 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.
> >> 
> >> This patch is much more important that value formatting, in fact. Without
> >> it, if there's local reference variable that's no initialized, we get
> >> this output from gdb:
> >> 
> >>    (gdb) -stack-list-locals --all-values
> >>    Cannot access memory at address 0x1
> >>    ^error,msg="Cannot access memory at address 0x1"
> >> 
> >> Essentially, I can't see any local variables. This patch fixes this too,
> >> because, I believe, common_val_print does check for non-dereferencable
> >> values. Changelogs say common_val_print was specifically added for this
> >> purpose.
> > 
> > Did you try this?  
> 
> Yes, I did. I got the above error without the patch, with CVS HEAD state. I
> got the list of local variables, on the same testcase, with CVS HEAD +
> patch.

OK, I checked this out.  Before, if all the variables are initialized:

^done,locals=[{name="baz",value="2"},{name="blaz2",value="(int &) @0x5009c8: 1"},
{name="blaz4",value="(int &) @0x5009c8: 1"},
{name="blaz",value="(int &) @0x5009c8: 1"},
{name="blaz3",value="(int &) @0x5009c8: 1"},
{name="blaz5",value="(int &) @0x5009c8: 1"}]

If they aren't:

&"Cannot access memory at address 0x0\n"
^error,msg="Cannot access memory at address 0x0"

After:

^done,locals=[{name="baz",value="10922"},{name="blaz2",value="@0x2aaaaabc1ca0"},
{name="blaz4",value="@0x4005e0"},{name="blaz",value="@0x0"},
{name="blaz3",value="@0x40041b"},{name="blaz5",value="@0x400578"}]

Now we are showing only the reference, not the target.  I would have
expected the target value.

Looking at Eclipse:
  cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntegralValue.java

                // Coming from a reference
                if (valueString.startsWith("@")) { //$NON-NLS-1$
                        valueString = valueString.substring(1);
                        int colon = valueString.indexOf(':');
                        if (colon != -1) {
                                valueString = valueString.substring(colon + 1); 
                        }
                } else {

It wants to show the value in its variables window, not the reference.
So this patch would break it.

So, should we change common_val_print, do you think?

-- 
Daniel Jacobowitz
CodeSourcery


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