[Dwarf-discuss] Incorrect dwarf information?

Michael Eager eager
Fri Feb 2 14:22:40 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:
> 
> static ssize_t tty_read(struct file *, char __user *, size_t, loff_t *);
> 
> And dwardump returns the below information:
> 
> ..............
> <1><42653>      DW_TAG_subprogram
>                 DW_AT_sibling               <42825>
>                 DW_AT_name                  tty_read
>                 DW_AT_decl_file             1 drivers/char/tty_io.c
>                 DW_AT_decl_line             1269
>                 DW_AT_prototyped            yes(1)
>                 DW_AT_type                  <635>
>                 DW_AT_low_pc                0xc0200950
>                 DW_AT_high_pc               0xc0200a14
>                 DW_AT_frame_base            DW_OP_reg5
> <2><42680>      DW_TAG_formal_parameter
>                 DW_AT_name                  file
>                 DW_AT_decl_file             1 drivers/char/tty_io.c
>                 DW_AT_decl_line             1267
>                 DW_AT_type                  <11014>
>                 DW_AT_location              <loclist with 4 entries follows>
>                         [ 0]<lowpc=0xc0200950><highpc=0xc0200983>DW_OP_fbreg 8
>                         [ 1]<lowpc=0xc0200983><highpc=0xc0200993>DW_OP_reg6
>                         [ 2]<lowpc=0xc0200993><highpc=0xc0200998>DW_OP_fbreg 8
>                         [ 3]<lowpc=0xc0200998><highpc=0xc0200a14>DW_OP_reg6
> <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?

Jun --

This mailing list is for questions about the DWARF specification.

Questions about whether GCC (or any other compiler) has an error
in its implementation should be directed to the compiler mailing
list.  In your case, this is gcc at gcc.gnu.org.

-- 
Michael Eager	 eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077





More information about the Dwarf-discuss mailing list