From 0c16d51256bc77c2b5497b72ec43b7864d2b47a8 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 20 Jul 2009 16:32:33 -0700 Subject: Allow dwflpp to take a vector of module names This will be used to load tracepoint modules as a bunch of little query modules into a single dwflpp. * dwflpp.cxx (setup_user): take a vector instead of a single module (dwflpp::dwflpp): form a vector in the singular case, and add a variant that takes and passes through a vector of modules. --- dwflpp.cxx | 56 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 20 deletions(-) (limited to 'dwflpp.cxx') diff --git a/dwflpp.cxx b/dwflpp.cxx index 39967a2c..0bba3f1e 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -75,7 +75,21 @@ dwflpp::dwflpp(systemtap_session & session, const string& name, bool kernel_p): if (kernel_p) setup_kernel(name); else - setup_user(name); + { + vector modules; + modules.push_back(name); + setup_user(modules); + } +} + + +dwflpp::dwflpp(systemtap_session & session, const vector& names): + sess(session), module(NULL), module_bias(0), mod_info(NULL), + module_start(0), module_end(0), cu(NULL), dwfl(NULL), + module_dwarf(NULL), function(NULL), blacklist_enabled(false), + pc_cached_scopes(0), num_cached_scopes(0), cached_scopes(NULL) +{ + setup_user(names); } @@ -369,7 +383,7 @@ dwflpp::setup_kernel(const string& name, bool debuginfo_needed) void -dwflpp::setup_user(const string& module_name, bool debuginfo_needed) +dwflpp::setup_user(const vector& modules, bool debuginfo_needed) { if (! sess.module_cache) sess.module_cache = new module_cache (); @@ -393,24 +407,26 @@ dwflpp::setup_user(const string& module_name, bool debuginfo_needed) throw semantic_error ("cannot open dwfl"); dwfl_report_begin (dwfl); - // XXX: should support buildid-based naming - - Dwfl_Module *mod = dwfl_report_offline (dwfl, - module_name.c_str(), - module_name.c_str(), - -1); - // XXX: save mod! - - if (debuginfo_needed) - dwfl_assert (string("missing process ") + - module_name + - string(" ") + - sess.architecture + - string(" debuginfo"), - mod); - - if (!module) - module = mod; + vector::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); + // XXX: save mod! + + 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 -- cgit From b114309693c9b5965ce92a1fc123c85600b79741 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 21 Jul 2009 13:17:26 +0200 Subject: Save module when dwflpp setup_user. * dwflpp.cxx (setup_user): Set module to mod. --- dwflpp.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'dwflpp.cxx') diff --git a/dwflpp.cxx b/dwflpp.cxx index 0bba3f1e..1951b071 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -418,6 +418,7 @@ dwflpp::setup_user(const vector& modules, bool debuginfo_needed) module_name.c_str(), -1); // XXX: save mod! + module = mod; if (debuginfo_needed) dwfl_assert (string("missing process ") + -- cgit From edce5b6764d5a4fe742b1a9cc44fc2fe146b44c7 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 21 Jul 2009 19:21:56 -0700 Subject: Use the query paradigm for resolving sdt probes There was a bad assumption in the probe_table initialization that the dwflpp->module would be immediately valid. We should not assume that dwflpp only has one module, or that any module is necessarily in focus. Instead, I've created an sdt_query class which will call an iterate_over_modules like the other dwarf probe types. For now this means just a single module, but it will also open the door to iterating over all linked libraries too, for example. * dwflpp.cxx (dwflpp::setup_user): don't "save mod!" anymore * tapsets.cxx (probe_table -> sdt_query): convert to a query-style class, and also take over the task of iterating over the probes. (dwarf_builder::build): leave the iteration to sdt_query --- dwflpp.cxx | 2 -- 1 file changed, 2 deletions(-) (limited to 'dwflpp.cxx') diff --git a/dwflpp.cxx b/dwflpp.cxx index 1951b071..5fec20e2 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -417,8 +417,6 @@ dwflpp::setup_user(const vector& modules, bool debuginfo_needed) module_name.c_str(), module_name.c_str(), -1); - // XXX: save mod! - module = mod; if (debuginfo_needed) dwfl_assert (string("missing process ") + -- cgit From 97f529ab5dad4aae9b1057397de84addcc42cacc Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 23 Jul 2009 11:53:03 +0200 Subject: Adjust to new elfutils dwarf_frame_cfa interface. * dwflpp.cxx (get_cfa_ops): Call dwarf_frame_cfa with cfa_nops size_t. * loc2c-test.c (main): Likewise. --- dwflpp.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'dwflpp.cxx') diff --git a/dwflpp.cxx b/dwflpp.cxx index 5fec20e2..427f1d74 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -2543,6 +2543,7 @@ Dwarf_Op * dwflpp::get_cfa_ops (Dwarf_Addr pc) { Dwarf_Op *cfa_ops = NULL; + size_t cfa_nops; if (sess.verbose > 2) clog << "get_cfa_ops @0x" << hex << pc << dec @@ -2559,7 +2560,7 @@ dwflpp::get_cfa_ops (Dwarf_Addr pc) clog << "got dwarf cfi bias: 0x" << hex << bias << dec << endl; Dwarf_Frame *frame = NULL; if (dwarf_cfi_addrframe (cfi, pc - bias, &frame) == 0) - dwarf_frame_cfa (frame, &cfa_ops); + dwarf_frame_cfa (frame, &cfa_ops, &cfa_nops); else if (sess.verbose > 3) clog << "dwarf_cfi_addrframe failed: " << dwarf_errmsg(-1) << endl; } @@ -2575,7 +2576,7 @@ dwflpp::get_cfa_ops (Dwarf_Addr pc) clog << "got eh cfi bias: 0x" << hex << bias << dec << endl; Dwarf_Frame *frame = NULL; if (dwarf_cfi_addrframe (cfi, pc - bias, &frame) == 0) - dwarf_frame_cfa (frame, &cfa_ops); + dwarf_frame_cfa (frame, &cfa_ops, &cfa_nops); else if (sess.verbose > 3) clog << "dwarf_cfi_addrframe failed: " << dwarf_errmsg(-1) << endl; } -- cgit From 4a8636a307a9a532dcc60b5ad8bf809a20dc24c3 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 23 Jul 2009 12:02:11 +0200 Subject: Workaround cfa_nops not being needed on earlier elfutils. * dwflpp.cxx (get_cfa_ops): Only define cfa_nops if _ELFUTILS_PREREQ(0,142). * loc2c-test.c (main): Likewise. --- dwflpp.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dwflpp.cxx') diff --git a/dwflpp.cxx b/dwflpp.cxx index 427f1d74..ce9993c8 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -2543,7 +2543,6 @@ Dwarf_Op * dwflpp::get_cfa_ops (Dwarf_Addr pc) { Dwarf_Op *cfa_ops = NULL; - size_t cfa_nops; if (sess.verbose > 2) clog << "get_cfa_ops @0x" << hex << pc << dec @@ -2552,6 +2551,7 @@ dwflpp::get_cfa_ops (Dwarf_Addr pc) #ifdef _ELFUTILS_PREREQ #if _ELFUTILS_PREREQ(0,142) // Try debug_frame first, then fall back on eh_frame. + size_t cfa_nops; Dwarf_Addr bias; Dwarf_CFI *cfi = dwfl_module_dwarf_cfi (module, &bias); if (cfi != NULL) -- cgit