Skip to content

Instantly share code, notes, and snippets.

@agentzh
Created September 16, 2020 23:41
Show Gist options
  • Save agentzh/56c6b0fc09e5fe352c65124100826b71 to your computer and use it in GitHub Desktop.
Save agentzh/56c6b0fc09e5fe352c65124100826b71 to your computer and use it in GitHub Desktop.
diff --git a/dwflpp.cxx b/dwflpp.cxx
index 16ff370ee..860a8be86 100644
--- a/dwflpp.cxx
+++ b/dwflpp.cxx
@@ -72,14 +72,14 @@ using namespace __gnu_cxx;
static string TOK_KERNEL("kernel");
-dwflpp::dwflpp(systemtap_session & session, const string& name, bool kernel_p):
+dwflpp::dwflpp(systemtap_session & session, const string& name, bool kernel_p, bool debuginfo_needed):
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_func(), blacklist_func_ret(),
blacklist_file(), blacklist_enabled(false)
{
if (kernel_p)
- setup_kernel(name, session);
+ setup_kernel(name, session, debuginfo_needed);
else
{
vector<string> modules;
@@ -336,9 +336,9 @@ dwflpp::setup_kernel(const string& name, systemtap_session & s, bool debuginfo_n
// Suggest a likely kernel dir to find debuginfo rpm for
string dir = string(sess.sysroot + "/lib/modules/" + sess.kernel_release );
find_debug_rpms(sess, dir.c_str());
+ throw SEMANTIC_ERROR (_F("missing %s kernel/module debuginfo [man warning::debuginfo] under '%s'",
+ sess.architecture.c_str(), sess.kernel_build_tree.c_str()));
}
- throw SEMANTIC_ERROR (_F("missing %s kernel/module debuginfo [man warning::debuginfo] under '%s'",
- sess.architecture.c_str(), sess.kernel_build_tree.c_str()));
}
if (dwfl != NULL)
@@ -374,9 +374,9 @@ dwflpp::setup_kernel(const vector<string> &names, bool debuginfo_needed)
// Suggest a likely kernel dir to find debuginfo rpm for
string dir = string(sess.sysroot + "/lib/modules/" + sess.kernel_release );
find_debug_rpms(sess, dir.c_str());
+ throw SEMANTIC_ERROR (_F("missing %s kernel/module debuginfo [man warning::debuginfo] under '%s'",
+ sess.architecture.c_str(), sess.kernel_build_tree.c_str()));
}
- throw SEMANTIC_ERROR (_F("missing %s kernel/module debuginfo [man warning::debuginfo] under '%s'",
- sess.architecture.c_str(), sess.kernel_build_tree.c_str()));
}
build_kernel_blacklist();
diff --git a/dwflpp.h b/dwflpp.h
index 76c77a427..25e583908 100644
--- a/dwflpp.h
+++ b/dwflpp.h
@@ -202,7 +202,7 @@ struct dwflpp
std::string module_name;
std::string function_name;
- dwflpp(systemtap_session & session, const std::string& user_module, bool kernel_p);
+ dwflpp(systemtap_session & session, const std::string& user_module, bool kernel_p, bool debuginfo_needed = true);
dwflpp(systemtap_session & session, const std::vector<std::string>& user_modules, bool kernel_p);
~dwflpp();
diff --git a/tapsets.cxx b/tapsets.cxx
index 0c71ca6ac..181a49e12 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -1006,10 +1006,10 @@ struct dwarf_builder: public derived_probe_builder
dwarf_builder() {}
- dwflpp *get_kern_dw(systemtap_session& sess, const string& module)
+ dwflpp *get_kern_dw(systemtap_session& sess, const string& module, bool debuginfo_needed = true)
{
if (kern_dw[module] == 0)
- kern_dw[module] = new dwflpp(sess, module, true); // might throw
+ kern_dw[module] = new dwflpp(sess, module, true, debuginfo_needed); // might throw
return kern_dw[module];
}
@@ -8430,7 +8430,10 @@ dwarf_builder::build(systemtap_session & sess,
int64_t proc_pid;
if (has_null_param (parameters, TOK_KERNEL))
{
- dw = get_kern_dw(sess, "kernel");
+ bool has_statement_num = has_param (parameters, TOK_STATEMENT);
+ bool has_absolute = has_param (parameters, TOK_ABSOLUTE);
+ bool debuginfo_needed = ! (has_statement_num && has_absolute);
+ dw = get_kern_dw(sess, "kernel", debuginfo_needed);
}
else if (get_param (parameters, TOK_MODULE, module_name))
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment