Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I halt the continuing in GDB

Tags:

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).

like image 401
Jas Avatar asked Aug 14 '10 12:08

Jas


People also ask

How do you stop an infinite loop in GDB?

Like you can cancel a program on the command line, GDB lets you use ctrl-c to stop a program wherever it currently is. Hit ctrl-c now to break the infinite loop.

Why is GDB not stopping at breakpoint?

GDB normally ignores breakpoints when it resumes execution, until at least one instruction has been executed. If it did not do this, you would be unable to proceed past a breakpoint without first disabling the breakpoint. This rule applies whether or not the breakpoint already existed when your program stopped.


1 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.

like image 64
Lopje Avatar answered Sep 19 '22 05:09

Lopje