如何调试C程序 [英] How to debug a C program
本文介绍了如何调试C程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 Linux
, GCC
和 C
我有一个make文件。
I have a make file.
我想要调试我的模块。我不想调试一个文件,我想调试整个模块。
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的文档是 here ,但实质上是:
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
如果您想要一个用户友好的GUI用于gdb,请查看 DDD 或 Insight 。
If you want a user-friendly GUI for gdb, take a look at DDD or Insight.
这篇关于如何调试C程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文