Can gdb step in a root function?

I’m trying to use gdb to debug my code. In my program, I have:
chain->Process(my_work_code, “”, nentries);
I can’t step in this function, i.e, my_work_code, which I get using “MakeSelector()”.
Do you know what I can do in oder to step in my_work_code?
Thanks very much.

I might have to recompile the ROOT library with DEBUG option. I learned from the message below:


you can build the file you get from MakeSelector(“my_work_code”) with debug info by loading it with “.L my_work_code.C+g”. You can force a rebuild of the library by passing two pluses: “.L my_work_code.C++g”

Cheers, Axel.

Hi Philippe,
Thanks for reply.
Yes, I can do that when I try to run a macro. But what can I do if I’m not running a macro, say I’m trying to debug
a sframe user code?
I have added the compile option “-g” and moved the optimization options, but I just cannot step in the root function.


This depends on where you need to step from. If you really need to step into the ROOT functions (i.e TTree::Process for example), you will need to download (or recompile) a debug version of the ROOT libraries. To step into your own routine, assuming you already compile them debug, all you need it to set a break point on your routine. If you selector class is named ‘my_work_code’ then you can set the break point via:gdb > break 'my_work_code::Process(long long)'