From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25091 invoked by alias); 16 Nov 2006 13:58:47 -0000 Received: (qmail 25080 invoked by uid 22791); 16 Nov 2006 13:58:45 -0000 X-Spam-Check-By: sourceware.org Received: from elasmtp-scoter.atl.sa.earthlink.net (HELO elasmtp-scoter.atl.sa.earthlink.net) (209.86.89.67) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 16 Nov 2006 13:58:36 +0000 Received: from [68.166.114.35] (helo=[IPv6:::1]) by elasmtp-scoter.atl.sa.earthlink.net with asmtp (Exim 4.34) id 1GkhlB-0000EN-Lx; Thu, 16 Nov 2006 08:58:34 -0500 In-Reply-To: <200611161547.46997.vladimir@codesourcery.com> References: <200611161547.46997.vladimir@codesourcery.com> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: gdb-patches@sources.redhat.com Content-Transfer-Encoding: 7bit From: Greg Watson Subject: Re: MI: frozen variable objects Date: Thu, 16 Nov 2006 13:58:00 -0000 To: Vladimir Prus X-Mailer: Apple Mail (2.752.2) X-ELNK-Trace: b18dadd04c208faa1aa676d7e74259b7b3291a7d08dfec792e340f2a6e8a6991ffd429a9737ef54e350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-11/txt/msg00137.txt.bz2 I don't really understand the motivation for putting this kind of functionality into gdb. Any GUI that is more than just a front-end for gdb will most likely have an internal data structure representing the value of the variable, and can retain or manage access to the value if required. It seems to me that adding functionality like this to gdb just adds to bloat when it is really a GUI function anyway. Greg On Nov 16, 2006, at 5:47 AM, Vladimir Prus wrote: > > This patch introduces so called "frozen" variable objects -- > variable objects > that are not implicitly updated by the "-var-update *" command or by > "-var-update" on parent variable objects. > > Those are needed in two cases: > > - GUI might want to capture a value of some variable in the > program > and don't update it automatically. For example, so that at a > later point > you can look at the current values, and compare them with > previous values. > Now, MI does not provide any mechanism to do it. > > - Some values might be "read-sensitive" -- it might be some > memory-mapped > hardware register and reading from it will extact data from > FIFO, or > acknowledge an interrupt, so this is not something that can be > done > implicitly. > > Frozen variable object is a mechanism to handle those use cases. > The most > important design aspects are: > > - A variable object can be made frozen either by explicit > request from the > user, or automatically by gdb, if gdb detect that the value is > read-sensitive. The present patch does not implement such auto- > detection > but I'm prototyped such functionality too, and it will be > coming later. > > - If a variable object is frozen, then the value of that object, > or any > children of it, will be fetched from the memory (via > value_fetch_lazy) > only by explicit -var-update for that variable object or a > child. No > other operations, importantly -var-update * and -var-update of > parents > of frozen variable object, and -var-list-children, will fetch > the value. > > - It is possible that a frozen variable has no value fetched. In > that > case -var-evaluate-expression will return empty string -- it won't > implicitly fetch the value. > > The patch is not fully finished -- it does not include testcase > changes, and > it does not include docs. Both will take quite some time, so I'd > like to pass > the code patch itself for review first. > > Thanks, > Volodya > > * varobj.h (varobj_set_frozen): New > (varobj_get_frozen): New. > (varobj_update): New parameter explicit. > * varobj.c (struct varobj): New fields frozen > and not_fetched. > (varobj_set_frozen, varobj_get_frozen): New. > (install_new_value): Don't fetch values for > frozen variable object, or children thereof. Allow > a frozen variable object to have non-fetched value. > (varobj_update): Allow updating child variables. > Don't traverse frozen children. > (new_variable): Initialize the frozen field. > (c_value_of_variable): Return NULL for frozen > variable without any value yet. > * mi/mi-cmd-var.c (varobj_update_one): New parameter > 'explicit'. > (mi_cmd_var_create): Output the 'frozen' field, > as soon as testsuite is adjusted to expect that field. > (mi_cmd_var_set_frozen): New. > (mi_cmd_var_list_children): : Output the 'frozen' field, > as soon as testsuite is adjusted to expect that field. > (mi_cmd_var_update): Pass the 'explicit' parameter to > varobj_update_one. > * mi/mi-cmds.c (mi_cmds): Register '-var-set-frozen'. > * mi/mi-cmds.h (mi_cmd_var_set_frozen): Declare. >