From f09d0d1e7fd437f6a3b8c21e4817de8af458c888 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 15 Sep 2009 18:15:20 -0700 Subject: Remove function comparison from label iteration We already have filtered functions and inlines, so just iterate in each of those to look for labels. * dwflpp.cxx (dwflpp::iterate_over_labels): Assume that the die we're looking at is already a matching function, and don't descend into inlined functions in this body. * tapsets.cxx (query_srcfile_label): Iterate through inlines too. (query_cu): Iterate over functions and inlines instead of the CU. --- dwflpp.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'dwflpp.h') diff --git a/dwflpp.h b/dwflpp.h index d379b265..ab2ffe25 100644 --- a/dwflpp.h +++ b/dwflpp.h @@ -230,7 +230,7 @@ struct dwflpp void iterate_over_labels (Dwarf_Die *begin_die, const std::string& sym, - const std::string& symfunction, + const std::string& function, dwarf_query *q, void (* callback)(const std::string &, const char *, @@ -238,8 +238,7 @@ struct dwflpp int, Dwarf_Die *, Dwarf_Addr, - dwarf_query *), - const std::string& current_function); + dwarf_query *)); void collect_srcfiles_matching (std::string const & pattern, std::set & filtered_srcfiles); -- cgit From 04ddd303348c0ffb71c6f57eacb2282bd1d61b3a Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 16 Sep 2009 17:38:53 -0700 Subject: Remove the unused function_name_final_match * dwflpp.cxx (dwflpp::function_name_final_match): Removed. --- dwflpp.h | 1 - 1 file changed, 1 deletion(-) (limited to 'dwflpp.h') diff --git a/dwflpp.h b/dwflpp.h index ab2ffe25..87bd6eba 100644 --- a/dwflpp.h +++ b/dwflpp.h @@ -192,7 +192,6 @@ struct dwflpp bool function_name_matches_pattern(const std::string& name, const std::string& pattern); bool function_name_matches(const std::string& pattern); - bool function_name_final_match(const std::string& pattern); void iterate_over_modules(int (* callback)(Dwfl_Module *, void **, const char *, Dwarf_Addr, -- cgit From 7d6d0afc24b43829511f3f1d0aeff0fefff56b54 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 16 Sep 2009 19:38:20 -0700 Subject: PR10461: Match C++ scopes for namespaces and classes The function spec for dwarf probes now supports scopes, so you can limit the probes to specific namespaces or classes. Multiple scopes can be specified, and they will be matched progressively outward. probe process("foo").function("std::vector<*>::*") { ... } probe process("foo").function("::global_function") { ... } * dwflpp.cxx (dwflpp::get_parent_scope): New, finds the containing scopes of the specified DIE. (dwflpp::function_scope_matches): New, checks that the scopes containing the function all match the given scope patterns. * tapsets.cxx (dwarf_query::parse_function_spec): Rewrite, now handles multiple scope separators too. (query_dwarf_func): Check that the functions scopes match. --- dwflpp.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'dwflpp.h') diff --git a/dwflpp.h b/dwflpp.h index 87bd6eba..5f04d824 100644 --- a/dwflpp.h +++ b/dwflpp.h @@ -192,6 +192,7 @@ struct dwflpp bool function_name_matches_pattern(const std::string& name, const std::string& pattern); bool function_name_matches(const std::string& pattern); + bool function_scope_matches(const std::vector scopes); void iterate_over_modules(int (* callback)(Dwfl_Module *, void **, const char *, Dwarf_Addr, @@ -304,6 +305,8 @@ private: void cache_die_parents(cu_die_parent_cache_t* parents, Dwarf_Die* die); cu_die_parent_cache_t *get_die_parents(); + Dwarf_Die* get_parent_scope(Dwarf_Die* die); + /* 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 * DIE found in a different module. The current assumption is that -- cgit