Debugging Root programs with gdb and core files

Hello,
Something went wrong with running my Root C++ based program and core was dumped.
The root program is launched from a python script with the command

ROOT.ReadTree( list of arguments )

I would like to use gdb and the core file to see what is wrong.

How should I proceed? The trick is that the C++ file was launched through a python script via Root.

How in general (i.e. running in gdb, without using a core file) can I use gdb to debug programs launched in the way described above?

Cheers,
Viesturs

Hi Viesturs,

It depends on what you mean by " launched through a python script". If this means that it was launched as a separate process, your easiest route is likely to use a core file (like with ‘gdb root.exe core_file’). If you are executing C++ function through PyROOT, you can run gdb on the python executable:gdb python gdb> run python_script.py

Cheers,
Philippe.

Thanks.
What is the meaning of root.exe?

Hi,

‘root.exe’ is the (file)name of the main ROOT executable; its starts a C++ interpreter (cling) as the command line prompt or can execute C++ scripts and commands passed as argument.

Cheers,
Philippe.

Oh I understood.
No, I don’t enter CLING (i.e. type root -l) to run my programs.
I use PyRoot (i.e. compiling my own macros) and already tested your method of running PyRoot in gdb.

So I test core files due to PyRoot as you suggested

gdb root.exe core.file?

Cheers,
Viesturs

Hi,

I am guessing you use the python executable so it would be:gdb python core.file

Cheers,
Philippe.

I see.
Now when I do as you suggest and ask for backtrace (type bt) valuable information appears. Thanks.
Viesturs