From 54d87c8ffceed3f5004aa36c53b0459cb5eb2fcd Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Sat, 12 Dec 2015 11:01:02 -0500 Subject: [PATCH] unwind diagnostic improvements Add a heuristic for missing kernel unwindsyms to the runtime. Tweak documentation to spell out --ldd is for userspace only. Reported by: Nikolay Borisov --- man/stap.1 | 11 ++++++----- runtime/unwind.c | 11 +++++++---- session.cxx | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/man/stap.1 b/man/stap.1 index 42612aa51..3d3a0db60 100644 --- a/man/stap.1 +++ b/man/stap.1 @@ -237,10 +237,11 @@ module. This may enable symbolic tracebacks from those modules/programs, even if they do not have an explicit probe placed into them. .TP .BI \-\-ldd -Add symbol/unwind information for all shared libraries suspected by -ldd to be necessary for user-space binaries being probe or listed with +Add symbol/unwind information for all user-space shared libraries suspected +by ldd to be necessary for user-space binaries being probe or listed with the \-d option. Caution: this can make the probe modules considerably -larger. +larger. Note that this option does not deal with kernel-space modules: +see instead \-\-all\-modules below. .TP .BI \-\-all\-modules Equivalent to specifying "\-dkernel" and a "\-d" for each kernel module that is @@ -575,7 +576,7 @@ Dumps a list of all functions found in library files and exits. Also includes their parameters and types. A function of type 'unknown' indicates a function that does not return a value. Note that not all function/parameter types may be resolved (these are also shown by 'unknown'). This features is very -memory-intensive and thus may not work properly with \fI--use-server\fR if the +memory-intensive and thus may not work properly with \fI\-\-use-server\fR if the target server imposes an rlimit on process memory (i.e. through the \fI~stap-server/.systemtap/rc\fR configuration file, see \fIstap-server\fR(8)). @@ -598,7 +599,7 @@ libvirt. Optionally, LIBVIRT_URI may be specified to connect to a specific driver and/or a remote host. For example, to connect to the local privileged QEMU driver, use: .SAMPLE ---remote libvirt://MyDomain/qemu:///system +\-\-remote libvirt://MyDomain/qemu:///system .ESAMPLE See the page at .nh diff --git a/runtime/unwind.c b/runtime/unwind.c index b5c8f6f8c..874fc6709 100644 --- a/runtime/unwind.c +++ b/runtime/unwind.c @@ -1507,10 +1507,13 @@ static int unwind(struct unwind_context *context, int user) } if (unlikely(m == NULL)) { - if (module_name) - _stp_warn ("Missing unwind data for module, rerun with 'stap -d %s'\n", - module_name); - // Don't _stp_warn about this, will use fallback unwinder. + // some heuristics for the module name; we can't call + // kernel_text_address or friends from this context. + if (! module_name && (unsigned long)pc > PAGE_OFFSET) + module_name = "kernel"; + _stp_warn ("Missing unwind data for a module, rerun with 'stap -d %s'\n", + module_name ?: "(unknown; retry witn -DDEBUG_UNWIND)"); + // Don't _stp_warn including the pc#, since it'll defeat warning deduplicator dbug_unwind(1, "No module found for pc=%lx", pc); return -EINVAL; } diff --git a/session.cxx b/session.cxx index 0fff59c43..55e5760ef 100644 --- a/session.cxx +++ b/session.cxx @@ -589,7 +589,7 @@ systemtap_session::usage (int exitcode) cout << " " << syms[i].c_str() << endl; } cout - << _F(" --ldd add unwind/symbol data for all referenced object files.\n" + << _F(" --ldd add unwind/symbol data for referenced user-space objects.\n" " --all-modules\n" " add unwind/symbol data for all loaded kernel objects.\n" " -t collect probe timing information\n" -- 2.43.5