How can I stop a macro at a certain point to check variables etc.?

I would like a functionality similar to IPython embed where I can put a flag inside a .C macro to stop it running at that point and open a root prompt to check the variable values for debugging purposes. How can I achieve this ?

Thank you for your time

Hi @omartarif and welcome on the ROOT forum.

You can compile your macro in g++, as shown here

g++ demo1.cxx $(root-config --glibs --cflags --libs) -o demo1

To create an executable file, in order to use the gdb debugger add the option -g

g++ demo1.cxx $(root-config --glibs --cflags --libs) -o demo1 -g 

the run your executable with gdb

gdb demo1

You will enter gdb and use it. You can google tons of tutorials on how to use it.


Or you can just simply print on screen your variables in different point of your code.