Re: Fix breakpoints when several source files have the same name

Joel Brobecker
2009-10-01T21:45:16Z

Sebastien,

Do you have a copyright assignment on file with the FSF? I cannot
seem to be able to find you in our records, at least not by using
your name. If you don't, then I am afraid that we cannot accept this
contribution until you do. This is a bit of a lengthy process, so
let me know if you need the request forms.

> 2009-10-01 Sebastien Granjoux <seb.sfo@free.fr>
>
> PR mi/9583:
> * symtab.c (find_line_symtab, append_exact_match_to_sals):
> Use full filename if available

Overall, this looks OK to me (good catch on the FILENAME_CMP!).
I just have a few comments, little nits:

> + /* Get symbol full file name if possible */

All comments should be full sentences, meaning that they should start
with capital letter, and end with a period. The period should also
be followed by 2 spaces, so:

/* Get symbol full file name if possible. */

> + if ((symtab->fullname != NULL)
> + && (symtab_to_fullname (s) != NULL)
> + && (FILENAME_CMP (symtab->fullname, s->fullname) != 0))

You have unecessary parenthesis, and we avoid that in GDB (we find
that this makes the code harder to read - if only because it uses
a different style than usual).

if (symtab->fullname != NULL
&& symtab_to_fullname (s) != NULL
&& FILENAME_CMP (symtab->fullname, s->fullname) != 0)

> -append_exact_match_to_sals (char *filename, int lineno,
> +append_exact_match_to_sals (char *filename,
> + char *fullname, int lineno,
> struct symtabs_and_lines *ret,
> struct linetable_entry **best_item,
> struct symtab **best_symtab)

The function comment needs to be updated. Can you also put all first
3 arguments on the same line. The line break is unnecessary.

> + if ((fullname != NULL)
> + && (symtab_to_fullname (symtab) != NULL)
> + && (FILENAME_CMP (fullname, symtab->fullname) != 0))
> + continue;

Same as above with the extra parens.

--
Joel