How do I halt the continuing in GDB

Viewed 58330

I'm pretty much using GDB for the first time. I run

$ gdb

then I'm running

attach <mypid>

then I see that my process is stuck (which is probably ok). Now I want it to continue running, so I run

continue

and my process continues running but from here I'm stuck if I want again to watch my current stack trace etc. I couldn't get out of continuing... I tried Ctrl-D etc. but nothing worked for me... (was just a guess).

4 Answers

You should interrupt the process that is attached by gdb. Do not interrupt gdb itself. Interrupt the process by either ctrl-c in the terminal in which the process was started or send the process the SIGINT by kill -2 procid. With procid the id of the process being attached.

interrupt

gdb> help interrupt
Interrupt the execution of the debugged program.
If non-stop mode is enabled, interrupt only the current thread,
otherwise all the threads in the program are stopped.  To 
interrupt all running threads in non-stop mode, use the -a option.

interrupt cmd also send SIGINT to debugged process.

gdb> info thread
Cannot execute this command while the target is running.
Use the "interrupt" command to stop the target
and then try again.

gdb> interrupt
[New Thread 27138.27266]
[New Thread 27138.27267]
[New Thread 27138.27268]
[New Thread 27138.27269]
[New Thread 27138.27270]

Thread 1 "loader" received signal SIGINT, Interrupt.
0x0000007fb7c02e90 in nanosleep () from target:/system/lib64/libc.so
Related