This is the mail archive of the
mailing list for the GDB project.
Re: RFC: partial symbol table address range generalization
- To: Daniel Jacobowitz <drow at mvista dot com>
- Subject: Re: RFC: partial symbol table address range generalization
- From: Jim Blandy <jimb at zwingli dot cygnus dot com>
- Date: 01 Nov 2001 17:29:53 -0500
- Cc: gdb-patches at sources dot redhat dot com
- References: <20011023233450.09F855E9D8@zwingli.cygnus.com><20011023195430.A15242@nevyn.them.org><email@example.com><20011024004201.A22007@nevyn.them.org><firstname.lastname@example.org><20011024203917.A6297@nevyn.them.org>
Daniel Jacobowitz <email@example.com> writes:
> But that isn't really my point. What the code in question
> (find_pc_sect_line) does is:
> /* Find the source file and line number for a given PC value and SECTION.
> Return a structure containing a symtab pointer, a line number,
> and a pc range for the entire source line.
> If we don't know what function we're in, then it isn't just that we can
> not trust the address range data; we know absolutely that we will not
> find a valid line number. I'm pretty sure that find_pc_function can
> fail in reasonable ways; in trampolines, for instance. It may well be
> that we won't reach find_pc_sect_line in any of those cases, ideally,
> but I'm not convinced of that.
> I'd prefer to both work hard to fill the symtabs with reliable data and
> also sprinkle sanity checks where they clearly seem to be needed.
I've been using words badly.
A heuristic is some computational process which is expected to yield
correct answers most of the time, but not always. Heuristics need to
be used with code that can check their answers, or in contexts where
inaccuracy is tolerable.
Daniel's suggested change isn't a heuristic; I agree that, if you
can't find a function containing the PC, it's almost certainly
pointless to look for line number info for that PC.
What irks me is that Daniel's change is a sanity check for the
procedure of searching through psymtabs' address ranges. In other
words, the necessity of the change suggests that searching psymtabs'
address ranges is the heuristic here. I really hate that. Those
ranges really ought to be accurate.
But the fact is, they're not accurate, and it'll take a lot of work to
make them so. Checking that a PC falls in a psymtab's address range
is, indeed, only a heuristic.
So I'm going to commit Peter Schauer's change, as Daniel suggested.
Sorry for taking so long to come around.