This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Looking up non-function symbols
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: gdb at sources dot redhat dot com
- Date: Sat, 19 Jan 2002 10:36:46 -0500
- Subject: Looking up non-function symbols
A very interesting bug was reported to me today. Suppose you have a binary
containing at least two psymtabs. Also suppose that one of them has
code in multiple text sections, and .data is between the two sections in the
final executable. So what we have looks like this:
/----------------------\
| objfile A .text |
|----------------------|
| objfile B .text |
|----------------------|
| objfile A .data |
|----------------------|
| objfile B .data |
|----------------------|
| objfile A .text.init |
\----------------------/
Now suppose that I haven't read in symtabs yet, just psymtabs, and I type
'whatis varB' where varB is in objfile B's data. We go from
lookup_symbol_aux to find_pc_sect_symtab to find_pc_sect_psymtab.
This function loops, unfortunately, on pst->textlow and pst->texthigh!
That's all well and good if we're looking up a text symbol, but we aren't.
Normally this works because we never find a PST including this range; we
return NULL instead of a bogus PST; and we fall through to the loop below in
lookup_symbol_aux:778 (the loop over all psymtabs not yet read in).
Should we refuse to search for non-functions in find_pc_sect_symtab, or
should we be using some method which can handle data variables? I think the
former.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer