4

i am setting a break point beside the int x , and setting the ide to the debug mode,but nothing appear in the debugging window when i start debugging ???

should i do something more ?

#include <iostream>

int main()
{
    using std::cin;
    using std::cout;
    using std::endl;


    int x;
    cout<<"X = "<<x<<endl<<"enter new x \n X = ";
    cin>>x;

    cout<<endl<<"New X = "<<x<<endl;


}
user1609974
  • 95
  • 1
  • 2
  • 6
  • It often works better to set a breakpoint on a line where something is actually going to execute (e.g., one of your `cout` lines). – Jerry Coffin Oct 04 '12 at 03:41
  • nothing shows up,i set many breakpoints but i am missing something i don't know:( – user1609974 Oct 04 '12 at 03:49
  • 1
    Setting a breakpoint means code execution has stopped at that line. You need to step through the lines of code, using some click or command ( I don't know about codelite). – mohit Oct 04 '12 at 04:00

2 Answers2

2

There can be several reasons for codelite not stopping:

1) Did you build your project with debugging information enabled? Make sure you select the 'Debug' configuration, this makes sure that -g is passed to gcc / g++

2) Try enabling the debugger log from: settings -> debugger settings -> GNU gdb debugger -> Misc -> enable debugger full log this will produce more information on the interaction between between codelite and gdb - it will also tell you why gdb failed to stop, the log is printed into the 'Debugger' pane, under the 'Output' tab

Remember: codelite is just an interface to gdb, so if codelite did not break, it means that gdb did not instruct it to break...

Eran

Eran
  • 2,310
  • 1
  • 13
  • 13
1

It is your ide forbids you to read uninitiated value 'int x'. I debugged it under vs2008, and the break point will automatically be removed to cout line. and continue debugging will get this :

enter image description here

Press 'continue' will get output in cmd window.

enter image description here

I hope this bring some help to you.

Al2O3
  • 3,103
  • 4
  • 26
  • 52