User forums > Using Code::Blocks
How to debug
Vic:
I am new to CodeBlocks, and try to work with the debugger an de following simple code.
--- Code: ---#include <iostream>
using namespace std;
int main()
{
int q=100;
int *p;
char c;
cout << "Hello world!" << endl; //Breakpoint 1
p= new (nothrow) int [q];
if (p == 0)
cout << "Error: memory could not be allocated";
else {
for (int i=0; i<q; i++)
p[i]= i+1;
for (int i=q-10; i<q; i++)
cout << "P " << i << " = " << p[i] << endl;
}
delete [] p;
cout << "Hello C++" << endl; //Breakpoint 2
cin >> c;
return 0;
}
--- End code ---
When i press F8 (Start debugger) the debug windows show following
--- Quote ---Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: G:\Jo\documents\TestDebug\
Adding source dir: G:\Jo\documents\TestDebug\
Adding file: bin\Debug\TestDebug.exe
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.7.50.20071127
Function "G:/Jo/Programmeren I (Van Laethem)" not defined.
Breakpoint 1 ("G:/Jo/Programmeren I (Van Laethem)/documents/CurusTest/TestDebug/main.cpp:28) pending.
Function "G:/Jo/Programmeren I (Van Laethem)" not defined.
Breakpoint 2 ("G:/Jo/Programmeren I (Van Laethem)/documents/CurusTest/TestDebug/main.cpp:12) pending.
Child process PID: 3864
Error while reading shared library symbols:
Error while reading shared library symbols:
Program exited normally.
Error while reading shared library symbols:
Error while reading shared library symbols:
Error while reading shared library symbols:
Error while reading shared library symbols:
Error while reading shared library symbols:
Error while reading shared library symbols:
Debugger finished with status 0
--- End quote ---
The program run without stop on the breakpoints .
What i do wrong, cane somebody help me.
Best Regards, Vic
Jenna:
Do not use braces ( "(" and ")" ) in your path !
Vic:
Thx for the replay.
I changed the path, but still have the same problem.
The output of the debug Window is now,
--- Quote ---Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: G:\Jo\ProgOef\TestDebug\
Adding source dir: G:\Jo\ProgOef\TestDebug\
Adding file: bin\Debug\TestDebug.exe
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.7.50.20071127
No source file named G:/Jo/ProgOef/TestDebug/main.cpp.
Breakpoint 1 ("G:/Jo/ProgOef/TestDebug/main.cpp:28) pending.
No source file named G:/Jo/ProgOef/TestDebug/main.cpp.
Breakpoint 2 ("G:/Jo/ProgOef/TestDebug/main.cpp:12) pending.
Child process PID: 4872
Error while reading shared library symbols:
Error while reading shared library symbols:
Program exited normally.
Error while reading shared library symbols:
Error while reading shared library symbols:
Error while reading shared library symbols:
Error while reading shared library symbols:
Error while reading shared library symbols:
Error while reading shared library symbols:
Debugger finished with status 0
--- End quote ---
I hope somebody can help me.
Best Regards, Vic
Jenna:
Which version of C::B, MinGW and which OS (and version) are you using ?
Did you read this : http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks?
Turning on full commandline logging (and post the build log) might also help to track down the problem: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
Vic:
Changing the Compiler logging setting to full command line was the solution for the problem. But i have seen that when i set this back to the default setting the debugger function are still working. I can't not well understand this, but all right the functions are working that is the most important thing.
I still have a small question what is the difference between the debugger function Next Line and Next Instruction? And when i use the Next Instuction function automatic the disasemby window is opend is this normal or due to a setting?
PS. The version of codeblocks 8.02, OS = Windows XP and MinGW i don't no where do i find that. It is de version skip with the download of Codeblocks 8.02
In every way thanks for the tips
Best Regards,
Vic
Navigation
[0] Message Index
[#] Next page
Go to full version