5

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?
  • ?
3
  • 1
    Yes, in your situation I would try first to upgrade GDB to latest version. And then, if still crashing, try with LLDB. Good luck. Commented Sep 17, 2021 at 9:50
  • Maybe you can try to enable Address Sanitizer. Probably that the sanitizer will catch the error, and maybe it is give you an meaningful report. Maybe GDB will not crash in that situation. Commented Sep 17, 2021 at 9:53
  • Another possible solution: swap compiler. I was using clang and got this error. swapping to gcc did the job. Otherwise switch to older compilers, as newer compilers can cause problems for gdb. Commented Sep 24, 2021 at 12:48

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.