[OB PATCH] Fix NULL pointer dereference
Pedro Alves
palves@redhat.com
Fri Feb 10 12:58:00 GMT 2017
On 02/10/2017 11:19 AM, Gary Benson wrote:
> Me too, I suppose, though that symtab.c is full of checks for it
> so I assumed it meant something. Maybe I was rash! Anyway, here's
> the backtrace:
>
> #0 0x00000000007271be in add_symtab_completions (cust=0x0, sym_text=0x7fffffffdb02 "si", sym_text_len=2, text=0x7fffffffdb02 "si", word=0x7fffffffdb02 "si",
> code=TYPE_CODE_UNDEF) at ../../src/gdb/symtab.c:5172
> #1 0x00000000007272cc in symtab_expansion_callback (symtab=0x0, user_data=0x7fffffffd7a0) at ../../src/gdb/symtab.c:5197
> #2 0x00000000006d959a in psym_expand_symtabs_matching (objfile=0x1717540, file_matcher=0x0, symbol_matcher=0x727144 <symbol_completion_matcher(char const*, void*)>,
> expansion_notify=0x72727c <symtab_expansion_callback(compunit_symtab*, void*)>, kind=ALL_DOMAIN, data=0x7fffffffd7a0) at ../../src/gdb/psymtab.c:1444
> #3 0x00000000007194c6 in expand_symtabs_matching (file_matcher=0x0, symbol_matcher=0x727144 <symbol_completion_matcher(char const*, void*)>,
> expansion_notify=0x72727c <symtab_expansion_callback(compunit_symtab*, void*)>, kind=ALL_DOMAIN, data=0x7fffffffd7a0) at ../../src/gdb/symfile.c:3897
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?
Thanks,
Pedro Alves
More information about the Gdb-patches
mailing list