Page 1 of 2

Bug: setting breakpoints in DLLs/Shared Objects

Posted: Mon Mar 22, 2010 2:07 am
by kspes
I've noticed a small bug in CodeLite (observed in Windows and Linux) and it's quite irritating:

1) set a breakpoint in a cpp file that belongs to a dll or .so of a library the main target is using
2) when launching the app, codelite fails in setting the breakpoint

however, if you break on main(), run the debugger and then set the breakpoint in the dll, everything works fine!

This does not occur with static libs

Re: Bug: setting breakpoints in DLLs/Shared Objects

Posted: Mon Mar 22, 2010 2:10 am
by kspes
oh, and some more info that might help:

1) using codlelite 2.3 (also occured on 2.2)
2) Windows and Linux
3) stock mingw (4.4.0) and Ubuntu's g++/gdb on Linux

Re: Bug: setting breakpoints in DLLs/Shared Objects

Posted: Mon Mar 22, 2010 4:22 am
by eranif
This is how gdb behaves - you can turn on the debugger log and see it for your self :)

Note that once codelite fails to set a breakpoint, there is a new button in the 'Debugger' tab with the label "Set Pending" - you can let the debugger continue until your program is loaded and once loaded, hit that button and codelite will re-apply the failed breakpoints.

Another options, is make sure that pending breakpoints option is enabled (settings -> debugger settings )

Eran

Re: Bug: setting breakpoints in DLLs/Shared Objects

Posted: Mon Mar 22, 2010 12:50 pm
by kspes
I have enabled pending breakpoints and the problem still occurs (btw, why would anyone want to turn this feature off?)

here's the debug output on Linux:
DEBUG>>00000004^error,msg="No source file named /home/kreso/projects/brawe/april/rendersystems/OpenGL/RenderSystem_GL.cpp."
Breakpoint creation unsuccessful
ERROR: failed to place breakpoint: "^error,msg="No source file named /home/kreso/projects/brawe/april/rendersystems/OpenGL/RenderSystem_GL.cpp.""
No source file named /home/kreso/projects/brawe/april/rendersystems/OpenGL/RenderSystem_GL.cpp.
and on Windows:
DEBUG>>00000537^error,msg="No source file named C:/projects/brawe/april/rendersystems/OpenGL/RenderSystem_GL.cpp."
Breakpoint creation unsuccessful
ERROR: failed to place breakpoint: "^error,msg="No source file named C:/projects/brawe/april/rendersystems/OpenGL/RenderSystem_GL.cpp.""
No source file named C:/projects/brawe/april/rendersystems/OpenGL/RenderSystem_GL.cpp.
once the program is loaded, setting the breakpoint gives this output:
[Switching to Thread 1516.0x904]
DEBUG>>*stopped,reason="signal-received",signal-name="SIGTRAP",signal-meaning="Trace/breakpoint trap",frame={addr="0x7c901231",func="ntdll!DbgUiConnectToDbg",args=[],from="C:\\WINDOWS\\system32\\ntdll.dll"},thread-id="2",stopped-threads="all"
Program Received signal SIGTRAP
DEBUG>>00000542-var-create - * "dynamic"
DEBUG>>00000540^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x65241f9b",func="April::GLRenderSystem::loadTexture(std::string, bool)",file="C:/projects/brawe/april/rendersystems/OpenGL/RenderSystem_GL.cpp",fullname="C:/projects/brawe/april/rendersystems/OpenGL/RenderSystem_GL.cpp",line="210",times="0",original-location="\"C:/projects/brawe/april/rendersystems/OpenGL/RenderSystem_GL.cpp:210"}
Found the breakpoint ID!
Storing debugger breakpoint Id=1
Successfully set breakpoint 1 at: C:\projects\brawe\april\rendersystems\OpenGL\RenderSystem_GL.cpp:210
DEBUG>>00000541^running
Continuing...

Re: Bug: setting breakpoints in DLLs/Shared Objects

Posted: Mon Mar 22, 2010 12:59 pm
by eranif
kspes wrote:once the program is loaded, setting the breakpoint gives this output:
Try to modify your breakpoint to function:
Right click the breakpoint marker, and change it to be 'Function' maybe this will work better

Eran

Re: Bug: setting breakpoints in DLLs/Shared Objects

Posted: Mon Mar 22, 2010 1:18 pm
by kspes
I set a breakpoint, right click -> edit: set the function name (tried with and without namespace markers), but the breakpoint just dissapeared and ofcourse, the program didn't break when debugged.

Re: Bug: setting breakpoints in DLLs/Shared Objects

Posted: Mon Mar 22, 2010 1:57 pm
by DavidGH
Hi,
here's the debug output on Linux:
gdb's 'Enable pending breakpoints' just doesn't seem to work on Linux :(

Did you look for the 'Set Pending' button on the Breakpoints tab? This situation is what it was created for. If it doesn't appear, then there is indeed a bug.

Regards,

David

Re: Bug: setting breakpoints in DLLs/Shared Objects

Posted: Mon Mar 22, 2010 2:37 pm
by kspes
I don't think the pending button is shown. here's a screenshot from my linux box.

IMHO, wouldn't it be better to set all the breakpoints when the program fully launches? eg, break at main, set all the breakpoints , remove main breakpoint and continue?

Re: Bug: setting breakpoints in DLLs/Shared Objects

Posted: Mon Mar 22, 2010 3:44 pm
by eranif
kspes wrote:I don't think the pending button is shown. here's a screenshot from my linux box.

IMHO, wouldn't it be better to set all the breakpoints when the program fully launches? eg, break at main, set all the breakpoints , remove main breakpoint and continue?
The button should appear in the 'Breakpoints' tab (which you are not showing in the screenshot)

It could be a good idea to place them after main starts - you could open a feature request for this, or send me a patch :)

Eran

Re: Bug: setting breakpoints in DLLs/Shared Objects

Posted: Mon Mar 22, 2010 4:12 pm
by kspes