diff options
author | Josh Stone <jistone@redhat.com> | 2009-08-25 18:53:40 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-08-25 18:53:40 -0700 |
commit | 544174947817538d15a105fe2de4f2094079fd6c (patch) | |
tree | 309351fdbcf89218562285542858d9dba05f3000 /dwflpp.cxx | |
parent | c1c5bb9a8bd0a58f98708f949e4dbe74561898a7 (diff) | |
download | systemtap-steved-544174947817538d15a105fe2de4f2094079fd6c.tar.gz systemtap-steved-544174947817538d15a105fe2de4f2094079fd6c.tar.xz systemtap-steved-544174947817538d15a105fe2de4f2094079fd6c.zip |
Compute cu_name dynamically
We only need cu_name for errors and verbose messages, so it's a waste to
always construct it in focus_on_cu. It's now built only as-needed.
* dwflpp.cxx (dwflpp::cu_name): Now a method instead of a data member.
(dwflpp::focus_on_module): No cu_name to clear now.
(dwflpp::focus_on_cu): No cu_name to set now.
(dwflpp::declaration_resolve): Adjust to call cu_name() now.
(dwflpp::iterate_over_functions): Ditto.
* tapsets.cxx (query_cu): Ditto.
Diffstat (limited to 'dwflpp.cxx')
-rw-r--r-- | dwflpp.cxx | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -150,7 +150,6 @@ dwflpp::focus_on_module(Dwfl_Module * m, module_info * mi) module_dwarf = NULL; - cu_name.clear(); cu = NULL; function_name.clear(); @@ -165,7 +164,6 @@ dwflpp::focus_on_cu(Dwarf_Die * c) assert(module); cu = c; - cu_name = dwarf_diename(c) ?: "CU"; // Reset existing pointers and names function_name.clear(); @@ -176,6 +174,13 @@ dwflpp::focus_on_cu(Dwarf_Die * c) } +string +dwflpp::cu_name(void) +{ + return dwarf_diename(cu) ?: "<unknown source>"; +} + + void dwflpp::focus_on_function(Dwarf_Die * f) { @@ -562,7 +567,7 @@ dwflpp::declaration_resolve(const char *name) global_alias_cache[cu->addr] = v; iterate_over_globals(global_alias_caching_callback, v); if (sess.verbose > 4) - clog << "global alias cache " << module_name << ":" << cu_name + clog << "global alias cache " << module_name << ":" << cu_name() << " size " << v->size() << endl; } @@ -611,7 +616,7 @@ dwflpp::iterate_over_functions (int (* callback)(Dwarf_Die * func, base_query * cu_function_cache[cu->addr] = v; dwarf_getfuncs (cu, cu_function_caching_callback, v, 0); if (sess.verbose > 4) - clog << "function cache " << module_name << ":" << cu_name + clog << "function cache " << module_name << ":" << cu_name() << " size " << v->size() << endl; mod_info->update_symtab(v); } @@ -621,7 +626,7 @@ dwflpp::iterate_over_functions (int (* callback)(Dwarf_Die * func, base_query * { Dwarf_Die& die = it->second; if (sess.verbose > 4) - clog << "function cache " << module_name << ":" << cu_name + clog << "function cache " << module_name << ":" << cu_name() << " hit " << function << endl; return (*callback)(& die, q); } @@ -635,7 +640,7 @@ dwflpp::iterate_over_functions (int (* callback)(Dwarf_Die * func, base_query * if (function_name_matches_pattern (func_name, function)) { if (sess.verbose > 4) - clog << "function cache " << module_name << ":" << cu_name + clog << "function cache " << module_name << ":" << cu_name() << " match " << func_name << " vs " << function << endl; rc = (*callback)(& die, q); |