[英]Linux Makefile project debugging best practices and tools
I'm comming from Windows background and are diving a little into Linux programming. 我来自Windows背景,正在深入研究Linux编程。 I'm interested, what are the best practices in debugging a classical Makefile project (breakpoints, stepping, call stack, ...) in Linux using GCC ?
我很感兴趣,在Linux中使用GCC调试经典Makefile项目(断点,步进,调用堆栈等)的最佳实践是什么?
Best regards ! 最好的祝福 !
I'm not sure what you mean by debugging a makefile project with gcc. 我不确定用gcc调试makefile项目是什么意思。 However, if you have a GNU makefile which is causing you problems, then I can HIGHLY recommend the following:
但是,如果您有一个导致问题的GNU makefile,那么我强烈建议您这样做:
start with make --debug
, it will tell you lots about which rule is being executed and which target patterns were being matched against etc. 从
make --debug
开始,它将告诉您很多有关正在执行哪个规则以及与哪些目标模式匹配的信息。
install remake . 安装翻拍 。 it's absolutely the best thing sinced sliced makefiles.
切成片的makefile绝对是最好的选择。 Start with its debug output
remake -x
. 从其调试输出
remake -x
。 If you're still confused, use the interactive mode remake -X
. 如果仍然感到困惑,请使用交互模式
remake -X
。 In the interactive console, type h
for help, t
to get info on the current target and s
to single step. 在交互式控制台中,键入
h
以获得帮助,键入t
获取有关当前目标的信息,并键入s
以执行单个步骤。 There's a whole bunch of other commands too but this should get you started. 还有很多其他命令,但这应该可以帮助您入门。 You can also breakpoint on make targets etc. Seriously, remake ftw.
您还可以在make目标等上设置断点。认真地重做ftw。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.