GDB crashes on startup (internal error: follow_die_offset)

I have a small project in C ++ for Linux. When I try to debug the executable using gdb, I get the following error:

../../gdb/dwarf2read.c:16760: internal-error: follow_die_offset: Assertion 'dwarf2_per_objfile->reading_partial_symbols' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. 

I greatly simplified the project to the following code and still get the same error:

Bh:

 #ifndef B_H_ #define B_H_ #include <vector> class B { public: B(); std::vector<double> p; }; #endif /* B_H_ */ 

B.cpp:

 #include "Bh" B::B() {} 

Dh:

 #ifndef D_H_ #define D_H_ #include "Eh" class D: public E { public: D(); }; #endif /* D_H_ */ 

D.cpp:

 #include "Dh" D::D() : E() {} 

Eh:

 #ifndef E_H_ #define E_H_ #include <functional> class E { public: void set(const std::function<double(void)>& f); std::function<double(void)> e; }; #endif /* E_H_ */ 

E.cpp:

 #include "Eh" void E::set(const std::function<double(void)>& f) { e = f; } 

main.cpp:

 int main() {} 

Makefile:

 all: Test %.o: %.cpp icpc -c -std=c++11 -g -o $@ $< Test: main.o Do Eo Bo icpc -std=c++11 -o $@ $^ clean: rm -f Do Eo Bo Test main.o .PHONY: all clean 

An error occurs if I do:

 gdb Test 

and then call

 run 

in the gdb CLI.

My system:

Open Suse 12.3, 64bit

icpc -version:

 icpc (ICC) 15.0.1 20141023 

icpc -v:

 icpc version 15.0.1 (gcc version 4.7.0 compatibility) 

gdb --version:

 GNU gdb (GDB) SUSE (7.5.1-2.1.1) 

gcc --version:

 gcc (SUSE Linux) 4.7.2 20130108 [gcc-4_7-branch revision 195012] 

I do not know what is wrong with this code and why the debugger crashes. For example, if I comment on the constructor of class B (which does nothing and should be equivalent to the default constructor), the error no longer appears.

+5
source share
2 answers

I don’t know what is wrong with this code and why the debugger crashes.

There is probably nothing wrong with the code, but your compiler may generate incorrect DWARF debugging information, and your somewhat old GDB, of course, has an error related to this.

Please note that you are using a very new icpc with old GDB, so this is not surprising.

Your first step should be to create the current GDB (7.8.1) and check if it has a problem.

In the unlikely event that this happens, you should report it to the GDB bugzilla .

As a workaround, you can also try creating your sources using GCC instead of ICC.

+1
source

See this topic: https://software.intel.com/en-us/forums/topic/540685 - it looks like the problem in gdb fixed in 7.9. UPDATE I upgraded gdb to 7.9 and the problem really disappeared, at least for me.

+1
source

Source: https://habr.com/ru/post/1208565/


All Articles