I do try to gdb debug my game opendungeons-plus. I downloaded the snap bundle and did : unsquashfs opendungeons-plus_175.snap sudo snap try squashfs-root then gdb --args snap run opendungeons-plus
I figured out I need to export and set many variables such as :
Snap + system libraries
set environment LD_LIBRARY_PATH=/usr/lib64:/snap/opendungeons-plus/current/usr/lib:/snap/opendungeons-plus/current/usr/lib/x86_64-linux-gnu:/snap/opendungeons-plus/current/usr/lib/cegui-0.9999:/snap/opendungeons-plus/current/usr/lib/openal
Force OpenAL to use host PulseAudio
set environment ALSOFT_DRIVERS=pulse set environment SDL_AUDIODRIVER=pulse set environment PULSE_SERVER=unix:/run/user/1000/pulse/native set environment ALSOFT_CONF=/snap/opendungeons-plus/current/usr/share/openal/alsoftrc
CEGUI modules
set environment CEGUI_MODULE_DIR=/snap/opendungeons-plus/current/usr/lib/cegui-0.9999 set environment CEGUI_PLUGIN_DIR=/snap/opendungeons-plus/current/usr/lib/cegui-0.9999
Game data/config
set environment XDG_DATA_DIRS=/snap/opendungeons-plus/current/usr/share:/usr/share
Optional OpenAL debug log
set environment ALSOFT_LOGLEVEL=3
That way even the OpenAL works ! But I get stuck when it tries to create the OpenGl context ( this happens only with the gdb debugging method mentioned above ) :
backtrace :
(gdb) bt
#0 0x00007ffff5cc5631 in __cxa_throw () from /usr/lib64/libstdc++.so.6
#1 0x00007fffe8de5962 in Ogre::ExceptionFactory::_throwException (code=Ogre::Exception::ERR_RENDERINGAPI_ERROR, number=3, desc="Fail to make context current", src="setCurrent",
file=0x7fffe8e30a20 "/home/tom/Downloads/ogre-13.6.5/RenderSystems/GLSupport/src/EGL/OgreEGLContext.cpp", line=140)
at /home/tom/Downloads/ogre-13.6.5/OgreMain/include/OgreException.h:264
#2 Ogre::ExceptionFactory::throwException (code=Ogre::Exception::ERR_RENDERINGAPI_ERROR, desc="Fail to make context current", src="setCurrent",
file=0x7fffe8e30a20 "/home/tom/Downloads/ogre-13.6.5/RenderSystems/GLSupport/src/EGL/OgreEGLContext.cpp", line=140)
at /home/tom/Downloads/ogre-13.6.5/OgreMain/include/OgreException.h:280
#3 Ogre::EGLContext::setCurrent (this=<optimized out>) at /home/tom/Downloads/ogre-13.6.5/RenderSystems/GLSupport/src/EGL/OgreEGLContext.cpp:140
#4 0x00007fffe8e1ba04 in Ogre::EGLContext::EGLContext (this=this@entry=0x5555565b7ba0, eglDisplay=0x555555d935e0, glsupport=<optimized out>, glconfig=0xcaf329, drawable=0x555555e5ba81,
external=external@entry=0x0) at /home/tom/Downloads/ogre-13.6.5/RenderSystems/GLSupport/src/EGL/OgreEGLContext.cpp:68
#5 0x00007fffe8e0ca60 in Ogre::EGLWindow::createEGLContext (this=0x555556409dd0, external=0x0) at /home/tom/Downloads/ogre-13.6.5/RenderSystems/GLSupport/include/EGL/OgreEGLWindow.h:55
#6 Ogre::X11EGLWindow::create (this=0x555556409dd0, name="OpenDungeons 0.7.1", width=<optimized out>, height=<optimized out>, fullScreen=<optimized out>, miscParams=0x7fffffffa860)
at /home/tom/Downloads/ogre-13.6.5/RenderSystems/GLSupport/src/EGL/X11/OgreX11EGLWindow.cpp:364
#7 0x00007fffe8e0ae0f in Ogre::X11EGLSupport::newWindow (this=0x555555da3db0, name="OpenDungeons 0.7.1", width=1920, height=1200, fullScreen=true, miscParams=0x7fffffffa860)
at /home/tom/Downloads/ogre-13.6.5/RenderSystems/GLSupport/src/EGL/X11/OgreX11EGLSupport.cpp:178
#8 0x00007fffe8dfd6a3 in Ogre::GL3PlusRenderSystem::_createRenderWindow (this=0x555555dbc280, name="OpenDungeons 0.7.1", width=1920, height=1200, fullScreen=true,
miscParams=0x7fffffffa860) at /home/tom/Downloads/ogre-13.6.5/RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp:550
#9 0x00007ffff6d9010a in Ogre::Root::createRenderWindow (this=0x7fffffffb1c0, name="OpenDungeons 0.7.1", width=1920, height=1200, fullScreen=true, miscParams=0x7fffffffa860)
at /build/opendungeons-plus/parts/ogre/src/OgreMain/src/OgreRoot.cpp:1067
#10 0x00005555559c7636 in <lambda()>::operator()(void) const (__closure=0x7fffffffaac0) at /build/opendungeons-plus/parts/opendungeons-plus/src/source/ODApplication.cpp:197
#11 0x00005555559c7e7c in ODApplication::startClient (this=0x7fffffffcb30) at /build/opendungeons-plus/parts/opendungeons-plus/src/source/ODApplication.cpp:198
#12 0x00005555559c6d3e in ODApplication::startGame (this=0x7fffffffcb30, options=...) at /build/opendungeons-plus/parts/opendungeons-plus/src/source/ODApplication.cpp:81
#13 0x00005555559ca879 in main (argc=1, argv=0x7fffffffcf68) at /build/opendungeons-plus/parts/opendungeons-plus/src/source/main.cpp:87
I have tried with both fullscreen and windowed mode … Any thoughts what I could do more ? How do you debug your applications, is there an easier way ?