Debug with backtrace from TApplication

Hi,
I’d like to debug a GUI application running with TApplication. My problem is all my backtraces look like this:

#0  0x00007f6ea90a7438 in __GI_raise (sig=sig@entry=6)
    at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007f6ea90a903a in __GI_abort () at abort.c:89
#2  0x00007f6ea96e184d in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007f6ea96df6b6 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007f6ea96df701 in std::terminate() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007f6ea96df969 in __cxa_rethrow ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007f6eaa1b8ebc in TSystem::Run() ()
   from /opt/root/lib/libCore.so
#7  0x00007f6eaa1e190f in TApplication::Run(bool) ()
   from /opt/root/lib/libCore.so
#8  0x000000000042b283 in main (argc=3, argv=<optimized out>)
    at /workspaces/bin/gui.cpp:77

is there a way to get information what happened in client classes running under the TApplication, such as where exactly the original exception was thrown?


ROOT Version: 6.08
Platform: Ubuntu 16.04
Compiler: gcc-5.4.0


Compile your application adding the “-g” option.
Then run it under a debugger, e.g.: “gdb your_application
When it dies, execute the gdb “where” command (you can then also inspect local variables).

Thanks @Wile_E_Coyote, this is exactly what I’m doing. My problem is that all the exceptions seem to be caught and re-thrown in the event loop, the only locals are in abort and main() frame

Hi @mfila ,

and welcome to the ROOT forum!

Since the exception is thrown from ROOT library code, you will need a debug build of ROOT.
On LXPLUS you can get one e.g. with source /cvmfs/sft.cern.ch/lcg/views/LCG_102/x86_64-centos7-gcc11-dbg/setup.sh. Otherwise you will have to compile ROOT from source passing the extra cmake option -DCMAKE_BUILD_TYPE=Debug.

Additionally, if this is an interpreted macro rather than a compiled program, you will have to either transform it to a standard C++ compile program (e.g. adding a main function and including the required headers), or compile it via ACLiC (root macro.C+g, where + compiles via ACLiC rather than using the interpreter and g requests debug symbols), or use the ROOT master branch and have the special CLING_DEBUG=1 environment variable set when calling the interpreter.

I hope this helps!
Enrico

Additional idea: consider using QtCreator, it might help you with finding the error:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.