This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH v3 1/2] systemtap/tapsets.cxx: Adjusted for multiple static functions
- From: fche at redhat dot com (Frank Ch. Eigler)
- To: Mark Wielaard <mjw at redhat dot com>
- Cc: Hemant Kumar <hemant at linux dot vnet dot ibm dot com>, Josh Stone <jistone at redhat dot com>, systemtap at sourceware dot org, naveen dot n dot rao at linux dot vnet dot ibm dot com, ulrich dot weigand at de dot ibm dot com, uweigand at gcc dot gnu dot org, anton at samba dot org
- Date: Wed, 08 Apr 2015 11:49:58 -0400
- Subject: Re: [PATCH v3 1/2] systemtap/tapsets.cxx: Adjusted for multiple static functions
- Authentication-results: sourceware.org; auth=none
- References: <1427463736-4258-1-git-send-email-hemant at linux dot vnet dot ibm dot com> <1428500598 dot 5539 dot 88 dot camel at bordewijk dot wildebeest dot org>
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