tags:

views:

735

answers:

6

How do I stop a gdb execution without a breakpoint ?

A: 

why would you want to? what would that accomplish?

duffymo
+3  A: 

just use a regular interrupt ctrl-c will work just fine. GDB just forwards the SIGINT to the debugging process which then dies. GDB will catch the nonstandard exit and break the process there, so you can still examine all the threads, their stacks and current values of variables. This works fine though you would be better off using break points. The only time i find myself doing this is if i think ive go into some sort of inifinite loop.

luke
A: 

if I have a runaway kind of program like say a method has :

while(1) { cout<<"stuff";

}

also I a used that feature in VS2k5

anand
+2  A: 

Just type BREAK without any arguments.

Break, when called without any arguments, break sets a breakpoint at the next instruction to be executed in the selected stack frame

Chris
A: 

I tried ^C but it didn't work I am not able to type anything on the prompt.Also the program is multi threaded UI, could that be the issue ?

anand
A: 

Start a shell, find the process ID using ps and send it SIGSTOP or SIGINT by using the kill command (e.g. kill -INT pid).

zvrba