Can we use step in GDB without breakpoints?
First, thank you for all the helps so far.
In Visual Studio, we can do Debug -> Step In without setting any breakpoints. In GDB, it seems like we HAVE to use breakpoints.
int main ()
{
int a = 10;
int b = 111;
return 0;
}
My goal is to find the addresses of each variable (say int a, int b). I want to know the values before and 开发者_如何学运维after the assignment of a and b.
If we compile and run gdb on this source code, the program will terminate, and we don't have a way to trace the stack.
So is there a way to step one single statement at a time in GDB like we do in VS?
Thanks. (no breakpoint, cannot use cout....no watchers..)
Yes, you can step in with step (s) command. First you start the program (as opposed to using run), so it would stop at the beginning.
You can put a breakpoint in main and then step line by line using next
. VS does that implicitly.
精彩评论