summaryrefslogtreecommitdiffstats
path: root/dwflpp.h
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-09-02 19:09:50 -0700
committerJosh Stone <jistone@redhat.com>2009-09-02 19:09:50 -0700
commitb74789646bfe59131327716357c8b7c1521fa14a (patch)
tree90647b22c781da3a38dc5be568ed846280b64193 /dwflpp.h
parent7a1921492e38221e1552b7698f001fa70d0e0e8b (diff)
downloadsystemtap-steved-b74789646bfe59131327716357c8b7c1521fa14a.tar.gz
systemtap-steved-b74789646bfe59131327716357c8b7c1521fa14a.tar.xz
systemtap-steved-b74789646bfe59131327716357c8b7c1521fa14a.zip
PR10572: Allow duplicate function names in a CU
We can't assume that a given function name will only appear once in a CU. In C++, two functions may have the same name in different classes or namespaces, or even in the same scope with overloaded parameters. Even in C, the compiler may generate multiple copies of a single function with different optimizations. We now use a multimap for function names, so we shouldn't miss any. * dwflpp.h (cu_type_cache_t, mod_cu_type_cache_t): New typedef to keep a normal map for the global_alias_cache. (cu_function_cache_t): Use a multimap for function names. * dwflpp.cxx (dwflpp::iterate_over_functions): Walk over the range of exactly-matching functions. * tapsets.cxx (query_dwarf_func): Don't abort after seeing an exact match -- there could be more to come.
Diffstat (limited to 'dwflpp.h')
-rw-r--r--dwflpp.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/dwflpp.h b/dwflpp.h
index 9ed18558..431f3c4b 100644
--- a/dwflpp.h
+++ b/dwflpp.h
@@ -47,8 +47,17 @@ enum info_status { info_unknown, info_present, info_absent };
// module -> cu die[]
typedef unordered_map<Dwarf*, std::vector<Dwarf_Die>*> module_cu_cache_t;
+// typename -> die
+typedef unordered_map<std::string, Dwarf_Die> cu_type_cache_t;
+
+// cu die -> (typename -> die)
+typedef unordered_map<void*, cu_type_cache_t*> mod_cu_type_cache_t;
+
// function -> die
-typedef unordered_map<std::string, Dwarf_Die> cu_function_cache_t;
+typedef unordered_multimap<std::string, Dwarf_Die> cu_function_cache_t;
+typedef std::pair<cu_function_cache_t::iterator,
+ cu_function_cache_t::iterator>
+ cu_function_cache_range_t;
// cu die -> (function -> die)
typedef unordered_map<void*, cu_function_cache_t*> mod_cu_function_cache_t;
@@ -293,7 +302,7 @@ private:
* cache is indexed by name. If other declaration lookups were
* added to it, it would have to be indexed by name and tag
*/
- mod_cu_function_cache_t global_alias_cache;
+ mod_cu_type_cache_t global_alias_cache;
static int global_alias_caching_callback(Dwarf_Die *die, void *arg);
int iterate_over_globals (int (* callback)(Dwarf_Die *, void *),
void * data);