Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <ghost@cs.msu.su>
To: gdb-patches@sources.redhat.com
Subject: Variable objects: references formatting
Date: Wed, 03 May 2006 09:22:00 -0000	[thread overview]
Message-ID: <e39sls$62k$1@sea.gmane.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]


Hi!
At the moment, when using variable objects to display a struct or a class,
the result of -data-evaluate-expression is "...". However, when displaying
a reference to a class, the result of -data-evaluate-expression is
{}-enclosed list of members and their values.

This disparity does not seem to be reasonable, the attached patch fixes it:

Changelog:

  2006-05-03 Vladimir Prus <ghost@cs.msu.su>
      varobj.c (c_value_of_variable): Ignore top-level references.

Patch attached.

Thanks,
Volodya

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: varobj_references_to_classes.diff --]
[-- Type: text/x-diff; name="varobj_references_to_classes.diff", Size: 609 bytes --]

Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.58
diff -u -r1.58 varobj.c
@@ -2055,8 +2219,14 @@
 {
   /* BOGUS: if val_print sees a struct/class, it will print out its
      children instead of "{...}" */
+  struct type* type = get_type (var);
+  /* Strip top-level references. */
+  while (TYPE_CODE (type) == TYPE_CODE_REF)
+    {
+      type = TYPE_TARGET_TYPE (type);
+    }
 
-  switch (TYPE_CODE (get_type (var)))
+  switch (TYPE_CODE (type))
     {
     case TYPE_CODE_STRUCT:
     case TYPE_CODE_UNION:

             reply	other threads:[~2006-05-03  9:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-03  9:22 Vladimir Prus [this message]
2006-05-03 17:50 ` Jim Blandy
2006-05-03 18:08   ` Jim Blandy
2006-05-04  5:19     ` Vladimir Prus
2006-05-04  6:08       ` Jim Blandy
2006-05-04  6:10         ` Vladimir Prus
2006-05-03 23:05 Nick Roberts
2006-05-03 23:50 ` Jim Blandy
2006-05-04  1:53   ` Nick Roberts
2006-05-04 17:32     ` Jim Blandy
2006-05-04 22:30       ` Nick Roberts
2006-05-05  8:08         ` Jim Blandy
2006-05-04  5:30 ` Vladimir Prus
2006-05-04  6:21   ` Nick Roberts
2006-05-04  7:00     ` Vladimir Prus
2006-05-04  7:20       ` Nick Roberts
2006-05-04 12:10         ` Vladimir Prus

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='e39sls$62k$1@sea.gmane.org' \
    --to=ghost@cs.msu.su \
    --cc=gdb-patches@sources.redhat.com \
    /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