1ERROR::DWARF(7stap)                                        ERROR::DWARF(7stap)


6       error::dwarf - dwarf debuginfo quality problems


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.
19       Common conditions that trigger these problems include:
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.
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.
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.
47       function inlining
48              Even  modern  gcc sometimes has problems with parameters for in‐
49              lined functions.  It may be necessary to change  the  script  to
50              probe  at a slightly different place.  Try a .statement() probe,
51              instead of a .function() probe, somewhere a few source lines in‐
52              to  the body of the inlined function.  Or try putting a probe at
53              the  call  site  of  the  inlined  function.   Or  use  the   if
54              @defined($var) { ... } script language construct to test for the
55              resolvability of the context variable before using it.
58       instruction reordering
59              Heavily optimized code often smears the instructions from multi‐
60              ple  source  statements together.  This can leave systemtap with
61              no place to choose to place  a  probe,  especially  a  statement
62              probe  specified  by line number.  Systemtap may advise to try a
63              nearby line number, but these may not work well either.  Consid‐
64              er placing a probe by a statement wildcard or line number range.
67       elfutils configuration
68              It  is  possible that the DWARF debuginfo being sought is avail‐
69              able, but not in a format acceptable to  the  copy  of  elfutils
70              used  by systemtap.  For example, your copy of gcc might produce
71              compressed debuginfo (.zdebug_* ELF sections or .xz files) while
72              your copy of elfutils might lack appropriate decompression capa‐
73              bilities.  Unfortunately, there is no easy way to tell  if  this
74              is  the  problem.  If you're building your own copy of elfutils,
75              ensure all decompression library headers/libraries are available
76              at build time.
79       debuginfo configuration
80              Some tools may generate debuginfo that is unsupported by system‐
81              tap, such as  the  linux  kernel  CONFIG_DEBUG_INFO_SPLIT  (.dwo
82              files) option.  Stick with plain ELF/DWARF (optinally split, Fe‐
83              dora-style), if possible.


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


97       stap(1),
98       http://dwarfstd.org/,
99       http://sourceware.org/systemtap/wiki/TipContextVariables,
100       http://gcc.gnu.org/wiki/Var_Tracking_Assignments,
101       warning::debuginfo(7stap),
102       warning::buildid(7stap),
103       error::reporting(7stap)
107                                                           ERROR::DWARF(7stap)