OK, I did enable the full debugger logging. I am including the code as well as the debug log listing.
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!\n" ;
int L =1;
L +=L; //breakpoint here
cout << L;
return 0;
}
and the debugger output:
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: /home/jlo/Programming/c++/SecondTry/
Adding source dir: /home/jlo/Programming/c++/SecondTry/
Adding file: /home/jlo/Programming/c++/SecondTry/bin/Debug/SecondTry
Changing directory to: /home/jlo/Programming/c++/SecondTry/.
Set variable: LD_LIBRARY_PATH=.:
[debug]Command-line: /usr/bin/gdb -nx -fullname -quiet -args /home/jlo/Programming/c++/SecondTry/bin/Debug/SecondTry
[debug]Working dir : /home/jlo/Programming/c++/SecondTry
Starting debugger: /usr/bin/gdb -nx -fullname -quiet -args /home/jlo/Programming/c++/SecondTry/bin/Debug/SecondTry
done
[debug]Reading symbols from /home/jlo/Programming/c++/SecondTry/bin/Debug/SecondTry...done.
[debug](gdb)
[debug]> set prompt >>>>>>cb_gdb:
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
[debug]>>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9
[debug]Copyright (C) 2015 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law. Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "x86_64-linux-gnu".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off
Debugger name and version: GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor intel
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source /usr/share/codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory /home/jlo/Programming/c++/SecondTry/
[debug]Source directories searched: /home/jlo/Programming/c++/SecondTry:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "/home/jlo/Programming/c++/SecondTry/main.cpp:9"
[debug]Breakpoint 2 at 0x4007f4: file /home/jlo/Programming/c++/SecondTry/main.cpp, line 9.
[debug]>>>>>>cb_gdb:
[debug]> tty /dev/pts/19
[debug]Queued:[tty /dev/pts/19]
[debug]>>>>>>cb_gdb:
[debug]> start
[debug]Temporary breakpoint 3 at 0x4007de: file /home/jlo/Programming/c++/SecondTry/main.cpp, line 7.
[debug]Starting program: /home/jlo/Programming/c++/SecondTry/bin/Debug/SecondTry
[debug]Temporary breakpoint 3, main () at /home/jlo/Programming/c++/SecondTry/main.cpp:7
[debug]/home/jlo/Programming/c++/SecondTry/main.cpp:7:56:beg:0x4007de
[debug]>>>>>>cb_gdb:
At /home/jlo/Programming/c++/SecondTry/main.cpp:7
[debug]> info program
[debug] Using the running image of child process 10961.
[debug]Program stopped at 0x4007de.
[debug]It stopped at a breakpoint that has since been deleted.
[debug]Type "info stack" or "info registers" for more information.
[debug]>>>>>>cb_gdb:
[debug]> quit
Debugger finished with status 0
The debugger output may be too long, should it have been inserted another way ?
Your description is a bit confusing...
To be honest i don't understand anything you are writing. So lets try to clear things up a bit:
NOTE: I have no idea how big your understanding of compiler and debugger is, so the following list is written as easy as possible. Don't be offended by the noobish writing, but you have a problem and we are trying to fix it. I request you to follow the steps, step by step so we can somehow localize the error.
1) Create a new c++ project. Let everything as it is. Make sure you save the project in a location where you have permission to write (your home directory would be fine)
2) Hit the compile and run button --> The project should build and run fine...
3) Add a breakpoint on the
cout << "Hello world!" << endl;
line. This should be the 7. line of code
4) Make sure you have selected the "Debug" target in the drop down menu near the build tool bar
5) Hit the debug button (red arrow, or hit F8)
6) The debugger should stop at this line.
6a) if not: Post a full rebuild log (hit the blue arrows near the build button) and post the log from the build log tab
6b) if it is working: lets go to your project..
7) In your project (I hope you use projects. Debugging is only possible with projects):
8) Make sure you have selected the "Debug" target as described in 4)
9) Hit the rebuild button (blue arrows near the build button or "Build->Rebuild" menu entry
10) set a breakpoint on line
11) Hit the debug button (red arrow, or hit F8)
12) The debugger should stop here. Make sure that you have focus to codeblocks. It is possible that a other window takes the focus from codeblocks away, so after the cmd window opened go straight to the codeblocks window. It should indicate the position of the current executed code with a yellow arrow over the breakpoint symbol. If you see the arrow you are successfully debugging.
13) If you are confused about the look, make sure that you have enabled the debugger view with "View->Perspectives->GCB/CDB debugger:default"
13 a) If you have somehow overwritten this perspective you can show the debugger windows with "Debug->Debugging Windows->Call Stack" etc.
14) If all this does not work post the full rebuild log from step 9)
greetings