diff options
author | Josh Stone <jistone@redhat.com> | 2009-07-29 14:34:32 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-07-29 14:34:32 -0700 |
commit | 9ace370f8b31f8c1e1b27c272f13f4322841d1a3 (patch) | |
tree | 7ade1c3fcd0fe7658c3c967d0c7436fde49a2053 | |
parent | 0a98fd42f87ef9217917931bd8a47e272a5664ce (diff) | |
download | systemtap-steved-9ace370f8b31f8c1e1b27c272f13f4322841d1a3.tar.gz systemtap-steved-9ace370f8b31f8c1e1b27c272f13f4322841d1a3.tar.xz systemtap-steved-9ace370f8b31f8c1e1b27c272f13f4322841d1a3.zip |
Enable variable listing (-L) for uprobes
All $target variables and their C-types are now printed in -L mode.
* tapsets.cxx (uprobe_derived_probe::uprobe_derived_probe): Save the local
arguments while we still have the dwflpp open.
(uprobe_derived_probe::saveargs): New
(uprobe_derived_probe::printargs): New
-rw-r--r-- | tapsets.cxx | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/tapsets.cxx b/tapsets.cxx index a93c2860..81fe3d0c 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -394,6 +394,10 @@ struct uprobe_derived_probe: public derived_probe Dwarf_Addr addr, bool return_p); + string args; + void saveargs(Dwarf_Die* scope_die); + void printargs(std::ostream &o) const; + void printsig (std::ostream &o) const; void join_group (systemtap_session& s); }; @@ -4100,6 +4104,10 @@ uprobe_derived_probe::uprobe_derived_probe (const string& function, } // else - null scope_die - $target variables will produce an error during translate phase + // Save the local variables for listing mode + if (q.sess.listing_mode_vars) + saveargs(scope_die); + // Reset the sole element of the "locations" vector as a // "reverse-engineered" form of the incoming (q.base_loc) probe // point. This allows a user to see what function / file / line @@ -4174,6 +4182,67 @@ uprobe_derived_probe::uprobe_derived_probe (probe *base, void +uprobe_derived_probe::saveargs(Dwarf_Die* scope_die) +{ + // same as dwarf_derived_probe::saveargs + + Dwarf_Die *scopes; + if (!null_die(scope_die) && dwarf_getscopes_die (scope_die, &scopes) == 0) + return; + auto_free free_scopes(scopes); + + stringstream argstream; + string type_name; + Dwarf_Attribute type_attr; + Dwarf_Die type_die; + + if (return_p && + dwarf_attr_integrate (scope_die, DW_AT_type, &type_attr) && + dwarf_formref_die (&type_attr, &type_die) && + dwarf_type_name(type_die, type_name)) + argstream << " $return:" << type_name; + + Dwarf_Die arg; + if (dwarf_child (&scopes[0], &arg) == 0) + do + { + switch (dwarf_tag (&arg)) + { + case DW_TAG_variable: + case DW_TAG_formal_parameter: + break; + + default: + continue; + } + + const char *arg_name = dwarf_diename (&arg); + if (!arg_name) + continue; + + type_name.clear(); + if (!dwarf_attr_integrate (&arg, DW_AT_type, &type_attr) || + !dwarf_formref_die (&type_attr, &type_die) || + !dwarf_type_name(type_die, type_name)) + continue; + + argstream << " $" << arg_name << ":" << type_name; + } + while (dwarf_siblingof (&arg, &arg) == 0); + + args = argstream.str(); +} + + +void +uprobe_derived_probe::printargs(std::ostream &o) const +{ + // same as dwarf_derived_probe::printargs + o << args; +} + + +void uprobe_derived_probe::printsig (ostream& o) const { // Same as dwarf_derived_probe. |