Author Topic: How to use CodeBlocks's debuger environment to debug external program?  (Read 6712 times)

Offline photon3108

  • Multiple posting newcomer
  • *
  • Posts: 32
I got a project. It can make and use gdb on fedora 12.

But gdb is much lesser user friendly than Codeblocks. I want
to use CodeBlocks's Debuger Environment to debug and the
problem is that this project is too big to be converted
to Codeblocks Project.

Is there any methods which can let me debug by opening any
cpp files of this project and setting breakpoint with red point
in CodeBlocks?

Thanks.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Is there any methods which can let me debug by opening any
cpp files of this project and setting breakpoint with red point
in CodeBlocks?
No, but why is you project "too big"? Even (e.g.) the Linux kernel can be developed inside C::B as a project.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
1. Switch to the debuggers nightly and use debug -> attach to process...
2. Use custom makefile project and debug -> start
(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 zhengwc

  • Single posting newcomer
  • *
  • Posts: 5
hi, oBFusCATed .
can you tell me how to debug external program by custom makefile concretely?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
The same as you debug normal C::B project...

There is checkbox for enabling custom makefile in project -> properties.
(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 zhengwc

  • Single posting newcomer
  • *
  • Posts: 5
Thank you!
    oBFusCATed,but how to add the makefile to the project?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Thank you!
    oBFusCATed,but how to add the makefile to the project?
look:

Quote
There is checkbox for enabling custom makefile in project -> properties.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline zhengwc

  • Single posting newcomer
  • *
  • Posts: 5
I find the check,but when I build, it says "No rules can create the target "debug"".so I think maybe someone else need set.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
I find the check,but when I build, it says "No rules can create the target "debug"".so I think maybe someone else need set.
You have to fix the settings in the Projects build options in tab "Make commands".

Offline zhengwc

  • Single posting newcomer
  • *
  • Posts: 5
Thank you!
   Just like the value of build project/target is "$make -f $makefile $target" in tab make commands.what can I do?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: How to use CodeBlocks's debuger environment to debug external program?
« Reply #10 on: April 14, 2011, 11:37:14 am »
Thank you!
   Just like the value of build project/target is "$make -f $makefile $target" in tab make commands.what can I do?
$target will be replaced by the target name (in your case Debug), if that is not a valid target, you have two options: either remove it completely (the default target will be used instead) or if a special taregt should be used, either use it instead of $target or rename your target in the projects properties.