summaryrefslogtreecommitdiffstats
path: root/translate.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 /translate.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 'translate.cxx')
-rw-r--r--translate.cxx33
1 files changed, 6 insertions, 27 deletions
diff --git a/translate.cxx b/translate.cxx
index 1bb6252f..0f53dc78 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4957,8 +4957,9 @@ emit_symbol_data (systemtap_session& s)
it++)
{
string foo = *it;
- if (foo[0] != '/') /* Omit user-space, since we're only using this for
- kernel space offline searches. */
+ if (! is_user_module (foo)) /* Omit user-space, since we're only
+ using this for kernel space
+ offline searches. */
offline_search_modules.insert (foo);
}
Dwfl *dwfl = setup_dwfl_kernel (offline_search_modules, &count, s);
@@ -4978,37 +4979,15 @@ emit_symbol_data (systemtap_session& s)
// ---- step 2: process any user modules (files) listed
- // XXX: see dwflpp::setup_user.
-
- // XXX: copied from tapsets.cxx dwflpp::, sadly
- static const char *debuginfo_path_arr = "+:.debug:/usr/lib/debug:build";
- static const char *debuginfo_env_arr = getenv("SYSTEMTAP_DEBUGINFO_PATH");
- 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,
- NULL, /* ET_REL not supported for user space, only ET_EXEC and ET_DYN.
- dwfl_offline_section_address, */
- (char **) & debuginfo_path
- };
-
for (std::set<std::string>::iterator it = s.unwindsym_modules.begin();
it != s.unwindsym_modules.end();
it++)
{
string modname = *it;
assert (modname.length() != 0);
- if (modname[0] != '/') continue; // user-space files must be full paths
- Dwfl *dwfl = dwfl_begin (&user_callbacks);
- if (!dwfl)
- throw semantic_error ("cannot create dwfl for " + modname);
-
- dwfl_report_begin (dwfl);
- Dwfl_Module* mod = dwfl_report_offline (dwfl, modname.c_str(), modname.c_str(), -1);
- dwfl_report_end (dwfl, NULL, NULL);
- if (mod != 0) // tolerate missing data; will warn below
+ if (! is_user_module (modname)) continue;
+ Dwfl *dwfl = setup_dwfl_user (modname);
+ if (dwfl != NULL) // tolerate missing data; will warn below
{
ptrdiff_t off = 0;
do