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       compiler version
23              Prior to GCC version 4.5, debuginfo quality was fairly  limited.
24              Often  developers  were advised to build their programs with -O0
25              -g flags to disable optimization.  GCC version 4.5 introduced  a
26              facility  called  "variable-tracking assignments" that allows it
27              to generate high-quality debuginfo under full -O2  -g  optimiza‐
28              tion.   It  is  not  perfect, but much better than before.  Note
29              that, due to another gcc bug (PR51358) -O0 -g can actually some‐
30              times make debuginfo quality worse than for -O2 -g.
32              Another  related problem involves debuginfo quality for the pro‐
33              logue area of a function (PR15123), wherein a  program  compiled
34              with  CFLAGS=-mfentry  (especially  the  kernel, for ftrace) may
35              lack accurate debuginfo for the entry instructions for gcc prior
36              to  version 4.8.  If able, arrange to compile your programs with
37              -grecord-gcc-switches CFLAGS,  and/or  try  rerunning  systemtap
38              with $PR15123_ASSUME_MFENTRY=1.
41       function inlining
42              Even  modern  gcc sometimes has problems with parameters for in‐
43              lined functions.  It may be necessary to change  the  script  to
44              probe  at a slightly different place.  Try a .statement() probe,
45              instead of a .function() probe, somewhere a few source lines in‐
46              to  the body of the inlined function.  Or try putting a probe at
47              the  call  site  of  the  inlined  function.   Or  use  the   if
48              @defined($var) { ... } script language construct to test for the
49              resolvability of the context variable before using it.
52       instruction reordering
53              Heavily optimized code often smears the instructions from multi‐
54              ple  source  statements together.  This can leave systemtap with
55              no place to choose to place  a  probe,  especially  a  statement
56              probe  specified  by line number.  Systemtap may advise to try a
57              nearby line number, but these may not work well either.  Consid‐
58              er placing a probe by a statement wildcard or line number range.
61       elfutils configuration
62              It  is  possible that the DWARF debuginfo being sought is avail‐
63              able, but not in a format acceptable to  the  copy  of  elfutils
64              used  by systemtap.  For example, your copy of gcc might produce
65              compressed debuginfo (.zdebug_* ELF sections or .xz files) while
66              your copy of elfutils might lack appropriate decompression capa‐
67              bilities.  Unfortunately, there is no easy way to tell  if  this
68              is  the  problem.  If you're building your own copy of elfutils,
69              ensure all decompression library headers/libraries are available
70              at build time.
73       debuginfo configuration
74              Some tools may generate debuginfo that is unsupported by system‐
75              tap, such as  the  linux  kernel  CONFIG_DEBUG_INFO_SPLIT  (.dwo
76              files) option.  Stick with plain ELF/DWARF (optinally split, Fe‐
77              dora-style), if possible.


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


90       stap(1),
91       http://dwarfstd.org/,
92       http://sourceware.org/systemtap/wiki/TipContextVariables,
93       http://gcc.gnu.org/wiki/Var_Tracking_Assignments,
94       warning::debuginfo(7stap),
95       error::reporting(7stap)
99                                                           ERROR::DWARF(7stap)