This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Issues with dwarf APIs
- From: Sharyathi Nagesh <sharyath at in dot ibm dot com>
- To: fche at elastic dot org, systemtap at sources dot redhat dot com
- Date: Tue, 02 Jun 2009 07:31:40 +0530
- Subject: Issues with dwarf APIs
Hi
We are facing some problem accessing debug information. We were
trying to implement a feature in crash so as to display local variable
information.
We observed that 2 APIs are failing:
1. dwarf_attr_integrate(variable_die, DW_AT_location, &Dwarf_attribute)
or at
2. dwarf_getlocation_addr(&Dwarf_attribute, addr, &expr,len,1)
addr: Is current Program counter with in the function boundaries ,
without the bias (all the time we are assuming bias to be zero we feel
it is a safe bet)
case 1: Is failing when the Dwarf_location section is not present
case 2: Is failing even when Dwarf_location Tab is present in the dwarf
information,
ex:
In function die for pseries_dedicated_idle_sleep (in ppc64)
readelf -wi vmlinux reads:
-------------------------------------
<2><385581>: Abbrev Number: 96 (DW_TAG_variable)
1520738 <385582> DW_AT_name : cpu
1520739 <385586> DW_AT_decl_file : 1
1520740 <385587> DW_AT_decl_line : 484
1520741 <385589> DW_AT_type : <0x378b77>
1520742 <38558d> DW_AT_location : 0x5f804 (location list)
-------------------------------------
Even with information of DW_AT_location we are not able to fetch the
location information and dwarf_getlocation_addr() fails, returns 0.
We are using elfutils-0.137 and above.
In this particular case gdb also fails to print cpu value and instead
says the value is optimized out.
We wanted to know if these results are as expected, we have fallowed
systemtap most of the time. We also observed that most of the time,
except the volatile variables, we are having difficulty printing the
variables.
Went through this link:
http://sources.redhat.com/systemtap/wiki/TipContextVariables
It looks like systemtap also has faced similar problems
This is the Psuedo-code what we have implemented:
print_variable (Takes 2 Dies function die and variable die)
{
/* Function DIE is got from PC */
/* Variable DIE got by going through the child DIEs */
dwarf_attr_integrate(var_die, DW_AT_location, Dwarf_Attribute)
dwarf_getlocation_addr(Dwarf_Attribute, Program_Counter,*);
/*It is failing in one of the above APIs
}
I can provide a more detailed code walk through, if wish to
Can you please help us with this
Thanks
Yeehaw