Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Marc Khouzam" <marc.khouzam@ericsson.com>
To: <gdb@sources.redhat.com>
Subject: Re: -var-update using formatted value
Date: Fri, 11 Jan 2008 19:40:00 -0000	[thread overview]
Message-ID: <6D19CA8D71C89C43A057926FE0D4ADAA04290E20@ecamlmw720.eamcs.ericsson.se> (raw)
In-Reply-To: <6D19CA8D71C89C43A057926FE0D4ADAA04290E1B@ecamlmw720.eamcs.ericsson.se>


This may be an over-simplified solution, but I think that if GDB always use the 
Natural format when storing the print value, it will fix the problem.
From looking at the varobj.c code, I believe that the only impact will be
to the -var-update output.  -var-update would no longer show variables who have
changed only due to a format change, but only those which have 'really' changed.

It is a one-line fix and I tried it successfully on the little example
that was giving a problem.
The patch is:

Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.99
diff -u -r1.99 varobj.c
--- varobj.c    1 Jan 2008 22:53:13 -0000       1.99
+++ varobj.c    11 Jan 2008 19:23:48 -0000
@@ -1029,7 +1029,7 @@
      lazy -- if it is, the code above has decided that the value
      should not be fetched.  */
   if (value && !value_lazy (value))
-      print_value = value_get_print_value (value, var->format);
+      print_value = value_get_print_value (value, FORMAT_NATURAL);
 
   /* If the type is changeable, compare the old and the new values.
      If this is the initial assignment, we don't have any old value




-----Original Message-----
From: gdb-owner@sourceware.org [mailto:gdb-owner@sourceware.org]On
Behalf Of Marc Khouzam
Sent: Friday, January 11, 2008 1:31 PM
To: gdb@sources.redhat.com
Subject: RE: Re: -var-update using formatted value



> Why do you need "is it really changed" query?

I'm working on the Eclipse front-end to GDB for DSDP/DSF.
It offers the ability to optionally show all formats of a variable object (binary, decimal, etc)
To do this, we use -var-set-format.  And to avoid having to repeatedly query GDB for all formatted
values of a varObject, we buffer all of them in the frontend.  We only query for those values again
if the varObject has changed.

The problem is that when it is time to do a -var-update (when the program stops), the varObject may not
be set to the same format as at the time of the previous var-update.  And in that case,
-var-update will indicate a change in the value, which will cause the front-end to unnecessarily
clear its value-cache, and ask GDB again for each value.

What I originally thought was that -var-udpate will notify the front-end if the value 'really' changed.
But since it is not the case, to work around it, I do a var-set-format to natural before each var-update.  
But it seems like a bit of a hack.

I was trying to understand why the new behaviour for var-udpate, but I haven't figured out why
a front-end would benefit from having -var-update indicate that
a variable object has changed if only its printed value is different but not its actual content.

Thanks

Marc



  reply	other threads:[~2008-01-11 19:40 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-11 15:13 Marc Khouzam
2008-01-11 17:40 ` Vladimir Prus
2008-01-11 18:31   ` Marc Khouzam
2008-01-11 19:40     ` Marc Khouzam [this message]
2008-01-11 22:26     ` Nick Roberts
2008-01-11 22:53       ` Andreas Schwab
2008-01-11 22:59         ` Daniel Jacobowitz
2008-01-11 23:40           ` Nick Roberts
2008-01-11 23:52             ` Daniel Jacobowitz
2008-01-12  3:41               ` Marc Khouzam
2008-01-12  3:49                 ` Daniel Jacobowitz
2008-01-14  2:36                   ` Marc Khouzam
2008-01-15 18:43                     ` Vladimir Prus
2008-01-15 19:36                       ` Marc Khouzam
2008-01-15 20:32                         ` Vladimir Prus
2008-01-17 14:57                           ` Marc Khouzam
2008-01-17 18:05                             ` Vladimir Prus
2008-01-18  1:35                             ` Nick Roberts
2008-01-18 15:31                               ` Marc Khouzam
2008-01-18 15:41                                 ` Daniel Jacobowitz
2008-01-18 17:17                                   ` Marc Khouzam
2008-01-18 17:53                                     ` Daniel Jacobowitz
2008-01-18 19:26                                       ` Marc Khouzam
2008-01-18 21:10                                 ` Nick Roberts
2008-01-18 22:21                                   ` Marc Khouzam
2008-01-19  0:31                                     ` Nick Roberts
2008-01-19  1:46                                       ` Marc Khouzam
2008-01-19  8:27                                         ` Nick Roberts
2008-01-19 11:17                                         ` Vladimir Prus
2008-01-21 15:47                                       ` Marc Khouzam
2008-01-21 21:44                                         ` Nick Roberts
2008-01-17 23:10                           ` Nick Roberts
2008-01-19 11:06                             ` Vladimir Prus
2008-01-19 22:02                               ` Nick Roberts
2008-01-20 10:04                                 ` Vladimir Prus
2008-01-20 20:16                                   ` Nick Roberts
2008-01-20 20:28                                     ` Vladimir Prus
2008-01-21 15:15                                       ` Marc Khouzam
2008-01-21 22:35                                         ` Nick Roberts
2008-01-29 21:20                           ` Daniel Jacobowitz
2008-02-03 22:21                             ` Nick Roberts
2008-02-04  6:15                               ` Vladimir Prus
2008-01-18  0:53                     ` Nick Roberts
2008-01-18  2:13                       ` Marc Khouzam
2008-01-18 21:00                         ` Nick Roberts
2008-01-18 22:04                           ` Marc Khouzam
2008-01-14  6:34               ` Nick Roberts
2008-01-29 21:26                 ` Daniel Jacobowitz
2008-01-29 23:49                   ` Nick Roberts
2008-01-30  0:04                     ` Daniel Jacobowitz
2008-01-30  4:25                       ` 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=6D19CA8D71C89C43A057926FE0D4ADAA04290E20@ecamlmw720.eamcs.ericsson.se \
    --to=marc.khouzam@ericsson.com \
    --cc=gdb@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