[Dwarf-discuss] Incorrect dwarf information?

David Anderson davea42
Fri Feb 2 23:41:07 GMT 2007


Jun Koi wrote:
> Hello,
>
> I am using dwarfdump to analyze the Linux kernel compiled with gcc. A
> function named tty_read() has prototype like below:
>   
...
> <2><42696>      DW_TAG_formal_parameter
>                 DW_AT_name                  buf
>                 DW_AT_decl_file             1 drivers/char/tty_io.c
>                 DW_AT_decl_line             1267
>                 DW_AT_type                  <258>
>                 DW_AT_location              DW_OP_reg0
> ........
>
> >From what returned by dwarfdump, the function param "buf" can be
> accessed via EAX (DW_OP_reg0). However, this is incorrect, as I looked
> at the disassembly code of the function. In fact, "buf" can be
> accessed via EBP (EBP+12) within the function.
>
> Anybody is aware of the problem of inaccuracy of dwarfdump? Is this
> the problem of dwarfdump, or of gcc? Any hint on how to fix the
> problem?
>   
There's no evidence  here that dwarfdump is incorrect.
Just evidence you are surprised by what gcc emitted.

Unless the data after

DW_AT_location              DW_OP_reg0

looks seriously corrupted in the dwarfdump output I would think
dwarfdump is printing the correct information.    That is, it is printing
what gcc emitted.  In the past serious errors/omissions in 
dwarfdump/libdwarf
have lead to obvious junk in the output and/or incomplete output.


This a topic for me, not for the dwarf list(s).
Feel free to contact me directly.

David Anderson. libdwarf/dwarfdump maintainer





More information about the Dwarf-discuss mailing list