简单代码如下:
main.c
#include <stdio.h> void debug(char *str) { printf("debug info :%s\n", str); } main(int argc, char *argv[]) { int i, j; j = 0; for (i = 0; i < 10; i++) { j += 5; debug("1"); } }gcc的基本用法 gcc [options] [filenames]
详解见
1.https://www.jianshu.com/p/a29d0e0da31e
2.https://www.cnblogs.com/ibyte/p/5828445.html
3.https://blog.csdn.net/czg13548930186/article/details/78331692
在这里要程生成可执行文件:
gcc -g -o main main.cGDB调试 启动程序准备调试GDB yourpram 或者 先输入GDB 然后输入 file yourpram
本文见:
gdb main命令行输出为
具体使用见https://www.cnblogs.com/HKUI/p/8955443.html
参考:
1.https://wizardforcel.gitbooks.io/100-gdb-tips/print-STL-container.html(重点)
2.https://www.yanbinghu.com/2019/04/20/41283.html
