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

**URL:** <https://root-forum.cern.ch/t/how-can-i-stop-a-macro-at-a-certain-point-to-check-variables-etc/52811>\
**Category:** Newbie\
**Created:** [December 17, 2022, 1:13pm UTC](https://root-forum.cern.ch/t/how-can-i-stop-a-macro-at-a-certain-point-to-check-variables-etc/52811 "2022-12-17T13:13:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![omartarif](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/omartarif/32/31881_2.png) [@omartarif](https://root-forum.cern.ch/u/omartarif)\
**Post date:** [December 17, 2022, 1:13pm UTC](https://root-forum.cern.ch/t/how-can-i-stop-a-macro-at-a-certain-point-to-check-variables-etc/52811/1 "2022-12-17T13:13:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dilicus](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dilicus/32/14338_2.png) [@Dilicus](https://root-forum.cern.ch/u/Dilicus)\
**Post date:** [December 20, 2022, 9:32am UTC](https://root-forum.cern.ch/t/how-can-i-stop-a-macro-at-a-certain-point-to-check-variables-etc/52811/2 "2022-12-20T09:32:33Z")

</div>

Hi @omartarif and welcome on the ROOT forum.

You can compile your macro in g++, as shown [here](https://root.cern/manual/creating_a_user_application/#batch-example-generating-a-pdf-file)

```auto
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

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

```

the run your executable with gdb

```auto
gdb demo1

```

You will enter gdb and use it. You can [google](https://www.google.com/search?q=how+to+use+gdb+&ei=P3-hY4TUH7uOxc8PheuowAU&ved=0ahUKEwjE75v_74f8AhU7R_EDHYU1ClgQ4dUDCA8&uact=5&oq=how+to+use+gdb+&gs_lcp=Cgxnd3Mtd2l6LXNlcnAQAzIFCAAQgAQyBQgAEIAEMgYIABAWEB4yBggAEBYQHjIGCAAQFhAeMgYIABAWEB4yBggAEBYQHjIGCAAQFhAeMgYIABAWEB4yBggAEBYQHjoKCAAQRxDWBBCwAzoLCAAQgAQQsQMQgwE6BQguEIAEOggILhCABBCxAzoECAAQAzoICAAQsQMQgwE6EQguEIAEELEDEIMBEMcBENEDOgQIABBDOg4ILhDHARCxAxDRAxCABDoLCC4QgAQQsQMQgwE6CwguEIAEEMcBEK8BOggIABCABBCxAzoFCAAQsQM6CwguEIAEELEDENQCOggILhCABBDUAjoHCAAQgAQQEzoICAAQFhAeEBNKBAhBGABKBAhGGABQjwxYr0Fg_kNoA3ABeACAAWKIAb0GkgECMTCYAQCgAQHIAQfAAQE&sclient=gws-wiz-serp) tons of tutorials on how to use it.

* * *

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