Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug C++-Program which triggers internal bug in gdb?

In one of my C++-projects I found an issue related to a linked library which results in a segfault directly after starting the compiled executable. I tried to dive into the issue using gdb, but it fails with the output:

../../gdb/dwarf2/read.c:1857: internal-error: bool dwarf2_per_objfile::symtab_set_p(const dwarf2_per_cu_data*) const: Assertion `per_cu->index < this->m_symtabs.size ()' failed.

After it is an internal error I am not able to do much (except reporting it), but I still would like to be able to debug the program itself. Which options do I have for that?

  • Use of a different debugger than gdb?
  • Manual update to a newer version of gdb (currently on 10.1)?
  • Somehow catch the segfault before it is damaging the debugger?
  • ?
like image 390
arc_lupus Avatar asked Oct 14 '22 20:10

arc_lupus


1 Answers

Most likely this is already fixed gdb bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28160. It has Target Milestone 11.1, so update to a latest version of gdb which is 11.1 now. It should be fixed in that version.

like image 105
ks1322 Avatar answered Oct 19 '22 08:10

ks1322