Author Topic: Debugging custom makefile project  (Read 6423 times)

Offline havarti

  • Single posting newcomer
  • *
  • Posts: 9
Debugging custom makefile project
« 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?

« Last Edit: February 28, 2014, 12:56:30 pm by havarti »

Online stahta01

  • Lives here!
  • ****
  • Posts: 7789
    • My Best Post
Re: Debugging custom makefile project
« Reply #1 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.
 
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline havarti

  • Single posting newcomer
  • *
  • Posts: 9
Re: Debugging custom makefile project
« Reply #2 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?

Online stahta01

  • Lives here!
  • ****
  • Posts: 7789
    • My Best Post
Re: Debugging custom makefile project
« Reply #3 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.
« Last Edit: February 28, 2014, 01:26:01 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline havarti

  • Single posting newcomer
  • *
  • Posts: 9
Re: Debugging custom makefile project
« Reply #4 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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Debugging custom makefile project
« Reply #5 on: February 28, 2014, 08:19:07 pm »
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!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Debugging custom makefile project
« Reply #6 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).