Why mips32 addr2line doesn't work

Paul Koning pkoning@equallogic.com
Thu Jul 7 21:57:00 GMT 2005


Addr2line works by taking the supplied address and finding a matching
section (using bfd_get_section_vma).  On mips32, that returns a 64 bit
address, sign extended of course as required by MIPS.

So to lookup a kernel address, I have to pass the adress with ffffffff
prefixed to it, to extend it to 64 bits, otherwise the section isn't
found.  That's odd given that this isn't how addresses are displayed
for 32 bit MIPS images -- for example, "nm" shows only the 32 bit
values, not the 64 bit sign-extended values.

Once I get past that step in the program, the next step is to look
through the compilation units for a match in the function and line
number tables.

Guess what?  Those have 32 bit addresses in them, and they are NOT
sign extended.  So no match can ever be found.

If I pass the 32-bit address without the sign extend, then the 64 bit
section address check fails, because that one DOES have sign extended
addresses. 

I get the feeling that this whole thing is quite thoroughly broken,
with addresses sign-extended (as required) in a few spots, and
zero-extended in many others.  Admittedly it's rather weird to treat
addresses as signed, but that IS the MIPS rule.

I'm tempted to hack bdf-in.h to make bfd_vma a signed long long...

Any suggestions?  Are there any easy fixes that come to mind or is
this going to take wholesale surgery?

     paul



More information about the Binutils mailing list