From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23122 invoked by alias); 8 Feb 2007 22:19:09 -0000 Received: (qmail 23108 invoked by uid 22791); 8 Feb 2007 22:19:07 -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; Thu, 08 Feb 2007 22:19:01 +0000 Received: from kahikatea.snap.net.nz (145.62.255.123.dynamic.snap.net.nz [123.255.62.145]) by viper.snap.net.nz (Postfix) with ESMTP id 0944F3D987B; Fri, 9 Feb 2007 11:18:58 +1300 (NZDT) Received: by kahikatea.snap.net.nz (Postfix, from userid 500) id 4927E4F71B; Fri, 9 Feb 2007 11:18:55 +1300 (NZDT) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17867.41420.663991.707406@kahikatea.snap.net.nz> Date: Thu, 08 Feb 2007 22:19:00 -0000 To: Daniel Jacobowitz Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Catch errors in value_get_print_value In-Reply-To: <20070208174131.GC13544@nevyn.them.org> References: <17858.21211.33629.685339@kahikatea.snap.net.nz> <20070208174131.GC13544@nevyn.them.org> X-Mailer: VM 7.19 under Emacs 22.0.93.8 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: 2007-02/txt/msg00108.txt.bz2 > > Currently when common_val_print throws an error from install_new_value it gets > > caught in mi_execute_command and prints an MI error (^error,...) without > > cleaning up. This patch catches the error in value_get_print_value so that GDB > > can proceed normally. It could be adapted to output something like > > "" but I think the empty string works better. > > Could you explain why? I would be confused to see an empty value in > my locals window. That's separate from this bug though. It's much quieter than a window full of error/warning messages. If there's no value available, the frontend doesn't show one. That seems logical to me but perhaps only because I'm used to it. > > ! TRY_CATCH (except, RETURN_MASK_ERROR) > > ! { > > ! common_val_print (value, stb, format_code[(int) format], 1, 0, 0); > > ! } > > ! > > val_print, called by common_val_print, already has code to catch this > error and prettyprint it. Yes but I think the error is in value_contents_all. It's the only way that I can catch it in varobj.c. ... > So I checked this in instead. Let me know if it doesn't work for you. > > -- > Daniel Jacobowitz > CodeSourcery > > 2007-02-08 Daniel Jacobowitz > > * varobj.c (install_new_value): Only call value_get_print_value > if changeable. > > Index: varobj.c > =================================================================== > RCS file: /cvs/src/src/gdb/varobj.c,v > retrieving revision 1.82 > diff -u -p -r1.82 varobj.c > --- varobj.c 24 Jan 2007 19:54:13 -0000 1.82 > +++ varobj.c 8 Feb 2007 17:38:36 -0000 > @@ -953,7 +953,7 @@ install_new_value (struct varobj *var, s > /* 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 > to compare with. */ > - if (initial) > + if (initial && changeable) > var->print_value = value_get_print_value (value, var->format); > else if (changeable) > { Thanks. This is clearly a better patch as it's much simpler. Thinking more generally, I wonder if there are other cases where value_contents_all should catch this error? -- Nick http://www.inet.net.nz/~nickrob