Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: photon3108 on April 13, 2011, 05:00:10 am

Title: How to use CodeBlocks's debuger environment to debug external program?
Post by: photon3108 on April 13, 2011, 05:00:10 am
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.
Title: Re: How to use CodeBlocks's debuger environment to debug external program?
Post by: MortenMacFly on April 13, 2011, 06:29:53 am
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.
Title: Re: How to use CodeBlocks's debuger environment to debug external program?
Post by: oBFusCATed on April 13, 2011, 08:53:17 am
1. Switch to the debuggers nightly and use debug -> attach to process...
2. Use custom makefile project and debug -> start
Title: Re: How to use CodeBlocks's debuger environment to debug external program?
Post by: zhengwc on April 13, 2011, 11:45:51 am
hi, oBFusCATed .
can you tell me how to debug external program by custom makefile concretely?
Title: Re: How to use CodeBlocks's debuger environment to debug external program?
Post by: oBFusCATed on April 13, 2011, 12:25:32 pm
The same as you debug normal C::B project...

There is checkbox for enabling custom makefile in project -> properties.
Title: Re: How to use CodeBlocks's debuger environment to debug external program?
Post by: zhengwc on April 14, 2011, 04:09:11 am
Thank you!
    oBFusCATed,but how to add the makefile to the project?
Title: Re: How to use CodeBlocks's debuger environment to debug external program?
Post by: ollydbg on April 14, 2011, 04:51:16 am
Thank you!
    oBFusCATed,but how to add the makefile to the project?
look:

Quote
There is checkbox for enabling custom makefile in project -> properties.
Title: Re: How to use CodeBlocks's debuger environment to debug external program?
Post by: zhengwc on April 14, 2011, 10:00:47 am
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.
Title: Re: How to use CodeBlocks's debuger environment to debug external program?
Post by: Jenna on April 14, 2011, 10:10:02 am
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".
Title: Re: How to use CodeBlocks's debuger environment to debug external program?
Post by: zhengwc on April 14, 2011, 10:40:57 am
Thank you!
   Just like the value of build project/target is "$make -f $makefile $target" in tab make commands.what can I do?
Title: Re: How to use CodeBlocks's debuger environment to debug external program?
Post by: Jenna 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.