This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [OB PATCH] Fix NULL pointer dereference
Pedro Alves wrote:
> So we reach this call of the 'expansion_notify' function pointer:
>
> if (recursively_search_psymtabs (ps, objfile, kind, symbol_matcher, data))
> {
> struct compunit_symtab *symtab =
> psymtab_to_symtab (objfile, ps);
>
> if (expansion_notify != NULL)
> expansion_notify (symtab, data);
> }
> }
>
> So why can recursively_search_psymtabs find a matching partial
> symbol and thus return true, and then psymtab_to_symtab returns
> NULL, indicating the symtab is empty? That sounds like a bug?
So the first time psymtab_to_symtab returns NULL, ps->filename is
"src/basic/string-util.h"; the only string-util.h on my system is
/usr/src/debug/systemd-231/src/basic/string-util.h from
systemd-debuginfo-231-10.fc25.x86_64 so I'm assuming it's that.
But, recursively_search_psymtabs is returning 1 not for that psymtab
but for one of its dependencies (the first, as it happens). That has
no filename, and its user->filename is "<artificial>". So
recursively_search_psymtabs is saying string-util.h matches because
it matches because of some (shared?) symbol table it references, but
psymtab_to_symtab is being called on the string-util.h psymtab which
doesn't match (or exist?!)
I have no idea what I'm looking at here :(
Thanks,
Gary
--
http://gbenson.net/