public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Issues with dwarf APIs
@ 2009-06-02  5:10 Sharyathi Nagesh
  2009-06-02 13:02 ` Frank Ch. Eigler
  2009-06-02 22:58 ` Roland McGrath
  0 siblings, 2 replies; 5+ messages in thread
From: Sharyathi Nagesh @ 2009-06-02  5:10 UTC (permalink / raw)
  To: fche, systemtap

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-06-03 21:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-02  5:10 Issues with dwarf APIs Sharyathi Nagesh
2009-06-02 13:02 ` Frank Ch. Eigler
2009-06-02 22:58 ` Roland McGrath
2009-06-03 21:13   ` Sharyathi Nagesh
2009-06-03 21:21     ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).