[Dwarf-discuss] DW_OP_bregx access?

Jun Koi junkoi2004
Fri Oct 6 18:32:54 GMT 2006


Hi,

I am having problem with accessing DW_OP_breg5 on Linux kernel. The
problem is with the vfs_read() function in fs/read_write.c


ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
{
....
}


According to debug_info, we have information about the "buf" param in
the above function like below:


      <2><29552>      DW_TAG_formal_parameter
          DW_AT_name                  buf
          DW_AT_decl_file             1 fs/read_write.c
          DW_AT_decl_line             247
          DW_AT_type                  <555>
          DW_AT_location              DW_OP_breg5+12


So it seems that we can access to "buf" by accessing the memory at the
address (EBP+12) (because breg5 == EBP in gcc)

Then I tried to copy the data from "buf" to other area, ie. something like this

memcpy(myarray, (char *)(EBP+12), number);

But to my surprise, everytime I did this, I got the same data in
"myarray". In fact the data must be different, because each time I
feeded the read syscall (ie. feed vfs_read()) different data.

I am stuck here. Probably I interpreted the way to use breg5+12 in a wrong way?


Thank you lots.
Jun





More information about the Dwarf-discuss mailing list