News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

How to use CodeBlocks's debuger environment to debug external program?

Started by photon3108, April 13, 2011, 05:00:10 AM

Previous topic - Next topic

photon3108

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.

MortenMacFly

Quote from: photon3108 on April 13, 2011, 05:00:10 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

oBFusCATed

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!]

zhengwc

hi, oBFusCATed .
can you tell me how to debug external program by custom makefile concretely?

oBFusCATed

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!]

zhengwc

Thank you!
    oBFusCATed,but how to add the makefile to the project?

ollydbg

Quote from: zhengwc on April 14, 2011, 04:09:11 AM
Thank you!
    oBFusCATed,but how to add the makefile to the project?
look:

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

zhengwc

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.

Jenna

Quote from: 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.
You have to fix the settings in the Projects build options in tab "Make commands".

zhengwc

Thank you!
   Just like the value of build project/target is "$make -f $makefile $target" in tab make commands.what can I do?

Jenna

Quote from: 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?
$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.