.\" t
-.TH WARNING::DEBUGINFO 7stap
+.TH WARNING::DEBUGINFO 7stap
.SH NAME
warning::debuginfo \- systemtap missing-debuginfo warnings
For many symbolic probing operations, systemtap needs DWARF debuginfo for
the relevant binaries. This often includes resolving function/statement
probes, or $context variables in related handlers. DWARF debuginfo may
-be found in the original binaries built during compilation, or may have
+be found in the original binaries built during compilation, or may have
been split into separate files. The
.IR SYSTEMTAP_DEBUGINFO_PATH
environment variable affects where systemtap looks for these files.
kernel debuginfo
For scripts that target the kernel, systemtap may search for the
.IR vmlinux
-file created during its original build. This is distinct from the
-boot-loader's compressed/stripped
+file created during its original build. This is distinct from the
+boot-loader's compressed/stripped
.IR vmlinuz
file, and much larger. If you have a hand-built kernel, make sure
it was built with the
.TP
process debuginfo
For scripts that target user-space, systemtap may search for debuginfo.
-If you have hand-built binaries, use
+If you have hand-built binaries, use
.IR "CFLAGS=-g -O2"
to compile them.
+.TP
+minidebuginfo
+On some systems, binaries may be compiled with a subset of debuginfo
+useful for function tracing and backtraces. This 'Minidebuginfo' is
+a xz compressed section labeled .gnu_debugdata. Support for
+minidebuginfo relies on elfutils
+version 0.156.
+
.TP
unnecessary debuginfo
In some cases, a script may be altered to avoid requiring debuginfo.
(for non-DWARF syscall): these work similarly, and use more intricate
(fragile) tapset functions to extract system call arguments. Another
option is use of compiled-in instrumentation such as kernel tracepoints
-or user-space
+or user-space
.IR <sys/sdt.h>
markers in libraries or executables, which do not require debuginfo.
If debuginfo was required for resolving a complicated
.IR $var->foo->bar
-expression, it may be possible to use
+expression, it may be possible to use
.IR @cast(var,"foo","foo.h")->foo->bar
to synthesize debuginfo for that type from a header file.
flag.
The
.IR stap-prep
-script included with systemtap may be able to download the
+script included with systemtap may be able to download the
appropriate kernel debuginfo. Another possibility is to install and
-use a
+use a
.IR stap\-server
remote-compilation instance on a machine on your network, where
debuginfo and compilation resources can be centralized. Try the
.IR stappaths (7),
.IR stap-server (8),
.IR strip (1),
-.IR error::reporting (7stap)
-.IR error::contextvars (7stap)
+.IR error::reporting (7stap),
+.IR error::contextvars (7stap),
+.IR http://fedoraproject.org/wiki/Features/MiniDebugInfo
--- /dev/null
+#!/usr/bin/bash
+
+# Extract the dynamic symbols from the main binary, there is no need
+# to also have these in the normal symbol table
+nm -D binary --format=posix --defined-only | awk '{ print $1 }' | sort > dynsyms
+
+# Extract all the text (i.e. function) symbols from the debuginfo .
+nm binary --format=posix --defined-only | awk '{ if ($2 == "T" || $2 == "t") print $1 }' | sort > funcsyms
+
+# Keep all the function symbols not already in the dynamic symbol
+# table.
+comm -13 dynsyms funcsyms > keep_symbols
+
+# Copy the full debuginfo, keeping only a minimal set of symbols and
+# removing some unnecessary sections.
+objcopy -S --remove-section .gdb_index --remove-section .comment --keep-symbols=keep_symbols binary mini_debuginfo
+
+# Inject the compressed data into the .gnu_debugdata section of the
+# original binary.
+xz mini_debuginfo
+objcopy --add-section .gnu_debugdata=mini_debuginfo.xz binary
--- /dev/null
+set test "minidebuginfo"
+
+if {![installtest_p]} { untested $test; return }
+
+catch { exec gcc -o binary -g $srcdir/$subdir/minidebug.c } err
+
+if {$err == ""} then { pass "$test compile" } else { fail "$test compile $err" }
+
+catch { exec $srcdir/$subdir/create-minidebug.sh } err
+if {$err == ""} then { pass "$test create minidebug" } else { fail "$test create-minidebug.sh $err" }
+spawn stap $srcdir/$subdir/minidebuginfo.stp -c "./binary"
+set ok 0
+expect {
+ -timeout 30
+ -re {[^\r\n]*main\r\n} { incr ok; exp_continue }
+ -re {[^\r\n]*bar\r\n} { incr ok; exp_continue }
+ -re {[^\r\n]*foo\r\n} { incr ok; exp_continue }
+ eof { }
+ timeout { fail "$test (timeout)" }
+}
+catch { close }; wait
+if {$ok == 3} then { pass "$test ($ok)" } else { fail "$test ($ok)" }
+catch { exec rm binary mini_debuginfo.xz dynsyms funcsyms keep_symbols } err