From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13302 invoked by alias); 22 Dec 2006 07:16:48 -0000 Received: (qmail 13292 invoked by uid 22791); 22 Dec 2006 07:16:47 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 22 Dec 2006 07:16:42 +0000 Received: from kahikatea.snap.net.nz (p202-124-120-122.snap.net.nz [202.124.120.122]) by viper.snap.net.nz (Postfix) with ESMTP id 15C1E3D8371; Fri, 22 Dec 2006 20:18:16 +1300 (NZDT) Received: by kahikatea.snap.net.nz (Postfix, from userid 500) id E06E9BE457; Fri, 22 Dec 2006 20:12:04 +1300 (NZDT) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17803.34115.206621.977511@kahikatea.snap.net.nz> Date: Fri, 22 Dec 2006 07:16:00 -0000 To: Vladimir Prus Cc: gdb-patches@sources.redhat.com Subject: Re: RFC: MI - Detecting change of string contents with variable objects In-Reply-To: <200612220915.34288.ghost@cs.msu.su> References: <17797.65268.689590.797944@kahikatea.snap.net.nz> <17803.2404.969452.883622@kahikatea.snap.net.nz> <200612220915.34288.ghost@cs.msu.su> X-Mailer: VM 7.19 under Emacs 22.0.92.1 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-12/txt/msg00304.txt.bz2 > > Because -var-evaluate-expression uses varobj_get_value so they will always > > return the same value? > > Then, there are two solutions: We seem to be agree that the patch does the right thing and are just talking about implementation details. > 1. Make c_value_of_variable and friends accept struct value as opposed to > taking struct varobj. c_value_of_variable, as it's name implies, requires a struct varobj as it's argument. > 2. Extra the part of c_value_of_variable that you've based your function on > into a separate function. Make both c_value_of_variable and install_new_value > call the new function. value_get_print_value is quite a small function. After you've wrapped some statements in if clauses and worked out how to call them with a common argument, I can't see that you would gain much. > I'm not sure which approach you find better, but I don't think copy-pasting > is a solution to anything. Clearly it is *a* solution, it's just a question of whether it's the *best* solution in this case. Anyway, it's not a straight copy-paste (the asserts are removed, for example). I think if you look through the code you'll find numerous examples where one section of code is a slight variation of another. -- Nick http://www.inet.net.nz/~nickrob