News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Debugging custom makefile project

Started by havarti, February 28, 2014, 12:51:07 PM

Previous topic - Next topic

havarti

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?


stahta01

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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

havarti

Quote from: stahta01 on February 28, 2014, 01:01:37 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?

stahta01

#3
Quote from: havarti on February 28, 2014, 01:03:04 PM
Quote from: stahta01 on February 28, 2014, 01:01:37 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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

havarti

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

oBFusCATed

Please post the full log from the debugger. (you have to enable it in the settings)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Jenna

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).