This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


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

Re: coffgen.c:coff_find_nearest_line ?


"Mark E." <snowball3@bigfoot.com> writes:

> > In coffgen.c, coff_find_nearest_line, some code has been added to use dwarf2
> > to find line numbers.  The logic looks wrong.  Here is the code snippet from
> > sources cvs ver 1.17
> 
> I think I can explain your confusion.
> 
> >   if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
> 
> This function returns false when it does find debug info. That's why there is 
> a '!'.
> 
> >       if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
> 
> And this function returns true when it does find debug info. That's why no 
> '!'.
> 
> > It looks like if the stab passes, its effect is wiped out by the call the
> > dwarf2.  If stab fails, dwarf2 isn't given a chance.
> 
> It does look that way, but the code is correct because of the 
> opposite meanings of the return value.

That does not make much sense, and if it were true it could only be
described as a bug.

However, when I look at _bfd_stab_section_find_nearest_line, I think
it returns false on error, or true on non-error.  Whether it found any
debugging information is determined, if it returned true, by whether
*pfound was set.

Ian

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