From 68983551cc9390aa2bddd8e62ed0f0e3eca1edb6 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 29 Sep 2009 16:45:37 +0200 Subject: Cache Dwfl's for reuse between pass 2 and pass 3. * setupdwfl.h: Introduce DwflPtr. * setupdwfl.cxx: Cache kernel_dwfl and user_dwfl. Keep track of last used module strings. Return cached versions if same query used. * dwflpp.h: Use DwflPtr instead of Dwfl*. * dwflpp.cxx: Use DwflPtr and don't dwfl_end(). * translate.cxx: Likewise. Run through dwfl_getmodules() with returned ptr offset. --- setupdwfl.h | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'setupdwfl.h') diff --git a/setupdwfl.h b/setupdwfl.h index 67a66397..743ce668 100644 --- a/setupdwfl.h +++ b/setupdwfl.h @@ -16,21 +16,32 @@ #include #include +#include + extern "C" { #include } -Dwfl *setup_dwfl_kernel(const std::string &name, - unsigned *found, - systemtap_session &s); -Dwfl *setup_dwfl_kernel(const std::set &names, - unsigned *found, - systemtap_session &s); - -Dwfl* setup_dwfl_user(const std::string &name); -Dwfl* setup_dwfl_user(std::vector::const_iterator &begin, - const std::vector::const_iterator &end, - bool all_needed); +struct StapDwfl +{ +public: + StapDwfl(Dwfl *d) : dwfl(d) { } + ~StapDwfl() { if (dwfl) dwfl_end (dwfl); } + Dwfl *dwfl; +}; +typedef std::tr1::shared_ptr DwflPtr; + +DwflPtr setup_dwfl_kernel(const std::string &name, + unsigned *found, + systemtap_session &s); +DwflPtr setup_dwfl_kernel(const std::set &names, + unsigned *found, + systemtap_session &s); + +DwflPtr setup_dwfl_user(const std::string &name); +DwflPtr setup_dwfl_user(std::vector::const_iterator &begin, + const std::vector::const_iterator &end, + bool all_needed); // user-space files must be full paths and not end in .ko bool is_user_module(const std::string &m); -- cgit