Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sourceware.org
Subject: Re: MI: type prefixes for values
Date: Fri, 24 Mar 2006 04:30:00 -0000	[thread overview]
Message-ID: <20060324030332.GB2853@nevyn.them.org> (raw)
In-Reply-To: <dvliph$urc$1@sea.gmane.org>

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


  reply	other threads:[~2006-03-24  3:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <dt43qh$sns$1@sea.gmane.org>
2006-03-13  2:44 ` Nick Roberts
2006-03-17 19:32   ` Vladimir Prus
2006-03-17 19:41     ` Daniel Jacobowitz
2006-03-21 14:58       ` Vladimir Prus
2006-03-24  4:30         ` Daniel Jacobowitz [this message]
2006-03-24  9:46           ` Vladimir Prus
2006-03-24 21:02             ` Daniel Jacobowitz
2006-04-06  8:42               ` Vladimir Prus
2006-04-28  6:32                 ` Vladimir Prus
2006-05-05 19:25                   ` Daniel Jacobowitz
2006-05-06  9:59                     ` Nick Roberts
2006-05-15 16:57                       ` Daniel Jacobowitz
2006-05-16  6:10                         ` Nick Roberts
2007-02-03  5:31                         ` MI: type prefixes for values [PATCH] Nick Roberts
2007-02-04 14:16                           ` Daniel Jacobowitz
2007-02-04 21:46                             ` Nick Roberts
2006-03-17 22:25   ` MI: type prefixes for values Daniel Jacobowitz
2006-03-18 18:39     ` Nick Roberts
2006-03-20  6:50       ` Daniel Jacobowitz
2006-03-21 10:22         ` Nick Roberts
2006-03-24  4:25           ` Daniel Jacobowitz
2006-03-24  5:26             ` 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=20060324030332.GB2853@nevyn.them.org \
    --to=drow@false.org \
    --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