[SOLVED] Breakpoints don't break & -gw=>gw2 lazarus / 12-Debugger ---------------------------------------------------------------------- BigChimp · 2012-11-07 14:22 Lazarus trunk, FPC trunk x86, Windows. I'm trying to find out why my project breakpoints don't work. One thing I noticed: compiler options/linking/type of debug info: had selected Dwarf with sets (-gw -godwarfsets); this gives -gw2 -godwarfsets when running test. Should the caption in Lazarus be changed to Dwarf with sets (-gw2 -godwarfsets)? Have optimization none, no smartlinking, no strip symbols. Show options gives: Code: [Select] -MObjFPC -Scghi -gw2 -godwarfsets -gl -vewnhi -Filib\i386-win32 -Fu..\ -FuC:\development\lazarus_fpctrunk\lcl\units\i386-win32\win32 -FuC:\development\lazarus_fpctrunk\lcl\units\i386-win32 -FuC:\development\lazarus_fpctrunk\components\lazutils\lib\i386-win32 -FuC:\development\lazarus_fpctrunk\packager\units\i386-win32 -Fu. -FUlib\i386-win32\ -l -dLCL -dLCLwin32 I could set the breakpoints, run the debugger (gdb 7.2) but none of the breakpoints seem to be hit. Debug output for a session included. Thanks for any hints, BigChimp Edit: solved since FPC trunk r23046 ---------------------------------------------------------------------- BigChimp · 2012-11-07 14:26 Noticed that View/Debug Windows/BreakPoints showed 4 breakpoints, all state Invalid (On). Deleted them, re-added breakpoint. Breakpoint was a red background colour over the code line as expected. Ran with debugger; breakpoint turned into greenish/ochre. Breakpoints window showed invalid (on) again. ---------------------------------------------------------------------- Martin_fr · 2012-11-07 15:31 You did open the debug-output only after the app was running? This will only give the last nlines, and the important bits are missing. Better to use the log http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debu g_session You can install the package IDELazLogger to control the log from inside the IDE. Are the breakpoints in the project or a package? Your setup sounds correct still here is all the details http://wiki.lazarus.freepascal.org/Debugger_Setup And it is correct it should be -gw2 (for dwarf + sets). Though I believe -gw is identical to gw2. therefore I am not sure the caption needs changing. ---------------------------------------------------------------------- BigChimp · 2012-11-07 16:18 Thanks Martin, the breakpoints are in a project. Now stripped it down to just 1 breakpoint at the beginning of the project. As for the caption: well, it does make it a bit more consistent/clear for me if it is changed, but I can understand if you would like to keep it the same. Just recompiled fpc+lazarus (using fpcup): laz r39260; with -gw2 -godwarfsets -gl -gh -dHEAPTRC_WINDOW -O- -OoNO fpc r22946; with -gw2 -godwarfsets -gl -O- -OoNO Ran laz shortcut with Code: [Select]--debug-log=\lazdebug.txt  --debug-enable=DBG _CMD_ECHO,DBG_STATE,DBG_DATA_MONITORS,DBGMI_QUEUE_DEBUG,DBGMI_TYPE_INF O(Started laz, ran with debugger, closed laz; answered No when laz asked me to save changed project) Output attached. Thanks ---------------------------------------------------------------------- Martin_fr · 2012-11-07 16:51 Ok, I do see one attemt to set a breakpoint Quote  >> TCmdLineDebugger.SendCmdLn "info line "D:\Reinier\Documents\ SourceCode\fpc_laz_patch_playground\SQL\pasql.lpr":1191"   << TCmdLineDebugger.ReadLn "&"info line \"D:\\Reinier\\Documents\\So urceCode\\fpc_laz_patch_playground\\SQL\\pasql.lpr\":1191\n""   << TCmdLineDebugger.ReadLn "~"Line number 1191 is out of range for \"pasql.lpr\".\n"" Is that the file and line? Does the line exist, despite the debugger believe otherwise? Try using -Xe external linker (not sure it exists for win 64). in fact it seems there are no lines at all. Quote >> TCmdLineDebugger.SendCmdLn "-symbol-list-lines D:\Reinier\Doc uments\SourceCode\fpc_laz_patch_playground\SQL\pasql.lpr"   << TCmdLineDebugger.ReadLn "^done,lines=[]"   << TCmdLineDebugger.ReadLn "(gdb) " It could be the filename in the debug info does not have the full path. I would expect an error, and the IDE to retry without path. Are there any hard\ /soft links involved on your file system? -- I am away and cant do any tests now ---------------------------------------------------------------------- Martin_fr · 2012-11-07 16:59 How does it go with fpc 2.6.0? ---------------------------------------------------------------------- BigChimp · 2012-11-07 17:20 Quote from: Martin_fr on November 07, 2012, 05:51:24 pmOk, I do see one attemt to set a breakpoint Quote  >> TCmdLineDebugger.SendCmdLn "info line "D:\Reinier\Documents\ SourceCode\fpc_laz_patch_playground\SQL\pasql.lpr":1191"   << TCmdLineDebugger.ReadLn "&"info line \"D:\\Reinier\\Documents\\So urceCode\\fpc_laz_patch_playground\\SQL\\pasql.lpr\":1191\n""   << TCmdLineDebugger.ReadLn "~"Line number 1191 is out of range for \"pasql.lpr\".\n"" Is that the file and line? Does the line exist, despite the debugger believe otherwise? Yep, 1191 in pasql.pas exists, and is the line I wanted to break on. Quote from: Martin_fr on November 07, 2012, 05:51:24 pmTry using -Xe external linker (not sure it exists for win 64). I will. Note: though I'm running win 64, I'm running x86 FPC+x86 Lazarus here. Quote from: Martin_fr on November 07, 2012, 05:51:24 pmin fact it seems there are no lines at all. Quote >> TCmdLineDebugger.SendCmdLn "-symbol-list-lines D:\Reinier\Doc uments\SourceCode\fpc_laz_patch_playground\SQL\pasql.lpr"   << TCmdLineDebugger.ReadLn "^done,lines=[]"   << TCmdLineDebugger.ReadLn "(gdb) " It could be the filename in the debug info does not have the full path. I would expect an error, and the IDE to retry without path. Are there any hard\ /soft links involved on your file system? I've got some hard links on D: and probably some soft links as well, though there shouldn't be any in D:\Reinier\Documents\SourceCode\fpc_laz_patch_playground\ or below (and D:\Reinier\Documents\Sourcecode itself is a regular directory hierarchy) Quote from: Martin_fr on November 07, 2012, 05:51:24 pmI am away and cant do any tests now Still, thanks for your superfast and thorough response! Quote from: Martin_frHow does it go with fpc 2.6.0? I'll get back to you on this + the external linker probably later tonight or tomorrow. Background: I'm editing some FPC fcl-db files and using pasql.lpr to test. Tried to step through the fpc code but failed, then tried to see if stepping through pasql.lpr worked. Pasql.lpr has conditional defines for FPC 2.7.1+ - it will use the regular code in FPC 2.6.0. Once again, thanks a lot & will let you know. ---------------------------------------------------------------------- BigChimp · 2012-11-08 08:29 Laz 1.0.2 with FPC x86 2.6.0 works fine: stops on breakpoint. Laz r39165 with FPC x64 trunk (had to modify pasql.lpr to not use Oracle connections so the lines shifted a bit, breakpoint now on line 1196): Code: [Select]<-break-insert *4295056304> ^done,bkpt={number="6",type="breakpoint",disp="keep",enabled="y",addr= "0x0000000100015bb0",at="",times="0",original- location="*4295056304"} (gdb) <-symbol-list-lines D:\Reinier\Documents\SourceCode\fpc_laz_patch_play ground\SQL\pasql.lpr> ^done,lines=[] (gdb) &"info line \"D:\\Reinier\\Documents\\SourceCode\\fpc_laz_patch_playgr ound\\SQL\\pasql.lpr\":1196\n" ~"Line number 1196 is out of range for \"pasql.lpr\".\n" ^done (gdb) Laz trunk with FPC x86 trunk: using -Xe: doesn't work either; see attached log. Moving the entire project to a shorter directory (D:\cop\tf\) doesn't help either. Copying over the source to a new simple program application pasql2 (it's a console app), adding debug build mode without optimization, and dwarf+sets, and stripping down the prog a bit doesn't help: Code: [Select]<-symbol-list-lines D:\Cop\tf\pasql2.lpr> ^done,lines=[] (gdb) &"info line \"D:\\Cop\\tf\\pasql2.lpr\":1197\n" ~"Line number 1197 is out of range for \"pasql2.lpr\".\n" ^done Copying that project to another drive, c:\windows\temp, and running it doesn't help. I've attached the pasql2 source code FYI if you want to take a look. ---------------------------------------------------------------------- Martin_fr · 2012-11-08 13:41 Maybe something has changed in FPC? ---------------------------------------------------------------------- BigChimp · 2012-11-08 13:58 Could well be. I could have a look at FPC trunk on Linux x64 to see if the FPC linker for Windows is to blame? Tried just now with Laz r39246 with FPC 2.6.1 and -Xe (had forgotten to remove that); breakpoint worked. Laz with FPC trunk fails. Edit: note: opened another project with Laz trunk/FPC trunk and debugging works. Edit2: I'll try switching to stabs as well with pasql to see if that works ---------------------------------------------------------------------- BigChimp · 2012-11-08 14:10 Laz trunk, fpc x86 trunk, Windows: - dwarf2: does not work - dwarf2+sets: does not work - dwarf3: does not work - stabs: WORKS, breakpoint breaks correctly - ---------------------------------------------------------------------- Martin_fr · 2012-11-11 19:28 dwarf3 is not expected to work. GDB does not like some of the pascal stuff. Same on win32. Did identical tests with 2.6.0 and all fine. Affects all versions of GDB. So it is a change in FPC. ---------------------------------------------------------------------- BigChimp · 2012-11-11 20:25 Thanks, Martin. I'll post a bug with the sample program so it can get tracked if it is repeatable. *edit*: see you already posted on the fpc-dev list. I'll first wait if that gives responses. http://www.mail-archive.com/fpc- devel@lists.freepascal.org/msg27355.html ---------------------------------------------------------------------- BigChimp · 2012-11-13 10:13 Noticed this problem is mentioned in http://bugs.freepascal.org/view.php?id=22904 ---------------------------------------------------------------------- Martin_fr · 2012-11-13 10:25 Yes, if you look at my last note, and follow the links, you will get to this topic here ---------------------------------------------------------------------- BigChimp · 2012-11-13 11:00 I know, I just love creating circular references - not only in code ---------------------------------------------------------------------- JD · 2012-11-13 14:56 I'm getting the same problem on my system. I attach the debugger error message. I just can't use breakpoints anymore. Lazarus 1.1/FPC 2.6.1 SVN 39042 on Win32 ---------------------------------------------------------------------- Martin_fr · 2012-11-13 16:16 @JD: This is a different error. Does it happen for all breakpoints? Check in the breakpoint window, if you have breakpoints in other units. Try "Reset debugger" from run menu. Have you checked the setup? No smart linking? http://wiki.lazarus.freepascal.org/Debugger_Setup Test with a new app, try dwarf and stabs. ---------------------------------------------------------------------- JD · 2012-11-15 14:56 Quote from: Martin_fr on November 13, 2012, 05:16:39 pm@JD: This is a different error. Does it happen for all breakpoints? Check in the breakpoint window, if you have breakpoints in other units. Try "Reset debugger" from run menu. Have you checked the setup? No smart linking? http://wiki.lazarus.freepascal.org/Debugger_Setup Test with a new app, try dwarf and stabs. Thanks a lot Martin. Resetting the debugger seemed to solve the problem. ---------------------------------------------------------------------- Martin_fr · 2012-11-15 17:04 Quote from: JD on November 15, 2012, 03:56:39 pmThanks a lot Martin. Resetting the debugger seemed to solve the problem. That means something was not properly cleared between 2 debug sessions. If it happens reproducable (e.g 1st debug works, 2nd always fails) then send a log (of both sessions). Otherwise, there is an option, that will automatically reset the debugger after each run. (adds 1 or 2 secs, to the time, it takes to run the project) ---------------------------------------------------------------------- Martin_fr · 2012-11-16 13:50 http://bugs.freepascal.org/view.php?id=23330 ---------------------------------------------------------------------- BigChimp · 2012-11-23 12:48 Quote from: BigChimp on November 07, 2012, 03:22:15 pmLazarus trunk, FPC trunk x86, Windows. I'm trying to find out why my project breakpoints don't work. With FPC r23047, Windows x64: x64: Laz trunk: - dwarf2 breakpoints now work (I think they didn't before) x86: Laz trunk: - dwarf2 breakpoints still don't work ---------------------------------------------------------------------- Martin_fr · 2012-11-23 13:37 Quote from: BigChimp on November 23, 2012, 01:48:02 pmQuote from: BigChimp on November 07, 2012, 03:22:15 pmLazarus trunk, FPC trunk x86, Windows. I'm trying to find out why my project breakpoints don't work. With FPC r23047, Windows x64: x64: Laz trunk: - dwarf2 breakpoints now work (I think they didn't before) x86: Laz trunk: - dwarf2 breakpoints still don't work Please attach a log. the fix in fpc works here for me (32 bit) http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debu g_session ---------------------------------------------------------------------- BigChimp · 2012-11-23 14:02 Sorry, Martin, PEBKAC again. Hadn't updated my batch file from stabs to dwarf. Breakpoints work for me with fpc trunk x86 dwarf2/godwarfsets. Thanks, Reinier