如何调试 C 程序 [英] How to debug a C program
本文介绍了如何调试 C 程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 Linux
、GCC
和 C
.
I am using Linux
, GCC
and C
.
我有一个制作文件.
我想调试我的模块.我不想调试单个文件,我想调试整个模块.
I want to debug my module. I don't want to debug a single file, I want to debug the whole module.
我该怎么做?
推荐答案
使用 -g 标志编译您的代码,然后使用 gdb 调试器.gdb 的文档在这里,但本质上是:
Compile your code with the -g flag, and then use the gdb debugger. Documentation for gdb is here, but in essence:
gcc -g -o prog myfile.c another.c
然后:
gdb prog
如果您想要一个用户友好的 gdb GUI,请查看 DDD 或洞察.
If you want a user-friendly GUI for gdb, take a look at DDD or Insight.
这篇关于如何调试 C 程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文