[Dwarf-discuss] address of variable out of range of its function?
Jun Koi
junkoi2004
Sun Oct 8 17:38:28 GMT 2006
Hi,
I use the latest dwarfdump (0925) and dump out the Linux kernel. Here
is what I cannot understand: I saw a variable but its loclist is out
of range of its function. So in that case, how can we access it? I
banged the below bug for whole day, but about to give up now.
Here is the function:
static long do_unlinkat(int dfd, const char __user *pathname)
{
int error = 0;
char * name;
struct dentry *dentry;
struct nameidata nd;
struct inode *inode = NULL;
name = getname(pathname);
if(IS_ERR(name))
return PTR_ERR(name);
error = do_path_lookup(dfd, name, LOOKUP_PARENT, &nd);
if (error)
goto exit;
........
Dwarfdump gave me something like below:
<1><40747> DW_TAG_subprogram
DW_AT_sibling <40953>
DW_AT_name do_unlinkat
DW_AT_decl_file 1 fs/namei.c
DW_AT_decl_line 2070
DW_AT_prototyped yes(1)
DW_AT_type <193>
DW_AT_low_pc 0xc0161640
DW_AT_high_pc 0xc0161782
DW_AT_frame_base DW_OP_reg5
<2><40822> DW_TAG_variable
DW_AT_name name
DW_AT_decl_file 1 fs/namei.c
DW_AT_decl_line 2072
DW_AT_type <82>
DW_AT_location <loclist with 1 entries follows>
[ 0]<lowpc=0x2ccd><highpc=0x2cd7>DW_OP_reg2
As you see, variable "name" has only 1 loclist entry, and can be
accessed only via reg2.
However, while the function do_unlinkat() ranges in [0xc0161640,
0xc0161782], the variable "name" within the function can only be
accessed if the PC is within [0xc0161640 + 0x2ccd, 0xc0161640 +
0x2cd7] == [0xc0164317, 0xc016430d], which is way out of the range of
the do_unlinkat() function (??). That means there is no way to access
to it from within function (??)
No surprise that I could not access the "name" variable using the reg2
within the function (I tried to get to it with reg2, but got only the
incorrect data).
So what is wrong here? How can I interprete the address of variable
"name" in this case?
Thank you a lot,
Jun
More information about the Dwarf-discuss
mailing list