Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: Vladimir Prus <ghost@cs.msu.su>
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFC: MI - Detecting change of string contents with variable objects
Date: Mon, 18 Dec 2006 08:15:00 -0000	[thread overview]
Message-ID: <17798.19683.251190.740216@kahikatea.snap.net.nz> (raw)
In-Reply-To: <E1GwCV8-0008SD-TG@zigzag.lvk.cs.msu.su>

Vladimir Prus writes:
 > Nick Roberts wrote:
 > 
 > > 
 > > This post follows on from a thread earlier this month on the GDB mailing
 > > list called "memory address ranges (-var-create)"
 > 
 > It looks like that thread did not reach a conclusion, though....

That's why I've continued it here.

 > > Currently variable objects treat strings as pointers so -var-update only
 > > detects a change of address or, if the child is created, when the first
 > > character changes.  The patch below detects when the contents change which
 > > is
 > > more useful.  I've only tested it for C, but I guess it could work for
 > > other
 > > languages that variable objects handle (C++, Java).  The function
 > > value_get_value gets both the address and string value but it's probably
 > > better to just get the string value directly.
 > 
 > I think this is probably a wrong thing to do in MI. Yes, this helps with
 > char*, but char* happens to be not so important in C++ -- modern code
 > mostly uses std::string (or QString, or gtkmm::ustring, or whatever). This
 > patch does not help with those, for the frontend is required to contain
 > special code to handle string classes. As as soon as it has such special
 > code, handling char* can be done in frontend as well. 

You seem to be saying that because it won't work generally for C++ it should
not be made to work for C.

 > In fact, it looks like your patch only changes the behaviour for C --
 > you have:
 > 
 >           if (variable_language (var) == vlang_c &&

Yes, sorry I was trying to say it only currently works for C.

 > but I think we need to avoid special-casing C while not solving any problems
 > with C++. 

I think it's better than nothing.  If you can think of a more general approach
that would be even better.

 >            You mentioned that Insight handles char* just fine -- using
 > current MI code. What approach is take there?

GDB is built into Insight as a single executable, it doesn't rely on
interprocess communication with the frontend.  It compares the displayed string
in the watch expression window with the current value.

 > On technical points:
 > 
 > 1. Your value_get_value has no comments at all.

Its based on c_value_of_variable but this is just a rough sketch.

 > 2. I don't see 'string_value' being freed in 'free_variable'

OK thanks, I hadn't noticed that.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


  reply	other threads:[~2006-12-18  8:15 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-18  2:42 Nick Roberts
2006-12-18  7:01 ` Vladimir Prus
2006-12-18  8:15   ` Nick Roberts [this message]
2006-12-18  8:36     ` Vladimir Prus
2006-12-18 13:38       ` Daniel Jacobowitz
2006-12-18 21:57         ` Nick Roberts
2006-12-21 15:25           ` Vladimir Prus
2006-12-21 22:28             ` Nick Roberts
2006-12-22  6:16               ` Vladimir Prus
2006-12-22  7:16                 ` Nick Roberts
2006-12-22  7:23                   ` Vladimir Prus
2007-01-03 22:46           ` Daniel Jacobowitz
2007-01-04  4:13             ` Nick Roberts
2007-01-04  4:20               ` Daniel Jacobowitz
2007-01-04  6:10                 ` Nick Roberts
2007-01-04 19:40                   ` Daniel Jacobowitz
2007-01-04 20:35                     ` Nick Roberts
2007-01-04 20:50                       ` Daniel Jacobowitz
2007-01-04 21:00                         ` Vladimir Prus
2007-01-05  4:46                           ` Nick Roberts
2007-01-05 14:49                             ` Daniel Jacobowitz
2007-01-05 21:54                               ` Nick Roberts
2007-01-06  7:07                                 ` Vladimir Prus
2007-01-08 15:51                                 ` Daniel Jacobowitz
2007-01-08 21:30                                   ` Nick Roberts
2007-01-08 21:41                                     ` Daniel Jacobowitz
2007-01-04 20:57                       ` Vladimir Prus
2007-01-05  2:26                         ` Nick Roberts
2007-01-04 21:05                   ` Vladimir Prus
2007-01-05  1:09                     ` Nick Roberts
2007-01-05 14:44                       ` Daniel Jacobowitz
2007-01-05 14:49                         ` Vladimir Prus
2007-01-05 16:04                       ` Jim Blandy

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=17798.19683.251190.740216@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=gdb-patches@sources.redhat.com \
    --cc=ghost@cs.msu.su \
    /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