如何使用Makefile for C生成调试符号? [Linux] [英] How to generate Debug symbols with Makefile for C? [Linux]

查看:311
本文介绍了如何使用Makefile for C生成调试符号? [Linux]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用GDB和KDEvelop在Knoppix VM下调试控制台应用程序. KDevelop和GDB不会在我的断点处中断.我怀疑是因为它们没有调试符号.

I'm trying to use GDB and KDEvelop to debug a console app under Knoppix VM. KDevelop and GDB don't break at my breakpoints. I suspect it's because they don't have debug symbols.

如果我是正确的,我该如何更改我的Makefile来创建它们.也许问题出在其他地方?

If I'm correct how do I need to change my Makefile to create those. Maybe the problem is somewhere else?

关于, 爱丽儿

推荐答案

在发送给编译器和链接器的标志中包含-g.缺省的变量分别是CFLAGSLDFLAGS.

Include -g in the flags sent to the compiler and linker. The default variables for this are CFLAGS and LDFLAGS respectively.

第二步:将-s从标志中排除(-s表示)

The second step: exclude -s from flags (-s means strip)

这篇关于如何使用Makefile for C生成调试符号? [Linux]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆