User forums > General (but related to Code::Blocks)

how to debug

(1/2) > >>

blut-lecker:
i hope u can help me, i know this question isn't directly linked to codeblocks, but i would be happy if somebody could tell me a link to a tutorial, where i can learn to debug, especially if it would be with the codeblocks ide. And yes i know, i debug with the compiler an not with the ide

thx, blut-lecker

sethjackson:

--- Quote from: blut-lecker on August 05, 2006, 05:01:22 pm ---i hope u can help me, i know this question isn't directly linked to codeblocks, but i would be happy if somebody could tell me a link to a tutorial, where i can learn to debug, especially if it would be with the codeblocks ide. And yes i know, i debug with the compiler an not with the ide

thx, blut-lecker

--- End quote ---

Well first of all when you build your project, you have to have the debug symbols turned on for your compiler.

Just build your project with debug symbols on. Turn this on in Project -> Build options -> Compiler. Then build your project. Now do Debug -> Start Debugger. :)

The Debug menu is pretty self explanatory. Just read through the menu options, and if you need more help just ask. :)

HTH

blut-lecker:
thx for your help.
if i set a breakpoint and click on run debugger, the console window opens but very fast and closes very fast, is this normal?, if yes why do i need breakpoints?
how can i read the content of a variable?, well i click on edit watches and enter i (my variable int i), so then i click on debugging windows, but i can't see the content of my variable

thx, blut-lecker

sethjackson:

--- Quote from: blut-lecker on August 05, 2006, 05:35:41 pm ---thx for your help.
if i set a breakpoint and click on run debugger, the console window opens but very fast and closes very fast, is this normal?, if yes why do i need breakpoints?
how can i read the content of a variable?, well i click on edit watches and enter i (my variable int i), so then i click on debugging windows, but i can't see the content of my variable

thx, blut-lecker

--- End quote ---

Ok first the breakpoints thing. You did compile with debug symbols on right? One other possibility is that it (your code) doesn't "use" the line you put the breakpoint on.

Try this:


--- Code: (cpp) ---int main()
{
    int test;

    test = 1;

    return 0;
}

--- End code ---

Now put breakpoints on all of the (code) lines (int test, test = 1, return 0). The debugger should "hit" your breakpoint. Also there is this really cool feature that you really should turn on. If you hover over an expression Code::Blocks will show the contents of it. Turn it on here: Settings -> Compiler and debugger -> Debugger -> (can't remember exactly lol) -> Evaluate expression under cursor.

EDIT:

By defualt Code::Blocks show the values of local variables, and function arguments to your local function. :)
Also you can right click on a variable, and tell Code::Blocks to watch it. :)

Make sure you aren't using RC2. There have been some really great improvements to the debugger in the recent nightly builds. :)

blut-lecker:
thx a lot, know i know what u mean, because now it works, i've downloaded the cb rc2 version and know it works, it seams, that i've some problems with my nightly build version, or the compiler.
but now i can debug a bit thx a lot

edit:
well i'll try to use the nightly buid version, if it works

Navigation

[0] Message Index

[#] Next page

Go to full version