From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8013 invoked by alias); 22 Apr 2006 16:32:38 -0000 Received: (qmail 8003 invoked by uid 22791); 22 Apr 2006 16:32:37 -0000 X-Spam-Check-By: sourceware.org Received: from astro.systems.pipex.net (HELO astro.systems.pipex.net) (62.241.163.6) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 22 Apr 2006 16:32:35 +0000 Received: from [192.168.123.100] (81-86-64-188.dsl.pipex.com [81.86.64.188]) by astro.systems.pipex.net (Postfix) with ESMTP id 5FBC8E00012A for ; Sat, 22 Apr 2006 17:32:32 +0100 (BST) Message-ID: <444A5AD3.5020201@greglaw.net> Date: Sat, 22 Apr 2006 21:36:00 -0000 From: Greg Law User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) MIME-Version: 1.0 Cc: gdb@sourceware.org Subject: Re: decode_variable's use of not_found_ptr References: <02e201c66607$98e13ca0$a501a8c0@CAM.ARTIMI.COM> In-Reply-To: <02e201c66607$98e13ca0$a501a8c0@CAM.ARTIMI.COM> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-04/txt/msg00290.txt.bz2 Dave Korn wrote: > On 22 April 2006 09:06, Greg Law wrote: > > > >> but at the bottom of the function it says: >> >> >> if (not_found_ptr) >> *not_found_ptr = 1; >> throw_error (NOT_FOUND_ERROR, _("Function \"%s\" not defined."), copy); >> >> >> Now, I must confess gdb's internal exception mechanism is deeply >> mysterious to me, but that code looks to me like it doesn't do what the >> comment claims. i.e. if not_found_ptr is non-NULL, it still issues the >> error message. >> >> What's wrong - my reading of the code, or the code? > > > > Well, the code doesn't do what the comment says, that's true. You can try > putting an 'else' between those lines, but don't forget that you'll now have > to add a return statement for when the error isn't thrown, and you'll have to > return NULL since the lookup has failed, and there may be some call sites that > aren't expecting to receive a NULL return because they've never had to before > because the error was previously always being thrown, so there may be knock-on > effects.... Can't return NULL as the function returns a structure by copy. > > You could also try looking at the history of the file in CVS, see if that > comment was ever accurate; it's the sort of error that can easily creep in > during minor code tidyups. Had a quick look at 6.3's code, and that is indeed different: if (not_found_ptr) { *not_found_ptr = 1; /* The caller has indicated that it wishes quiet notification of any error where the function or file is not found. A call to error_silent causes an error to occur, but it does not issue the supplied message. The message can be manually output by the caller, if desired. This is used, for example, when attempting to set breakpoints for functions in shared libraries that have not yet been loaded. */ error_silent ("Function \"%s\" not defined.", copy); } For some reason the error_silent seems to have got chopped in version 6.4. I'll submit a problem report. g