Search code examples
openglgdbfreeglut

freeglut segfaults, no useful info from gdb


In this program I'm writing, I've been using freeglut and, generally, it has been working. However, sometimes when there is some issue in the program that often has nothing to do with rendering at all, I get a segfault at glutInit() and no explanation from GDB.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7942409 in glutInit () from /usr/lib/x86_64-linux-gnu/libglut.so.3

Backtrace:

#0  0x00007ffff7942409 in glutInit () from /usr/lib/x86_64-linux-gnu/libglut.so.3
#1  0x0000000000415d4c in initGL () at ../gfx/render.cpp:62
#2  0x00000000004035f3 in main () at battle.cpp:49

Running with rendering disabled produces no errors.

So, I am wondering what I need to do to get more information on these failures. Can I get the backtrace to look inside liblut.so.3?

(As an aside, any recommendations for a more reliable toolkit than freeglut are appreciated.)


Solution

  • Can I get the backtrace to look inside liblut.so.3?

    You already have a backtrace that is looking inside libglut.so.3.

    You need to either

    • install debug symbols for it (sudo apt-get install freeglut3-dbg or some such), or
    • compile libglut.so from source, or
    • debug at assembly level: x/i $pc, disas, info registers, etc.