diff options
author | Josh Stone <jistone@redhat.com> | 2009-08-24 17:54:40 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-08-24 18:10:48 -0700 |
commit | bd25380dad5aecf4a717aa42d99dd5c45c85f881 (patch) | |
tree | dfc2fcfea76c33d08aa25e9521668804c0b5e28b | |
parent | 0facf3509ae93f77d9efc6841731f7ff98982630 (diff) | |
download | systemtap-steved-bd25380dad5aecf4a717aa42d99dd5c45c85f881.tar.gz systemtap-steved-bd25380dad5aecf4a717aa42d99dd5c45c85f881.tar.xz systemtap-steved-bd25380dad5aecf4a717aa42d99dd5c45c85f881.zip |
PR2475: Filter filenames against the decl_file
We used to only check that a CU contains at least one srcfile matching
the user's file spec. This patch ensures that the selected function was
actually defined in one of the matching srcfiles.
* tapsets.cxx (struct dwarf_query): Make filtered_srcfiles carry
strings, so we can easily lookup matches later.
(query_dwarf_func): Check that the decl_file is in filtered_srcfiles.
(query_cu): Adjust to using set<string>.
* dwflpp.cxx (dwflpp::collect_srcfiles_matching): Take a set<string>.
-rw-r--r-- | dwflpp.cxx | 2 | ||||
-rw-r--r-- | dwflpp.h | 2 | ||||
-rw-r--r-- | tapsets.cxx | 17 |
3 files changed, 14 insertions, 7 deletions
@@ -1000,7 +1000,7 @@ dwflpp::iterate_over_labels (Dwarf_Die *begin_die, void dwflpp::collect_srcfiles_matching (string const & pattern, - set<char const *> & filtered_srcfiles) + set<string> & filtered_srcfiles) { assert (module); assert (cu); @@ -223,7 +223,7 @@ struct dwflpp dwarf_query *)); void collect_srcfiles_matching (std::string const & pattern, - std::set<char const *> & filtered_srcfiles); + std::set<std::string> & filtered_srcfiles); void resolve_prologue_endings (func_info_map_t & funcs); diff --git a/tapsets.cxx b/tapsets.cxx index 878d43b4..5952ddcb 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -592,7 +592,7 @@ struct dwarf_query : public base_query int line[2]; bool query_done; // Found exact match - set<char const *> filtered_srcfiles; + set<string> filtered_srcfiles; // Map official entrypc -> func_info object inline_instance_map_t filtered_inlines; @@ -1275,6 +1275,13 @@ query_dwarf_func (Dwarf_Die * func, base_query * bq) { dwarf_query * q = static_cast<dwarf_query *>(bq); + // weed out functions whose decl_file isn't one of + // the source files that we actually care about + if ((q->has_statement_str || q->has_function_str) && + q->spec_type != function_alone && + q->filtered_srcfiles.count(dwarf_decl_file(func)?:"") == 0) + return DWARF_CB_OK; + try { q->dw.focus_on_function (func); @@ -1464,9 +1471,9 @@ query_cu (Dwarf_Die * cudie, void * arg) q->dw.iterate_over_labels (q->dw.cu, q->label_val.c_str(), q->function.c_str(), q, query_statement); else - for (set<char const *>::const_iterator i = q->filtered_srcfiles.begin(); + for (set<string>::const_iterator i = q->filtered_srcfiles.begin(); i != q->filtered_srcfiles.end(); ++i) - q->dw.iterate_over_srcfile_lines (*i, q->line, q->has_statement_str, + q->dw.iterate_over_srcfile_lines (i->c_str(), q->line, q->has_statement_str, q->line_type, query_srcfile_label, q->function, q); } else if ((q->has_statement_str || q->has_function_str) @@ -1474,9 +1481,9 @@ query_cu (Dwarf_Die * cudie, void * arg) { // If we have a pattern string with target *line*, we // have to look at lines in all the matched srcfiles. - for (set<char const *>::const_iterator i = q->filtered_srcfiles.begin(); + for (set<string>::const_iterator i = q->filtered_srcfiles.begin(); i != q->filtered_srcfiles.end(); ++i) - q->dw.iterate_over_srcfile_lines (*i, q->line, q->has_statement_str, + q->dw.iterate_over_srcfile_lines (i->c_str(), q->line, q->has_statement_str, q->line_type, query_srcfile_line, q->function, q); } else |