void saveargs(dwarf_query& q, Dwarf_Die* scope_die, Dwarf_Addr dwfl_addr);
};
-// Helper struct to thread through the dwfl callbacks.
-struct base_query
-{
- base_query(dwflpp & dw, literal_map_t const & params);
- base_query(dwflpp & dw, const string & module_val);
- virtual ~base_query() {}
-
- systemtap_session & sess;
- dwflpp & dw;
-
- // Used to keep track of which modules were visited during
- // iterate_over_modules()
- set<string> visited_modules;
-
- // Parameter extractors.
- static bool has_null_param(literal_map_t const & params,
- string const & k);
- static bool get_string_param(literal_map_t const & params,
- string const & k, string & v);
- static bool get_number_param(literal_map_t const & params,
- string const & k, long & v);
- static bool get_number_param(literal_map_t const & params,
- string const & k, Dwarf_Addr & v);
- static void query_library_callback (base_query *me, const char *data);
- static void query_plt_callback (base_query *me, const char *link, size_t addr);
- virtual void query_library (const char *data) = 0;
- virtual void query_plt (const char *link, size_t addr) = 0;
-
-
- // Extracted parameters.
- bool has_kernel;
- bool has_module;
- bool has_process;
- bool has_library;
- bool has_plt;
- bool has_statement;
- string module_val; // has_kernel => module_val = "kernel"
- string path; // executable path if module is a .so
- string plt_val; // has_plt => plt wildcard
- int64_t pid_val;
-
- virtual void handle_query_module() = 0;
-};
-
-struct dwarf_query : public base_query
-{
- dwarf_query(probe * base_probe,
- probe_point * base_loc,
- dwflpp & dw,
- literal_map_t const & params,
- vector<derived_probe *> & results,
- const string user_path,
- const string user_lib);
-
- vector<derived_probe *> & results;
- set<string> inlined_non_returnable; // function names
- probe * base_probe;
- probe_point * base_loc;
- string user_path;
- string user_lib;
-
- set<string> visited_libraries;
- bool resolved_library;
-
- virtual void handle_query_module();
- void query_module_dwarf();
- void query_module_symtab();
- void query_library (const char *data);
- void query_plt (const char *entry, size_t addr);
-
- void add_probe_point(string const & funcname,
- char const * filename,
- int line,
- Dwarf_Die *scope_die,
- Dwarf_Addr addr);
-
- void mount_well_formed_probe_point();
- void unmount_well_formed_probe_point();
- stack<pair<probe_point*, probe*> > previous_bases;
-
- void replace_probe_point_component_arg(const string& functor,
- const string& new_functor,
- int64_t new_arg,
- bool hex = false);
- void replace_probe_point_component_arg(const string& functor,
- int64_t new_arg,
- bool hex = false);
- void replace_probe_point_component_arg(const string& functor,
- const string& new_functor,
- const string& new_arg);
- void replace_probe_point_component_arg(const string& functor,
- const string& new_arg);
- void remove_probe_point_component(const string& functor);
-
- // Track addresses we've already seen in a given module
- set<Dwarf_Addr> alias_dupes;
-
- // Track inlines we've already seen as well
- // NB: this can't be compared just by entrypc, as inlines can overlap
- set<inline_instance_info> inline_dupes;
-
- // Used in .callee[s] probes, when calling iterate_over_callees() (which
- // provides the actual stack). Retains the addrs of the callers unwind addr
- // where the callee is found. Specifies multiple callers. E.g. when a callee
- // at depth 2 is found, callers[1] has the addr of the caller, and callers[0]
- // has the addr of the caller's caller.
- stack<Dwarf_Addr> *callers;
-
- bool has_function_str;
- bool has_statement_str;
- bool has_function_num;
- bool has_statement_num;
- string statement_str_val;
- string function_str_val;
- Dwarf_Addr statement_num_val;
- Dwarf_Addr function_num_val;
-
- bool has_call;
- bool has_exported;
- bool has_inline;
- bool has_return;
-
- bool has_maxactive;
- long maxactive_val;
-
- bool has_label;
- string label_val;
-
- bool has_callee;
- string callee_val;
-
- bool has_callees_num;
- long callees_num_val;
-
- bool has_relative;
- long relative_val;
-
- bool has_absolute;
-
- bool has_mark;
-
- enum dbinfo_reqt dbinfo_reqt;
- enum dbinfo_reqt assess_dbinfo_reqt();
-
- void parse_function_spec(const string & spec);
- function_spec_type spec_type;
- vector<string> scopes;
- string function;
- string file;
- lineno_t lineno_type;
- vector<int> linenos;
- bool query_done; // Found exact match
-
- // Holds the prologue end of the current function
- Dwarf_Addr prologue_end;
-
- set<string> filtered_srcfiles;
-
- // Map official entrypc -> func_info object
- inline_instance_map_t filtered_inlines;
- func_info_map_t filtered_functions;
-
- // Helper when we want to iterate over both
- base_func_info_map_t filtered_all();
-
- void query_module_functions ();
-
- string final_function_name(const string& final_func,
- const char* final_file,
- int final_line);
-};
struct uprobe_derived_probe: public dwarf_derived_probe
{
void emit_module_exit (systemtap_session& s);
};
+// Helper struct to thread through the dwfl callbacks.
+struct base_query
+{
+ base_query(dwflpp & dw, literal_map_t const & params);
+ base_query(dwflpp & dw, const string & module_val);
+ virtual ~base_query() {}
+
+ systemtap_session & sess;
+ dwflpp & dw;
+
+ // Used to keep track of which modules were visited during
+ // iterate_over_modules()
+ set<string> visited_modules;
+
+ // Parameter extractors.
+ static bool has_null_param(literal_map_t const & params,
+ string const & k);
+ static bool get_string_param(literal_map_t const & params,
+ string const & k, string & v);
+ static bool get_number_param(literal_map_t const & params,
+ string const & k, long & v);
+ static bool get_number_param(literal_map_t const & params,
+ string const & k, Dwarf_Addr & v);
+ static void query_library_callback (base_query *me, const char *data);
+ static void query_plt_callback (base_query *me, const char *link, size_t addr);
+ virtual void query_library (const char *data) = 0;
+ virtual void query_plt (const char *link, size_t addr) = 0;
+
+
+ // Extracted parameters.
+ bool has_kernel;
+ bool has_module;
+ bool has_process;
+ bool has_library;
+ bool has_plt;
+ bool has_statement;
+ string module_val; // has_kernel => module_val = "kernel"
+ string path; // executable path if module is a .so
+ string plt_val; // has_plt => plt wildcard
+ int64_t pid_val;
+
+ virtual void handle_query_module() = 0;
+};
+
base_query::base_query(dwflpp & dw, literal_map_t const & params):
sess(dw.sess), dw(dw), has_library(false), has_plt(false), has_statement(false),
pid_val(0)
return present;
}
-static void delete_session_module_cache (systemtap_session& s); // forward decl
+struct dwarf_query : public base_query
+{
+ dwarf_query(probe * base_probe,
+ probe_point * base_loc,
+ dwflpp & dw,
+ literal_map_t const & params,
+ vector<derived_probe *> & results,
+ const string user_path,
+ const string user_lib);
+
+ vector<derived_probe *> & results;
+ set<string> inlined_non_returnable; // function names
+ probe * base_probe;
+ probe_point * base_loc;
+ string user_path;
+ string user_lib;
+
+ set<string> visited_libraries;
+ bool resolved_library;
+
+ virtual void handle_query_module();
+ void query_module_dwarf();
+ void query_module_symtab();
+ void query_library (const char *data);
+ void query_plt (const char *entry, size_t addr);
+
+ void add_probe_point(string const & funcname,
+ char const * filename,
+ int line,
+ Dwarf_Die *scope_die,
+ Dwarf_Addr addr);
+
+ void mount_well_formed_probe_point();
+ void unmount_well_formed_probe_point();
+ stack<pair<probe_point*, probe*> > previous_bases;
+
+ void replace_probe_point_component_arg(const string& functor,
+ const string& new_functor,
+ int64_t new_arg,
+ bool hex = false);
+ void replace_probe_point_component_arg(const string& functor,
+ int64_t new_arg,
+ bool hex = false);
+ void replace_probe_point_component_arg(const string& functor,
+ const string& new_functor,
+ const string& new_arg);
+ void replace_probe_point_component_arg(const string& functor,
+ const string& new_arg);
+ void remove_probe_point_component(const string& functor);
+
+ // Track addresses we've already seen in a given module
+ set<Dwarf_Addr> alias_dupes;
+
+ // Track inlines we've already seen as well
+ // NB: this can't be compared just by entrypc, as inlines can overlap
+ set<inline_instance_info> inline_dupes;
+
+ // Used in .callee[s] probes, when calling iterate_over_callees() (which
+ // provides the actual stack). Retains the addrs of the callers unwind addr
+ // where the callee is found. Specifies multiple callers. E.g. when a callee
+ // at depth 2 is found, callers[1] has the addr of the caller, and callers[0]
+ // has the addr of the caller's caller.
+ stack<Dwarf_Addr> *callers;
+
+ bool has_function_str;
+ bool has_statement_str;
+ bool has_function_num;
+ bool has_statement_num;
+ string statement_str_val;
+ string function_str_val;
+ Dwarf_Addr statement_num_val;
+ Dwarf_Addr function_num_val;
+
+ bool has_call;
+ bool has_exported;
+ bool has_inline;
+ bool has_return;
+
+ bool has_maxactive;
+ long maxactive_val;
+
+ bool has_label;
+ string label_val;
+
+ bool has_callee;
+ string callee_val;
+
+ bool has_callees_num;
+ long callees_num_val;
+
+ bool has_relative;
+ long relative_val;
+
+ bool has_absolute;
+
+ bool has_mark;
+ enum dbinfo_reqt dbinfo_reqt;
+ enum dbinfo_reqt assess_dbinfo_reqt();
+
+ void parse_function_spec(const string & spec);
+ function_spec_type spec_type;
+ vector<string> scopes;
+ string function;
+ string file;
+ lineno_t lineno_type;
+ vector<int> linenos;
+ bool query_done; // Found exact match
+
+ // Holds the prologue end of the current function
+ Dwarf_Addr prologue_end;
+
+ set<string> filtered_srcfiles;
+
+ // Map official entrypc -> func_info object
+ inline_instance_map_t filtered_inlines;
+ func_info_map_t filtered_functions;
+
+ // Helper when we want to iterate over both
+ base_func_info_map_t filtered_all();
+
+ void query_module_functions ();
+
+ string final_function_name(const string& final_func,
+ const char* final_file,
+ int final_line);
+};
+
+static void delete_session_module_cache (systemtap_session& s); // forward decl
struct dwarf_builder: public derived_probe_builder
{