objdump, 64-bit objects and Solaris kernel modules
Gabriel Marin
mgabi@rice.edu
Sat Feb 8 19:05:00 GMT 2003
Hi Nick, Steve
>First step - download the latest binutils release (2.13.2) or the
>latest CVS sources. It is possible that the problem has already been
>fixed.
>
This problem exists for at least one year, when I noticed it first time.
It is not solved by the latest version.
>I'm willing to help debug this problem, but I'll need some pointers
>on where to start.
>
>
>
>Have a look at binutils/objdump.c:show_line(). This is the function
>that should display the source lines. The problem, however is most
>likely to be with the function: bfd_find_nearest_line(). This is
>vectored function whoes actual code depends upon the target you are
>using, and the file formats and debug formats that it uses. I do not
>know which debug format the Forte Developer package uses, but it is
>probably generating ELF format binaries using either the DWARF or
>STABS debug formats. So have a look at
>bfd/elf.c:_bfd_elf_find_nearest_line() and follow the code from there.
>
You are right. The problem is in bfd_find_nearest_line. Hence, addr2line
cannot find the correct file and line number either.
The problem is not limited at 64-bit binaries. I had this problem with
32-bit binaries.
I just tried to solve it about 10 days ago and the problem is indeed in
_bfd_stab_section_find_nearest_line() in syms.c. Stabs is the debug
format used by the Sun Forte compiler.
The stab section contains a mix of debug info: N_SO (for files), N_FUN
(for routines), N_SLINE (for line info in text segment).
The code in _bfd_stab_section_find_nearest_line() expects to find the
absolute start address of the routine in the value field for N_FUN
entries. But the Sun compiler does not generate this value so it is
always zero. What I did was to search for the routine symbols in the
symbol table and compute their absolute start address from there.
More comments are in the patch that I attached. It is generated against
the cvs repository on 02/07/2003.
Gabriel
>
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.syms.c
URL: <https://sourceware.org/pipermail/binutils/attachments/20030208/ef330702/attachment.c>
More information about the Binutils
mailing list