Matej Gomboc
Matej Gomboc

Reputation: 161

Linux Makefile project debugging best practices and tools

I'm comming from Windows background and are diving a little into Linux programming. I'm interested, what are the best practices in debugging a classical Makefile project (breakpoints, stepping, call stack, ...) in Linux using GCC ?

Best regards !

Upvotes: 0

Views: 155

Answers (1)

boyvinall
boyvinall

Reputation: 1907

I'm not sure what you mean by debugging a makefile project with gcc. However, if you have a GNU makefile which is causing you problems, then I can HIGHLY recommend the following:

  1. start with make --debug, it will tell you lots about which rule is being executed and which target patterns were being matched against etc.

  2. install remake. it's absolutely the best thing sinced sliced makefiles. Start with its debug output remake -x. If you're still confused, use the interactive mode remake -X. In the interactive console, type h for help, t to get info on the current target and s to single step. 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.

Upvotes: 2

Related Questions