summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-03-04 18:51:28 -0800
committerJosh Stone <jistone@redhat.com>2009-03-06 18:46:54 -0800
commit2da9cedbf2a1916107fe829692af5113646a894d (patch)
tree3316b8f09fb42d3ac2b73f5c1e9d3a6d71b6f98e /tapsets.cxx
parentdd22832afe6c337eb020001834266ad1e7678b2c (diff)
downloadsystemtap-steved-2da9cedbf2a1916107fe829692af5113646a894d.tar.gz
systemtap-steved-2da9cedbf2a1916107fe829692af5113646a894d.tar.xz
systemtap-steved-2da9cedbf2a1916107fe829692af5113646a894d.zip
Make iterate_over_functions work with base_querys
* tapsets.cxx (dwflpp::iterate_over_functions): Change arg from void* to base_query*, and add explicit function-search parameters. (query_cu): update caller (query_dwarf_func): update callback signature (Note: instead of passing around callback functions, it might be nicer to use a virtual method in base_query...)
Diffstat (limited to 'tapsets.cxx')
-rw-r--r--tapsets.cxx31
1 files changed, 17 insertions, 14 deletions
diff --git a/tapsets.cxx b/tapsets.cxx
index 7a321dce..834aa06a 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -1193,8 +1193,9 @@ struct dwflpp
return DWARF_CB_OK;
}
- int iterate_over_functions (int (* callback)(Dwarf_Die * func, void * arg),
- void * data);
+ int iterate_over_functions (int (* callback)(Dwarf_Die * func, base_query * q),
+ base_query * q, const string& function,
+ bool has_statement_num=false);
int iterate_over_globals (int (* callback)(Dwarf_Die *, void *),
void * data);
@@ -2937,13 +2938,13 @@ dwflpp::iterate_over_globals (int (* callback)(Dwarf_Die *, void *),
}
int
-dwflpp::iterate_over_functions (int (* callback)(Dwarf_Die * func, void * arg),
- void * data)
+dwflpp::iterate_over_functions (int (* callback)(Dwarf_Die * func, base_query * q),
+ base_query * q, const string& function,
+ bool has_statement_num)
{
int rc = DWARF_CB_OK;
assert (module);
assert (cu);
- dwarf_query * q = static_cast<dwarf_query *>(data);
string key = module_name + ":" + cu_name;
cu_function_cache_t *v = cu_function_cache[key];
@@ -2956,13 +2957,13 @@ dwflpp::iterate_over_functions (int (* callback)(Dwarf_Die * func, void * arg),
clog << "function cache " << key << " size " << v->size() << endl;
}
- string subkey = q->function;
+ string subkey = function;
if (v->find(subkey) != v->end())
{
Dwarf_Die die = v->find(subkey)->second;
if (q->sess.verbose > 4)
clog << "function cache " << key << " hit " << subkey << endl;
- return (*callback)(& die, data);
+ return (*callback)(& die, q);
}
else if (name_has_wildcard (subkey))
{
@@ -2976,17 +2977,17 @@ dwflpp::iterate_over_functions (int (* callback)(Dwarf_Die * func, void * arg),
if (q->sess.verbose > 4)
clog << "function cache " << key << " match " << func_name << " vs " << subkey << endl;
- rc = (*callback)(& die, data);
+ rc = (*callback)(& die, q);
if (rc != DWARF_CB_OK) break;
}
}
}
- else if (q->has_statement_num) // searching all for kernel.statement
+ else if (has_statement_num) // searching all for kernel.statement
{
for (cu_function_cache_t::iterator it = v->begin(); it != v->end(); it++)
{
Dwarf_Die die = it->second;
- rc = (*callback)(& die, data);
+ rc = (*callback)(& die, q);
if (rc != DWARF_CB_OK) break;
}
}
@@ -3876,9 +3877,9 @@ query_dwarf_inline_instance (Dwarf_Die * die, void * arg)
}
static int
-query_dwarf_func (Dwarf_Die * func, void * arg)
+query_dwarf_func (Dwarf_Die * func, base_query * bq)
{
- dwarf_query * q = static_cast<dwarf_query *>(arg);
+ dwarf_query * q = static_cast<dwarf_query *>(bq);
try
{
@@ -3892,7 +3893,7 @@ query_dwarf_func (Dwarf_Die * func, void * arg)
if (q->sess.verbose>3)
clog << "checking instances of inline " << q->dw.function_name
<< "\n";
- q->dw.iterate_over_inline_instances (query_dwarf_inline_instance, arg);
+ q->dw.iterate_over_inline_instances (query_dwarf_inline_instance, q);
if (q->dw.function_name_final_match (q->function))
return DWARF_CB_ABORT;
@@ -4026,7 +4027,9 @@ query_cu (Dwarf_Die * cudie, void * arg)
// Pick up [entrypc, name, DIE] tuples for all the functions
// matching the query, and fill in the prologue endings of them
// all in a single pass.
- int rc = q->dw.iterate_over_functions (query_dwarf_func, q);
+ int rc = q->dw.iterate_over_functions (query_dwarf_func, q,
+ q->function,
+ q->has_statement_num);
if (rc != DWARF_CB_OK)
q->query_done = true;