[Dwarf-Discuss] [Query] Address Space resolution in Dwarf

Prerna Saxena prerna@linux.vnet.ibm.com
Thu Jan 22 10:40:58 GMT 2009


Hi,
I've been trying to enable the systemtap translator to throw a warning 
when a userspace variable (annotated with "_user") is probed in context 
of a kernel function. ( 
http://sources.redhat.com/bugzilla/show_bug.cgi?id=9775 )

I'm using readelf  to look up the Dwarf location information for the 
parameters of the kernel function "sys_open",
[asmlinkage long sys_open(const char __user *filename, int flags, int 
mode)]

Here's an excerpt of the *.debug_info* section :
<1><944fa4>: Abbrev Number: 73 (DW_TAG_subprogram)
    <944fa5>   DW_AT_external    : 1
    <944fa6>   DW_AT_name        : (indirect string, offset: 0x3b7d0): 
sys_open
    <944faa>   DW_AT_decl_file   : 1
    <944fab>   DW_AT_decl_line   : 1062
    <944fad>   DW_AT_prototyped  : 1
    <944fae>   DW_AT_type        : <0x93965e>
    <944fb2>   DW_AT_low_pc      : 0xc0480c89
    <944fb6>   DW_AT_high_pc     : 0xc0480caf
   * <944fba>   DW_AT_frame_base  : 0xbede4      (location list)*
    <944fbe>   DW_AT_sibling     : <0x945000>
 <2><944fc2>: Abbrev Number: 79 (DW_TAG_formal_parameter)
    <944fc3>   DW_AT_name        : (indirect string, offset: 0x4cf2f): 
filename
    <944fc7>   DW_AT_decl_file   : 1
    <944fc8>   DW_AT_decl_line   : 1061
    <944fca>   DW_AT_type        : <0x939a39>
    <944fce>   DW_AT_location    : 2 byte block: 91 0   (DW_OP_fbreg: 0)
 <2><944fd1>: Abbrev Number: 79 (DW_TAG_formal_parameter)
    <944fd2>   DW_AT_name        : (indirect string, offset: 0xc00f2): flags
    <944fd6>   DW_AT_decl_file   : 1
    <944fd7>   DW_AT_decl_line   : 1061
    <944fd9>   DW_AT_type        : <0x93963a>
    <944fdd>   DW_AT_location    : 2 byte block: 91 4   (DW_OP_fbreg: 4)
 <2><944fe0>: Abbrev Number: 79 (DW_TAG_formal_parameter)
    <944fe1>   DW_AT_name        : (indirect string, offset: 0x9243): mode
    <944fe5>   DW_AT_decl_file   : 1
    <944fe6>   DW_AT_decl_line   : 1061
    <944fe8>   DW_AT_type        : <0x93963a>
    <944fec>   DW_AT_location    : 2 byte block: 91 8   (DW_OP_fbreg: 8)

The location attributes for  all parameters appear on the location list 
[*.debug_loc section*] as follows :

    000bede4     c0480c89     c0480c8a     (DW_OP_breg4: 4)
    000bede4     c0480c8a     c0480c91     (DW_OP_breg4: 8)
    000bede4     c0480c91     c0480caf      (DW_OP_breg5: 8)
    000bede4     <End of list>

How does Dwarf encode that the address specified in the location 
expression for "char  *filename" belongs to user address space ?

-- 
Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India 





More information about the Dwarf-discuss mailing list