GDB操纵运行程序的过程。
GDB会话的一个例子:也许对你有所帮助
% cat hello.c
#include<stdio.h>
main() {
int count;
for (count=0;count<10;count++)
printf("Hello from CETS!\n");
}
% gcc -g hello.c
% gdb ./a.out
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.13 (sparc-sun-solaris2.3),
Copyright 1994 Free Software Foundation, Inc...
(gdb) b main
Breakpoint 1 at 0x10784: file hello.c, line 6.
(gdb) r
Starting program: /home1/b/bozo/./a.out
Breakpoint 1, main() at hello.c:6
6 for (count=0;count<10;count++)
(gdb) s
7 printf("Hello from CETS!\n");
(gdb) p count
$1 = 0
(gdb) disp count
1: count = 0
(gdb) set count=8
(gdb) s
Hello from CETS!
6 for (count=0;count<10;count++)
1: count = 8
(gdb)
7 printf("Hello from CETS!\n");
1: count = 9
(gdb) c
Continuing.
Hello from CETS!
Program exited with code 01.
(gdb) q
%
内容:
http://www.cs.swarthmore.edu/~newhall/unixhelp/howto_gdb.html
http://www.ifp.illinois.edu/~nakazato/tips/xgcc.html#GDB
http://www.seas.upenn.edu/cets/answers/gcc.html
我怕我不真的看到这是如何回答这个问题的。当你使用clion时,你不会直接与gdb进行交互。这是一个IDE。 – jep
@jep,对不起。只是试图帮助(: – Alex29954
没关系,只是确保我没有错过任何东西,或者在我的问题中不够清楚。 – jep