This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] objc-lang.c (selectors_info): Check strchr for null result.
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Michael Snyder <msnyder at vmware dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Mon, 7 Mar 2011 14:38:37 +0400
- Subject: Re: [RFA] objc-lang.c (selectors_info): Check strchr for null result.
- References: <4D717F81.6060906@vmware.com>
> 2011-03-04 Michael Snyder <msnyder@msnyder-server.eng.vmware.com>
>
> * objc-lang.c (selectors_info): Check strchr for null result.
Another one where I'm not a specialist of the code, but I think
I get the intent of the code.
> /* Find selector part. */
> name = (char *) strchr(name+2, ' ');
> + if (name == NULL)
> + internal_error (__FILE__, __LINE__,
> + _("Bad method name '%s'"),
> + SYMBOL_NATURAL_NAME (msymbol));
I think that the right thing to do, in this case, is to emit
a complaint. The most probable way to trigger this problem
is by reading some invalid debugging information, and an
internal-error in this case would be mis-leading. And we can
also recover nicely from it by simply ignoring the symbol.
--
Joel