sampath
sampath

Reputation: 53

Dwarf Error: Can't read DWARF data from '/tmp/spyauth787438238

I am trying to debug a C++ code using GDB. I can run debugger, set breakpoints and also breakpoints are hit correctly. But when I've tried to execute 'next' command when a breakpoint is hit, it throws the following error:

"Dwarf Error: Can't read DWARF data from '/tmp/spyauth787438238"

Also I have observed that 'step' command can be executed correctly, but the moment I execute next command above error is thrown.

My GDB version is GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1 and g++ version is 4.8.1. Any help regarding this is greatly appreciated.

Upvotes: 0

Views: 1447

Answers (1)

ks1322
ks1322

Reputation: 35785

By default gcc 4.8.1 emits DWARF4 debug info. You have to use at least GDB 7.5 to read it. So you have too old gdb for gcc 4.8.1 with default options. You can either:

  • upgrade gdb to a more recent version
  • use -gdwarf-2 gcc key to emit old DWARF debug info format

From GCC 4.8 Release Notes:

DWARF4 is now the default when generating DWARF debug information. When -g is used on a platform that uses DWARF debugging information, GCC will now default to -gdwarf-4 -fno-debug-types-section. GDB 7.5, Valgrind 3.8.0 and elfutils 0.154 debug information consumers support DWARF4 by default. Before GCC 4.8 the default version used was DWARF2. To make GCC 4.8 generate an older DWARF version use -g together with -gdwarf-2 or -gdwarf-3. The default for Darwin and VxWorks is still -gdwarf-2 -gstrict-dwarf.

Upvotes: 3

Related Questions