This is the mail archive of the
mailing list for the GDB project.
RE: decode_variable's use of not_found_ptr
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'Greg Law'" <greglaw at greglaw dot net>, <gdb at sourceware dot org>
- Date: Sat, 22 Apr 2006 13:23:44 +0100
- Subject: RE: decode_variable's use of not_found_ptr
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
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.
Can't think of a witty .sigline today....