title: GDB crashes at start (internal error: follow_die_offset)
body: <p>I have a small C++ project under Linux. When I try to debug the executable with gdb I get the following error:</p>
  
  <pre><code>../../gdb/dwarf2read.c:16760: internal-error: follow_die_offset:
  Assertion 'dwarf2_per_objfile-&gt;reading_partial_symbols' failed.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  </code></pre>
  
  <p>I have strongly simplified the project to the following code and still get the same error:</p>
  
  <p>B.h:</p>
  
  <pre><code>#ifndef B_H_
  #define B_H_
  
  #include &lt;vector&gt;
  class B {
  public:
      B();
      std::vector&lt;double&gt; p;
  };
  
  #endif /* B_H_ */
  </code></pre>
  
  <p>B.cpp:</p>
  
  <pre><code>#include "B.h"
  B::B() {}
  </code></pre>
  
  <p>D.h:</p>
  
  <pre><code>#ifndef D_H_
  #define D_H_
  
  #include "E.h"
  
  class D: public E {
  public:
      D();
  };
  
  #endif /* D_H_ */
  </code></pre>
  
  <p>D.cpp:</p>
  
  <pre><code>#include "D.h"
  
  D::D() : E() {}
  </code></pre>
  
  <p>E.h:</p>
  
  <pre><code>#ifndef E_H_
  #define E_H_
  
  #include &lt;functional&gt;
  
  class E {
  
  public:
      void set(const std::function&lt;double(void)&gt;&amp; f);
      std::function&lt;double(void)&gt; e;
  
  };
  
  #endif /* E_H_ */
  </code></pre>
  
  <p>E.cpp:</p>
  
  <pre><code>#include "E.h"
  
  void E::set(const std::function&lt;double(void)&gt;&amp; f) {
      e = f;
  }
  </code></pre>
  
  <p>main.cpp:</p>
  
  <pre><code>int main() {}
  </code></pre>
  
  <p>makefile:</p>
  
  <pre><code>all: Test
  
  %.o: %.cpp
      icpc -c -std=c++11 -g -o $@ $&lt;
  
  Test: main.o D.o E.o B.o
      icpc -std=c++11  -o $@ $^
  
  clean: 
      rm -f D.o E.o B.o Test main.o
  
  .PHONY: all clean 
  </code></pre>
  
  <p>The error occurs if I do:</p>
  
  <pre><code>gdb Test
  </code></pre>
  
  <p>and then invoke</p>
  
  <pre><code>run
  </code></pre>
  
  <p>in the gdb CLI.</p>
  
  <p>My system:</p>
  
  <p>Open Suse 12.3, 64bit</p>
  
  <p>icpc --version:</p>
  
  <pre><code>icpc (ICC) 15.0.1 20141023
  </code></pre>
  
  <p>icpc -v:</p>
  
  <pre><code>icpc version 15.0.1 (gcc version 4.7.0 compatibility)
  </code></pre>
  
  <p>gdb --version:</p>
  
  <pre><code>GNU gdb (GDB) SUSE (7.5.1-2.1.1)
  </code></pre>
  
  <p>gcc --version:</p>
  
  <pre><code>gcc (SUSE Linux) 4.7.2 20130108 [gcc-4_7-branch revision 195012]
  </code></pre>
  
  <p>I have no idea what is wrong with the given code and why the debugger crashes. For example if I comment out the constructor of class B (which does nothing and should be equivalent to the default constructor) the error does not appear anymore.</p>