ROOT in gdb

Say I have a short buggy script, hello.C:

double* hello(){

double *a=NULL;
std::cout <<  "Let's have a segfault: " << (*a) << std::endl;
return a;
}

Can someone please instruct me (or point me to a documentaion) on how to run this in gdb in ROOT (i.e. without actually compiling it)?

Thank you!

Hi,

Do gdb root.exe gdb> run root [] .x hello.C+

Cheers,
Philippe.

Philippe, thanks! I assume I do not need to build root with -g for this to work…how about .x hello.C+, does root by default compile it with debug options?

Hi,

With building ROOT debug, it will work but you will have less information about the ROOT parts.

Cheers,
Philippe.

Thanks again.

Philippe, sorry for pestering you – just one more question…

Say I want to place a breakpoint in hello.C, right after line 2. How would I do that?


Philippe.

Philippe.