diff options
author | Josh Stone <jistone@redhat.com> | 2009-09-10 17:06:11 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-09-10 17:06:11 -0700 |
commit | 729455a739d4755269f20b73d2db231db2a1fdd7 (patch) | |
tree | 8b09cc7f762877b2daa4cb2c436a67a283e8e9cd /dwflpp.h | |
parent | c9efa5c99498ccb3d2f0f87bc373da7dfd1cc067 (diff) | |
download | systemtap-steved-729455a739d4755269f20b73d2db231db2a1fdd7.tar.gz systemtap-steved-729455a739d4755269f20b73d2db231db2a1fdd7.tar.xz systemtap-steved-729455a739d4755269f20b73d2db231db2a1fdd7.zip |
PR10594 cont'd: Use parent die cache for variable lookup
Variable lookup is usually done through the scopes from dwarf_getscopes
at a particular pc. This requires an expensive traversal to find the
inner-most die containing the pc. For cases where that containing die
is known, e.g. at a particular function entry, we can do much better
with our die_parent_cache.
This may also help get more accurate variable scopes in cases where
multiple dies contain a pc and the innermost isn't what we're trying to
probe. For example, an inlined call chain of foo->bar->baz may all have
the same entry pc, but if the probe was on function("bar"), we would
want the variables in bar's scope, not baz's.
* dwflpp.h (struct dwflpp): Remove pc_cached_scopes, num_cached_scopes,
and cached_scopes, as they are now remembered by the caller.
* dwflpp.cxx (dwflpp::getscopes): New - the DIE version uses the parent
cache, and the pc version just defers to dwarf_getscopes.
(dwflpp::print_locals, literal_stmt_for_local): Take a scopes vector.
(dwflpp::find_variable_and_frame_base): Take a scopes vector from the
caller instead of computing it every time.
(dwflpp::dwarf_getscopes_cached): Removed.
* tapsets.cxx (dwarf_var_expanding_visitor::getscopes): New cached
lookup function which gets the scopes from the DIE if possible.
(dwarf_var_expanding_visitor::visit_target_symbol): Call getscopes.
Diffstat (limited to 'dwflpp.h')
-rw-r--r-- | dwflpp.h | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -208,6 +208,8 @@ struct dwflpp void * data); std::vector<Dwarf_Die> getscopes_die(Dwarf_Die* die); + std::vector<Dwarf_Die> getscopes(Dwarf_Die* die); + std::vector<Dwarf_Die> getscopes(Dwarf_Addr pc); Dwarf_Die *declaration_resolve(const char *name); @@ -253,7 +255,7 @@ struct dwflpp bool die_has_pc (Dwarf_Die & die, Dwarf_Addr pc); - std::string literal_stmt_for_local (Dwarf_Die *scope_die, + std::string literal_stmt_for_local (std::vector<Dwarf_Die>& scopes, Dwarf_Addr pc, std::string const & local, const target_symbol *e, @@ -302,6 +304,7 @@ private: mod_cu_die_parent_cache_t cu_die_parent_cache; void cache_die_parents(cu_die_parent_cache_t* parents, Dwarf_Die* die); + cu_die_parent_cache_t *get_die_parents(); /* The global alias cache is used to resolve any DIE found in a * module that is stubbed out with DW_AT_declaration with a defining @@ -328,10 +331,10 @@ private: static void loc2c_emit_address (void *arg, struct obstack *pool, Dwarf_Addr address); - void print_locals(Dwarf_Die *die, std::ostream &o); + void print_locals(std::vector<Dwarf_Die>& scopes, std::ostream &o); void print_members(Dwarf_Die *vardie, std::ostream &o); - Dwarf_Attribute *find_variable_and_frame_base (Dwarf_Die *scope_die, + Dwarf_Attribute *find_variable_and_frame_base (std::vector<Dwarf_Die>& scopes, Dwarf_Addr pc, std::string const & local, const target_symbol *e, @@ -385,11 +388,6 @@ private: void build_blacklist(); std::string get_blacklist_section(Dwarf_Addr addr); - Dwarf_Addr pc_cached_scopes; - int num_cached_scopes; - Dwarf_Die *cached_scopes; - int dwarf_getscopes_cached (Dwarf_Addr pc, Dwarf_Die **scopes); - // Returns the call frame address operations for the given program counter. Dwarf_Op *get_cfa_ops (Dwarf_Addr pc); |