This is the mail archive of the gdb-patches@sources.redhat.com 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]

Re: RFC: partial symbol table address range generalization



Daniel Jacobowitz <drow@mvista.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.


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