Debug Lazarus sources step by step lazarus / 12-Debugger ---------------------------------------------------------------------- s73 · 2016-11-01 15:06 I have error with Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  f: TField;  v: variant;begin...        v := f.Value; where f is TinyInt ASE field (byte): v contains negative value ($FFFFFFVV). To trace error I should somehow trace into GetFieldValue. I've tried rebuild Lazarus with profile "Debug IDE" (it seems gives me only memory usage), tried to open LCL, LCLBase and FCL (Open Loaded Package, Open, there already "Generate debugging" checked, tried both "automatic" or "Dwarf with sets"), compiled, rebuilded Lazarus - but still can't trace into Lazarus DB code. Can someone provide step by step "How to" to do that? Lazarus 1.6 for Win64. Thanks. ---------------------------------------------------------------------- JuhaManninen · 2016-11-01 16:50 How did you try to trace Lazarus DB code? Debugging should work when you have built Lazarus with profile "Debug IDE". Just open the ide\lazarus.lpi project and debug it as any project. It is briefly explained here:  http://wiki.freepascal.org/Extending_the_IDE#Debugging_the_IDE You can also use GDB directly. When debugging a Lazarus instance using another Lazarus instance, you must pay attention to which window belongs to which instance. Anyway, that is how I often debug the IDE. An alternative way is to add DebugLn() calls to the source and look at their output. It is the best way for debugging mouse event handlers because mouse may stop working in the IDE after a breakpoint. ---------------------------------------------------------------------- howardpc · 2016-11-01 17:58 Quote from: s73 on November 01, 2016, 04:06:00 pmstill can't trace into Lazarus DB code. It may be that your fpc is not built with debug info. To do that see, for example, this thread http://forum.lazarus.freepascal.org/index.php/topic,20335.msg117259.ht ml#msg117259 ---------------------------------------------------------------------- s73 · 2016-11-02 11:56 Quote from: JuhaManninen on November 01, 2016, 05:50:13 pmHow did you try to trace Lazarus DB code? Debugging should work when you have built Lazarus with profile "Debug IDE". Just open the ide\lazarus.lpi project and debug it as any project. It is briefly explained here:  http://wiki.freepascal.org/Extending_the_IDE#Debugging_the_IDE It is not clear for me is this profile "Debug IDE" to exactly debug IDE (environment) or is it as Delphi's compiler option "Use debug .dcus" that allows to step into Delphi sources. I guess this option to exactly debug IDE, not IDE environment that allows to debug Lazarus/FPC sources. What I want is to trace errors I have with some types of fields under FPC (Byte fields, BCD etc that works under Delphi but fails with errors under FPC). ---------------------------------------------------------------------- s73 · 2016-11-02 12:36 Quote from: howardpc on November 01, 2016, 06:58:09 pmIt may be that your fpc is not built with debug info. To do that see, for example, this thread http://forum.lazarus.freepascal.org/index.php/topic,20335.msg117259.ht ml#msg117259 So I have in fpc\3.0.0\source\packages\fcl-db\ several makefiles. To rebuild with debug information I should do exactly what? When I trying to build as suggested I have QuoteD:\lazarus\fpc\3.0.0\source\packages>make OPT=-g MAKE Version 5.41  Copyright (c) 1987, 2014 Embarcadero Technologies, Inc. Error makefile 14: Command syntax error ... or QuoteD:\lazarus\fpc\3.0.0\source\packages>d:\lazarus\fpc\3.0.0\bin\x86 _64-win64\make OPT=-g d:/lazarus/fpc/3.0.0/bin/x86_64-win64/make -C fpmkunit bootstrap make[1]: Entering directory `D:/lazarus/fpc/3.0.0/source/packages/fpmkunit' d:/lazarus/fpc/3.0.0/bin/x86_64-win64/gmkdir.exe -p units_bs/x86_64-win64 d:/lazarus/fpc/3.0.0/bin/x86_64-win64/ppcx64.exe src/fpmkunit.pp -n -Fu../../rtl -FUunits_bs/x86_64-win64 -Fu../paszlib/src -Fu../hash/src -Fi../paszlib/src   -Fi../fcl-process/src/win -Fu../fcl-process/src -Fi../fcl-process/src/win64 -Fi../fcl-process/src/dummy -Fu../libtar/src -g Fatal: Can't find unit system used by fpmkunit Fatal: Compilation aborted make[1]: *** [bootstrap] Error 1 make[1]: Leaving directory `D:/lazarus/fpc/3.0.0/source/packages/fpmkunit' make: *** [fpmake.exe] Error 2 ---------------------------------------------------------------------- howardpc · 2016-11-02 16:17 I don't have a current working Windows setup to test on, and give you a step-by-step. However I can point out one obvious problem, and warn about another. You have Delphi installed, and Embarcadero's make.exe is in your system path. You'll have to reset the system path with a command line instruction like   path=path-to-fpc-binutils (or however it should be written on Windows). Also, I seem to remember that running the make.exe that is provided with a Windows fpc installation can fail if you work with makefiles on a drive other than c: (You're using d:, for instance). I don't know if that is still an issue or not, but it certainly was in the past because some of the required binutils choked if you presented them with files not on the c: drive. ---------------------------------------------------------------------- JuhaManninen · 2016-11-02 16:54 Quote from: s73 on November 02, 2016, 12:56:24 pmIt is not clear for me is this profile "Debug IDE" to exactly debug IDE (environment) or is it as Delphi's compiler option "Use debug .dcus" that allows to step into Delphi sources. I guess this option to exactly debug IDE, not IDE environment that allows to debug Lazarus/FPC sources. It allows you to debug all Lazarus sources, including LCL and other packages. For debugging FPC's source you must compile it with debug info, too. Sometimes it is easy to copy some FPC library code and debug it as part of your project, but it may not work in this case. ---------------------------------------------------------------------- s73 · 2016-11-10 12:16 So I made as described in http://wiki.freepascal.org/Installing_Lazaru s#Installing_Free_Pascal_under_Windows from sources with some fixes: makefpc.bat Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i @echo onset myroot=c:\freepascalset myFPC=%myroot%\fpc\3.0.1set mybinutils=%myroot%\binutilsset PATH=%mybinutils%\i386-win32;%mybinutils%\i386-win32\binw32;cd %myFPC%rd /s /q  %myfpc%\examplesmake clean all OPT="-glw2" install INSTALL_PREFIX=%myFPC% PP=%mybinutils%\ppc386.exe DATA2INC=%myFPC%\utils\data2inc.exemakelaz.bat Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i set myroot=c:\freepascalset myFPC=%myroot%\fpc\3.0.1set mybinutils=%myroot%\binutilsset PATH=%mybinutils%;%mybinutils%\i386- win32\binw32;%myFPC%\bin\i386-win32;cd %myroot%\lazmake clean all OPT="-glw2"Everything built with debug enabled OPT="-glw2" but I still can't trace into for example "Field.AsBytes := value". When I open fields.inc in code editor I can see there blue circles to set breakpoints, but they do not works there. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TBlobField.SetAsBytes(const AValue: TBytes);var  Len : Integer;begin <- breakpoint  with GetBlobStream(bmWrite) do <- breakpoint    try    Len := Length(AValue);      if Len > 0 then        WriteBuffer(AValue[0], Len);    finally      Free;    end;end; from Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i           if FieldObj is TBlobField then              FieldObj.AsBytes := Value