[Dwarf-discuss] Question on loclist
Jun Koi
junkoi2004
Thu Oct 5 10:11:47 GMT 2006
Hi,
Thank you all for great replies on my last question. I am quite new to
the Dwarf spec, so have quite a few newbie questions :-)
I am working on Linux, and trying to investigate kernel at run-time.
Like everybody else, I use gcc to compile Linux kernel. I have another
question regarding loclist, and appreciate your kind helps.
In kernel 2.6.16.29, file fs/namei.c, we have the code like this:
...
static long do_rmdir(int dfd, const char __user *pathname)
{
int error = 0;
char * name;
struct dentry *dentry;
struct nameidata nd;
name = getname(pathname);
if(IS_ERR(name))
return PTR_ERR(name);
error = do_path_lookup(dfd, name, LOOKUP_PARENT, &nd);
if (error)
goto exit;
....
I compiled kernel with debug info option, and use dwarfdump to extract
information out. Then I got something corresponding to the above code:
...
DW_AT_name do_rmdir
DW_AT_decl_file 1 fs/namei.c
DW_AT_decl_line 1988
DW_AT_prototyped yes(1)
DW_AT_type <193>
DW_AT_low_pc 0xc01617a0
DW_AT_high_pc 0xc0161873
DW_AT_frame_base DW_OP_reg5
<2><41023> DW_TAG_formal_parameter
DW_AT_name dfd
DW_AT_decl_file 1 fs/namei.c
DW_AT_decl_line 1987
DW_AT_type <49>
DW_AT_location <loclist with 3 entries follows>
[ 0]<lowpc=0x2e00><highpc=0x2e19>DW_OP_reg0
[ 1]<lowpc=0x2e19><highpc=0x2e3f>DW_OP_reg3
[ 2]<lowpc=0x2ec4><highpc=0x2ec7>DW_OP_reg3
<2><41039> DW_TAG_formal_parameter
DW_AT_name pathname
DW_AT_decl_file 1 fs/namei.c
DW_AT_decl_line 1987
DW_AT_type <64>
DW_AT_location <loclist with 1 entries follows>
[ 0]<lowpc=0x2e00><highpc=0x2e19>DW_OP_reg2
<2><41055> DW_TAG_variable
DW_AT_name error
DW_AT_decl_file 1 fs/namei.c
DW_AT_decl_line 1989
DW_AT_type <49>
DW_AT_location <loclist with 3 entries follows>
[ 0]<lowpc=0x2e3b><highpc=0x2e3d>DW_OP_reg0
[ 1]<lowpc=0x2e3f><highpc=0x2e53>DW_OP_reg3
[ 2]<lowpc=0x2e7a><highpc=0x2ec7>DW_OP_reg3
<2><41071> DW_TAG_variable
DW_AT_name name
DW_AT_decl_file 1 fs/namei.c
DW_AT_decl_line 1990
DW_AT_type <82>
DW_AT_location <loclist with 2 entries follows>
[ 0]<lowpc=0x2e1b><highpc=0x2eca>DW_OP_reg6
[ 1]<lowpc=0x2ecf><highpc=0x2ed3>DW_OP_reg6
.....
I have few questions:
1) Why the location of variable "name" is not made with plain location
expression (like DW_OP_breg5...), but loclist?
2) Why location of "name" consists of 2 entries?The 2nd entry
"[1]<lowpc=0x2ecf><highpc=0x2ed3>DW_OP_reg6" makes more sense to me,
as the range is exactly 4bytes, and name is in fact a pointer of 4
bytes.
But how about the 1st entry? What is its meaning?
3) Most important question to my project: in the case like above, how
to determine the run-time address of "name"? (Suppose that I can have
value of all the registers - I am on x86)
I read through the Dwarf2 spec many times, but still very confused here :-(
Thank you a lot,
Jun
More information about the Dwarf-discuss
mailing list