Page 1 of 1

Cannot hit breakpoint in Windows XP

Posted: Sat Jul 02, 2011 9:11 pm
by maylow
Hello,

I just installed CodeLite on both my Windows XP and Ubuntu systems. On Ubuntu everything is ok (latest version of CodeLite from the web site). In Windows XP CodeLite version is 2.10.0.4778. I've created a new project: Console, Simple executable, gnu g++, GNU gdb debugger. Only one file main.cpp, with the following code:

Code: Select all

#include <stdio.h>

int main(int argc, char **argv)
{
	printf("hello world\n");
	return 0;
}
Breakpoint on line 7, "printf("hello world\n");"

Build output:

Code: Select all

----------Build Started--------
C:\WINDOWS\system32\cmd.exe /c ""mingw32-make.exe"  -j 2 -f "debugTest_wsp.mk""
----------Building project:[ debugTest - Debug ]----------
mingw32-make.exe[1]: Entering directory `C:/Program Files/CodeLite/debugTest/debugTest'
g++ -o ./Debug/debugTest ./Debug/main.o  -L.   
mingw32-make.exe[1]: Leaving directory `C:/Program Files/CodeLite/debugTest/debugTest'
----------Build Ended----------
0 errors, 0 warnings
The program runs and exits when started with F5, the following is the output of the Debug output pane:

Code: Select all

Using gdbinit file: C:\DOCUME~1\daniel\LOCALS~1\Temp\codelite_gdbinit.txt
Current working dir: C:\Program Files\CodeLite\debugTest\debugTest
Launching gdb from : ./Debug
Starting debugger  : gdb --command="C:\DOCUME~1\daniel\LOCALS~1\Temp\codelite_gdbinit.txt" --interpreter=mi "./debugTest"
Debug session started successfully!
GNU gdb (GDB) 7.0.1
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from C:\Program Files\CodeLite\debugTest\debugTest\Debug/./debugTest.exe...
done.
[New Thread 15432.0x3a60]
Continuing...
Debuggee process ID: 15432
Internal breakpoint was hit (id=1), Applying user breakpoints and continuing
Successfully set breakpoint 2 at: C:\Program Files\CodeLite\debugTest\debugTest\main.cpp:5
Continuing...
Program exited normally.
Debug session ended
The IDE never stops on the breakpoint. Same project/same actions on Ubuntu stop on the breakpoint.

Any advice would be appreciated.

Update: Cannot hit breakpoint in Windows XP

Posted: Sat Jul 02, 2011 9:15 pm
by maylow
Just noticed that the compiler command line does not include the "-g" switch.

Code: Select all

gcc -o ./Debug/debugTest ./Debug/main.o  -L. 
In Project/Settings/Compiler the switch is set for both g++ and gcc compilers.

Re: Cannot hit breakpoint in Windows XP

Posted: Sat Jul 02, 2011 9:32 pm
by eranif
The problem here is that you set the breakpoint at the first line of 'main' (line 5, printf(...))
Internal breakpoint was hit (id=1), Applying user breakpoints and continuing
this tells me that the option:
'Settings | Debugger Settings... | Apply breakpoints after main function is hit' is also enabled.
so u have 2 breakpoints on the same line (line 5):
  • codelite will place a temporary breakpoint in main which happens to be line 5...
  • Your breakpoint
When the breakpoint hit, codelite applied YOUR breakpoint and issued a continue command:
Successfully set breakpoint 2 at: C:\Program Files\CodeLite\debugTest\debugTest\main.cpp:5
and continued
Continuing...
To avoid this either:
- Disable the above option (not recommended)
- Place your breakpoint anywhere but on the first line of main

Eran
To