This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix MI -symbol-list-lines
- From: Pedro Alves <palves at redhat dot com>
- To: Jason Richards <Jason_Richards at mentor dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 17 Oct 2012 19:37:36 +0100
- Subject: Re: [PATCH] Fix MI -symbol-list-lines
- References: <507EF5FC.6000907@mentor.com>
On 10/17/2012 07:16 PM, Jason Richards wrote:
> Please consider this patch, which fixes -symbol-list-lines in situations
> where a symbol table is only partially loaded and situations where more
> than one symbol table corresponds to a given file.
Unfortunately, the patch is bounced back, as it does a lot of unnecessary
(and unfortunately wrong, according to the GNU coding conventions)
reformatting.
Could you please send a more complete rationale on the change?
Maybe it gets a bit more obvious once the patch only includes the necessary
changes, but it's always good to include a more complete description of
what is wrong, and how the fix attempts to fix it.
Also, is this something that could have a regression test for?
No comments on the substance, just some minor comments below on some C mechanics:
> + ALL_PSPACE_SYMTABS (pspace, objfile, s) {
> + if (strlen(filename) && strlen(s->filename) &&
> + !strcmp(lbasename(filename), lbasename(s->filename))) {
- No need to compute the whole string's length to check whether it is empty.
- strcmp's result is not a boolean.
Thus:
if (*filename != '\0' && *s->filename != '\0'
&& strcmp (lbasename (filename), lbasename (s->filename)) == 0)
{
Also, it seems like we could cache lbasename(filename) instead of computing it
at each iteration.
--
Pedro Alves