summaryrefslogtreecommitdiffstats
path: root/dwflpp.cxx
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2009-09-29 00:12:26 +0200
committerMark Wielaard <mjw@redhat.com>2009-09-29 00:24:06 +0200
commit5f8ca04fbb0682ff8647b4df5de68cd1042e312d (patch)
tree22fea238c8e5175e4040f1b38046b7686c053b8c /dwflpp.cxx
parentdc3f293b2581a31e78edad07cf41f7c10106ab4b (diff)
downloadsystemtap-steved-5f8ca04fbb0682ff8647b4df5de68cd1042e312d.tar.gz
systemtap-steved-5f8ca04fbb0682ff8647b4df5de68cd1042e312d.tar.xz
systemtap-steved-5f8ca04fbb0682ff8647b4df5de68cd1042e312d.zip
Factor out duplicated code to setup user/module Dwfl from dwflpp/translate.
* setupdwfl.h: Add setup_dwfl_user() and is_user_module(). * setupdwfl.cxx: Likewise. * dwflpp.cxx (setup_user): Use setup_dwfl_user(). * translate.cxx (emit_symbol_data): Likewise and is_user_module(). * tapsets.cxx (dwarf_cast_expanding_visitor::visit_cast_op): Use is_user_module().
Diffstat (limited to 'dwflpp.cxx')
-rw-r--r--dwflpp.cxx55
1 files changed, 9 insertions, 46 deletions
diff --git a/dwflpp.cxx b/dwflpp.cxx
index cc882e5d..b8e39b69 100644
--- a/dwflpp.cxx
+++ b/dwflpp.cxx
@@ -354,54 +354,17 @@ dwflpp::setup_user(const vector<string>& modules, bool debuginfo_needed)
if (! sess.module_cache)
sess.module_cache = new module_cache ();
- static const char *debuginfo_path_arr = "+:.debug:/usr/lib/debug:build";
- static const char *debuginfo_env_arr = getenv("SYSTEMTAP_DEBUGINFO_PATH");
- // NB: kernel_build_tree doesn't enter into this, as it's for
- // kernel-side modules only.
- static const char *debuginfo_path = (debuginfo_env_arr ?: debuginfo_path_arr);
-
- static const Dwfl_Callbacks user_callbacks =
- {
- NULL, /* dwfl_linux_kernel_find_elf, */
- dwfl_standard_find_debuginfo,
- dwfl_offline_section_address,
- (char **) & debuginfo_path
- };
-
- dwfl = dwfl_begin (&user_callbacks);
- if (!dwfl)
- throw semantic_error ("cannot open dwfl");
- dwfl_report_begin (dwfl);
-
- vector<string>::const_iterator it;
- for (it = modules.begin(); it != modules.end(); ++it)
- {
- // XXX: should support buildid-based naming
-
- const string& module_name = *it;
- Dwfl_Module *mod = dwfl_report_offline (dwfl,
- module_name.c_str(),
- module_name.c_str(),
- -1);
-
- if (debuginfo_needed)
- dwfl_assert (string("missing process ") +
- module_name +
- string(" ") +
- sess.architecture +
- string(" debuginfo"),
- mod);
- }
-
- // NB: the result of an _offline call is the assignment of
- // virtualized addresses to relocatable objects such as
- // modules. These have to be converted to real addresses at
- // run time. See the dwarf_derived_probe ctor and its caller.
-
- dwfl_assert ("dwfl_report_end", dwfl_report_end(dwfl, NULL, NULL));
+ vector<string>::const_iterator it = modules.begin();
+ dwfl = setup_dwfl_user(it, modules.end(), debuginfo_needed);
+ if (debuginfo_needed && it != modules.end())
+ dwfl_assert (string("missing process ") +
+ *it +
+ string(" ") +
+ sess.architecture +
+ string(" debuginfo"),
+ dwfl);
}
-
void
dwflpp::iterate_over_modules(int (* callback)(Dwfl_Module *, void **,
const char *, Dwarf_Addr,