proposed fix for PR 114

Nick Clifton nickc@redhat.com
Wed May 26 12:17:00 GMT 2004


Hi Ben,

> I've prototyped a fix which slightly alters BFD's interface, adding a
> bfd_vma* parameter to bfd_find_nearest_line that returns the address
> of the next source line (where possible; otherwise it returns the
> requested address).

> This seems to have one flaw, however.  Sometimes, due to instruction
> reordering at higher optimisation levels, a source line B can begin at
> an address that lies between the start and end of source line A.  With
> my patch, that source line will not appear in the profile output.  I'm
> not quite sure how to handle this, nor am I sure if this would be
> considered catastrophic.

I think that it would be bad.  It would result in gprof generating bogus 
  line usage information which render its use as a profiling tool suspect.

The entire address to source line mapping procedure can be quite 
complex.  One address can map to multiple lines of source code and a 
single line of source code can occupy multiple, disjoint and overlapping 
address ranges.

If BFD were to provide an interface to obtain this information (which in 
theory is a good idea) then we ought to be careful and make sure that as 
much information is returned as possible.

Cheers
   Nick



More information about the Binutils mailing list