Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: havarti on February 28, 2014, 12:51:07 pm

Title: Debugging custom makefile project
Post by: havarti on February 28, 2014, 12:51:07 pm
Hi

I am using CB to work with a custom makefile project. Here is what I have done so far:

1) Under "project -> properties" I have checked "This is a custom makefile"
2) Under "Build Targets" I have deleted "Debug" and "Release" and added a new target with the name of my executable. It is a console app., and I have made sure that the two "Auto-genereated..." options are not checked.

When I press F9 it works as intended, the project is built and run. Now I would like to debug the project: What should I do in order to make it work? Say I follow the same approach as above: What must I do differently to make it enter debug-mode?

Title: Re: Debugging custom makefile project
Post by: stahta01 on February 28, 2014, 01:01:37 pm
I think you should do the same as if debugging an external built exe.

I know you have to tell CB where the exe is located; but, no idea how to do that.

Tim S.
 
Title: Re: Debugging custom makefile project
Post by: havarti on February 28, 2014, 01:03:04 pm
I know you have to tell CB where the exe is located; but, no idea how to do that.

That I know how to do, I did that as well in order to run custom make file. But how do I enter debug-mode?
Title: Re: Debugging custom makefile project
Post by: stahta01 on February 28, 2014, 01:24:05 pm
I know you have to tell CB where the exe is located; but, no idea how to do that.

That I know how to do, I did that as well in order to run custom make file. But how do I enter debug-mode?

Try the normal way.

"Debug" -> "Start/Continue" (F8)

The "Debug" should be to the right of "Build" menu.

Tim S.
Title: Re: Debugging custom makefile project
Post by: havarti on February 28, 2014, 04:00:17 pm
Thanks, tried what you suggested. I get the error "warning: GDB: Failed to set controlling terminal: Operation not permitted" -- but I read on this forum that one can ignore this message.

However, when I put a breakpoint, it still doesn't break at that point. So seems something is still wrong
Title: Re: Debugging custom makefile project
Post by: oBFusCATed on February 28, 2014, 08:19:07 pm
Please post the full log from the debugger. (you have to enable it in the settings)
Title: Re: Debugging custom makefile project
Post by: Jenna on February 28, 2014, 08:26:57 pm
The most important thing:
if you use custom makefiles, you are responsible to chose a debug target (if any exists) or to make sure the "-g" flag is set inside the Makefile for the target you want to debug.
And that no stripping options are set, best is to comile without optimizations, but it might or might not work with optimization, depending on your code, compiler debugger (and the versions of it).