This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [OB PATCH] Fix NULL pointer dereference


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]