summaryrefslogtreecommitdiffstats
path: root/dwflpp.cxx
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-09-15 18:15:20 -0700
committerJosh Stone <jistone@redhat.com>2009-09-15 18:21:45 -0700
commitf09d0d1e7fd437f6a3b8c21e4817de8af458c888 (patch)
tree9acb76295bb47dfbab153b5bb92a2b92de839de8 /dwflpp.cxx
parentda23eceb71cc70668ab9dfd80d318b3837703d9d (diff)
downloadsystemtap-steved-f09d0d1e7fd437f6a3b8c21e4817de8af458c888.tar.gz
systemtap-steved-f09d0d1e7fd437f6a3b8c21e4817de8af458c888.tar.xz
systemtap-steved-f09d0d1e7fd437f6a3b8c21e4817de8af458c888.zip
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.
Diffstat (limited to 'dwflpp.cxx')
-rw-r--r--dwflpp.cxx42
1 files changed, 16 insertions, 26 deletions
diff --git a/dwflpp.cxx b/dwflpp.cxx
index dcf4182d..10127c61 100644
--- a/dwflpp.cxx
+++ b/dwflpp.cxx
@@ -1138,7 +1138,7 @@ dwflpp::iterate_over_srcfile_lines (char const * srcfile,
void
dwflpp::iterate_over_labels (Dwarf_Die *begin_die,
const string& sym,
- const string& symfunction,
+ const string& function,
dwarf_query *q,
void (* callback)(const string &,
const char *,
@@ -1146,62 +1146,52 @@ dwflpp::iterate_over_labels (Dwarf_Die *begin_die,
int,
Dwarf_Die *,
Dwarf_Addr,
- dwarf_query *),
- const string& current_function)
+ dwarf_query *))
{
get_module_dwarf();
Dwarf_Die die;
+ const char *name;
int res = dwarf_child (begin_die, &die);
if (res != 0)
return; // die without children, bail out.
- bool function_match =
- (current_function == symfunction
- || (name_has_wildcard(symfunction)
- && function_name_matches_pattern (current_function, symfunction)));
-
do
{
- int tag = dwarf_tag(&die);
- const char *name = dwarf_diename (&die);
- bool subfunction = false;
-
- switch (tag)
+ switch (dwarf_tag(&die))
{
case DW_TAG_label:
- if (function_match && name &&
+ name = dwarf_diename (&die);
+ if (name &&
(name == sym
|| (name_has_wildcard(sym)
&& function_name_matches_pattern (name, sym))))
{
- // Get the file/line number for this label
- int dline;
- const char *file = dwarf_decl_file (&die);
- dwarf_decl_line (&die, &dline);
-
// Don't try to be smart. Just drop no addr labels.
Dwarf_Addr stmt_addr;
if (dwarf_lowpc (&die, &stmt_addr) == 0)
{
+ // Get the file/line number for this label
+ int dline;
+ const char *file = dwarf_decl_file (&die);
+ dwarf_decl_line (&die, &dline);
+
vector<Dwarf_Die> scopes = getscopes_die(&die);
if (scopes.size() > 1)
- callback(current_function, name, file, dline,
+ callback(function, name, file, dline,
&scopes[1], stmt_addr, q);
}
}
break;
case DW_TAG_subprogram:
- if (dwarf_hasattr(&die, DW_AT_declaration) || !name)
- break;
case DW_TAG_inlined_subroutine:
- if (name)
- subfunction = true;
+ // Stay within our filtered function
+ break;
+
default:
if (dwarf_haschildren (&die))
- iterate_over_labels (&die, sym, symfunction, q, callback,
- subfunction ? name : current_function);
+ iterate_over_labels (&die, sym, function, q, callback);
break;
}
}