1ERROR::DWARF(7stap)                                        ERROR::DWARF(7stap)
2
3
4

NAME

6       error::dwarf - dwarf debuginfo quality problems
7
8

DESCRIPTION

10       Systemtap  sometimes  relies  on ELF/DWARF debuginfo for programs being
11       instrumented to  locate  places  to  probe,  or  context  variables  to
12       read/write,  just  like a symbolic debugger does.  Even though examina‐
13       tion of the program's source code may show  variables  or  lines  where
14       probes  may  be  desired,  the compiler must preserve information about
15       them for systemtap (or a debugger such as gdb) to get  pinpoint  access
16       to  the  desired  information.  If a script requires such data, but the
17       compiler did not preserve enough of it, pass-2 errors may result.
18
19       Common conditions that trigger these problems include:
20
21
22       debuginfo missing or mismatching
23              Sometimes debuginfo is installed, but does not match  the  bina‐
24              ries being probed.  See the warning::debuginfo man page for more
25              help for locating correct debuginfo.
26
27
28       compiler version
29              Prior to GCC version 4.5, debuginfo quality was fairly  limited.
30              Often  developers  were advised to build their programs with -O0
31              -g flags to disable optimization.  GCC version 4.5 introduced  a
32              facility  called  "variable-tracking assignments" that allows it
33              to generate high-quality debuginfo under full -O2  -g  optimiza‐
34              tion.   It  is  not  perfect, but much better than before.  Note
35              that, due to another gcc bug (PR51358) -O0 -g can actually some‐
36              times make debuginfo quality worse than for -O2 -g.
37
38              Another  related problem involves debuginfo quality for the pro‐
39              logue area of a function (PR15123), wherein a  program  compiled
40              with  CFLAGS=-mfentry  (especially  the  kernel, for ftrace) may
41              lack accurate debuginfo for the entry instructions for gcc prior
42              to  version 4.8.  If able, arrange to compile your programs with
43              -grecord-gcc-switches CFLAGS,  and/or  try  rerunning  systemtap
44              with $PR15123_ASSUME_MFENTRY=1.
45
46
47       linux kbuild damaging debuginfo quality
48              An     upstream     kernel     commit     #2062afb4f804a     put
49              -fno-var-tracking-assignments into KCFLAGS, dramatically  reduc‐
50              ing  debuginfo  quality, which can cause debuginfo failures. The
51              simplest fix is to erase, excise, nay, eradicate this line  from
52              the top level linux Makefile:
53
54              KBUILD_CFLAGS += [...] -fno-var-tracking-assignments [...]
55
56
57       function inlining
58              Even  modern  gcc sometimes has problems with parameters for in‐
59              lined functions.  It may be necessary to change  the  script  to
60              probe  at a slightly different place.  Try a .statement() probe,
61              instead of a .function() probe, somewhere a few source lines in‐
62              to  the body of the inlined function.  Or try putting a probe at
63              the  call  site  of  the  inlined  function.   Or  use  the   if
64              @defined($var) { ... } script language construct to test for the
65              resolvability of the context variable before using it.
66
67
68       instruction reordering
69              Heavily optimized code often smears the instructions from multi‐
70              ple  source  statements together.  This can leave systemtap with
71              no place to choose to place  a  probe,  especially  a  statement
72              probe  specified  by line number.  Systemtap may advise to try a
73              nearby line number, but these may not work well either.  Consid‐
74              er placing a probe by a statement wildcard or line number range.
75
76
77       elfutils configuration
78              It  is  possible that the DWARF debuginfo being sought is avail‐
79              able, but not in a format acceptable to  the  copy  of  elfutils
80              used  by systemtap.  For example, your copy of gcc might produce
81              compressed debuginfo (.zdebug_* ELF sections or .xz files) while
82              your copy of elfutils might lack appropriate decompression capa‐
83              bilities.  Unfortunately, there is no easy way to tell  if  this
84              is  the  problem.  If you're building your own copy of elfutils,
85              ensure all decompression library headers/libraries are available
86              at build time.
87
88
89       debuginfo configuration
90              Some tools may generate debuginfo that is unsupported by system‐
91              tap, such as  the  linux  kernel  CONFIG_DEBUG_INFO_SPLIT  (.dwo
92              files) option.  Stick with plain ELF/DWARF (optinally split, Fe‐
93              dora-style), if possible.
94
95
96

ALTERNATIVES

98       In order to reduce reliance on ELF/DWARF debuginfo, consider the use of
99       statically  compiled-in instrumentation, such as kernel tracepoints, or
100       <sys/sdt.h> userspace markers.  Such  instrumentation  hook  sites  are
101       relatively  low  cost  (just one NOP instruction for sdt.h), and nearly
102       guarantee the availability of parameter data and a reliable probe site,
103       all without reliance on debuginfo.
104
105

SEE ALSO

107       stap(1),
108       http://dwarfstd.org/,
109       http://sourceware.org/systemtap/wiki/TipContextVariables,
110       http://gcc.gnu.org/wiki/Var_Tracking_Assignments,
111       warning::debuginfo(7stap),
112       warning::buildid(7stap),
113       error::reporting(7stap)
114
115
116
117                                                           ERROR::DWARF(7stap)
Impressum