[PATCH v3 1/2] systemtap/tapsets.cxx: Adjusted for multiple static functions
Frank Ch. Eigler
fche@redhat.com
Wed Apr 8 15:50:00 GMT 2015
mjw wrote:
> [...]
>> // TODO: Use a multimap in case there are multiple static
>> // functions with the same name?
>> map_by_addr.insert(make_pair(addr, fi));
>
> But map_by_addr is already a multimap as introduced in commit 1c6b77
> PR10327: resolve symbol aliases to dwarf functions by Josh. [...]
> Since map_by_addr is using a multimap I was wondering if map_by_name
> should also be a multimap instead of a map to a list? Do you happen to
> know the advantages/disadvantages of the two datastructures?
Indeed, the new structure should be a multimap too. That means it'd
be apprx. a binary tree of (key,value) pairs (with duplication
allowed. It would be a bit more canonical, and has advantages in
cases where the list needs to be modified or traversed without
copying.
>> + list<func_info*> *fis = new list<func_info*>;
>> + fis = sym_table->lookup_symbol(function_str_val);
>> [...]
> Don't we need to delete the fis somewhere?
lookup_symbol should just return the list by value and let C++ handle
the memory management. (The objects pointed to by the embedded
func_info* pointers are a separate matter.)
- FChE
More information about the Systemtap
mailing list