Recent

Author Topic: [SOLVED] How to debug TDBF  (Read 1313 times)

markftl

  • Newbie
  • Posts: 4
[SOLVED] How to debug TDBF
« on: March 15, 2022, 12:26:31 am »
Hi All,
 I'm rewriting a system I wrote over 20 yrs ago, and am looking at options for the databases (to run under linux and windows).
 I've found the answers to most of my questions by looking at the source code and forum posts, but am at the point that I would really like to step through the TDbf code at multiple points to make complete sense out of it.
 The problem is that I'm a bit rusty and have little successful experience compiling the IDE or Compiler manually, so I'm a bit lost.
 I use fpcUpDeluxe (what a GREAT tool) for my laz installs.
 Any help on this would be greatly appreciated.

Lazarus v2.0.12
FPC v3.2.2
Installed with fpcUpDeluxe
Linux Mint 20.2
« Last Edit: March 15, 2022, 01:43:22 am by markftl »

wp

  • Hero Member
  • *****
  • Posts: 13481
Re: How to debug TDBF
« Reply #1 on: March 15, 2022, 01:02:26 am »
If you do not dare to recompile FPC with debug information you can do this: Not recommended in general, but since no other units use the dbf sources, you can simply add the path to the dbf source files to the unit path of your project. Assuming your Lazarus is installed in c:\Lazarus then normally this is "C:\Lazarus\fpc\3.2.2\source\packages\fcl-db\src\dbase"

markftl

  • Newbie
  • Posts: 4
Re: How to debug TDBF
« Reply #2 on: March 15, 2022, 01:20:59 am »
Thanks for the reply, wp. I just tried adding '.../dbase' to the unit search path and it works perfectly. Thanks so much! I'll mark this as solved. but, since you mentioned it, can you point me in the right direction to recompile fpc with debug info? I'd like very much to be able to do this when needed.
« Last Edit: March 15, 2022, 01:45:30 am by markftl »

wp

  • Hero Member
  • *****
  • Posts: 13481
Re: How to debug TDBF
« Reply #3 on: March 15, 2022, 01:43:29 am »
Here is the batch file that I am using to recompile FPC/main (64 bit) with debug info for Windows:
Code: Bash  [Select][+][-]
  1. set BINUTILS_DIR=C:\Lazarus\fpc_bootstrap_compiler\3.2.2\x86_64-win64
  2. set BOOTSTRAP_COMPILER=%BINUTILS_DIR%\ppcx64.exe
  3. set FPC_DEST_DIR=c:\Lazarus\fpc-main
  4. set BIN_DIR=bin\x86_64-win64
  5. set FPC_BIN_DIR=%FPC_DEST_DIR%\%BIN_DIR%
  6. set OPTIONS="-dDEBUG -gl -gw2"
  7.  
  8. ::------------------------------------------------------------------------------
  9. :: Set Path
  10. ::------------------------------------------------------------------------------
  11. path %BINUTILS_DIR%;%PATH%
  12.  
  13. ::------------------------------------------------------------------------------
  14. :: Preparations
  15. ::------------------------------------------------------------------------------
  16. cd %FPC_DEST_DIR%
  17. md %FPC_BIN_DIR%
  18. copy %BINUTILS_DIR%\*.* %FPC_BIN_DIR% > nul
  19.  
  20. :: Required - otherwise the script does not always work
  21. del /q /s %FPC_DEST_DIR%\units > nul
  22. rmdir /q /s %FPC_DEST_DIR%\units
  23.  
  24. ::------------------------------------------------------------------------------
  25. :: Build FPC
  26. ::------------------------------------------------------------------------------
  27. make clean all install OPT=%OPTIONS% PREFIX=%FPC_DEST_DIR% FPC=%BOOTSTRAP_COMPILER%
  28.  
  29. ::------------------------------------------------------------------------------
  30. :: Make fpc.cfg,
  31. ::------------------------------------------------------------------------------
  32. cd %FPC_DEST_DIR%
  33. fpcmkcfg -d basepath=%FPC_DEST_DIR% -o %FPC_BIN_DIR%\fpc.cfg
  34.  
  35. echo Compilation successful.

The folder BINUTILS_DIR contains the bootstrap compiler, i.e. the compiler which will do the work - simply use the fpc from another installation; you can use the current or previous release version.

The folder FPC_DEST_DIR is the folder containing the FPC source files; the fpc binary will be created in a subfolder of it.

Adjust these two variables to your folder structure.

markftl

  • Newbie
  • Posts: 4
Re: [SOLVED] How to debug TDBF
« Reply #4 on: March 15, 2022, 01:48:16 am »
Thanks again sir, you're a scholar and a gentleman.
I started translating your batch file into a shell script and noticed the differences from this being an fpcUpDeluxe install. In the fpcUpDeluxe setup screen there's a checkbox/option to build fpc with debug info. Works like a champ. My plate's pretty full, so I'll save nailing it down via the cl for later, but wanted to share this info in case someone might find it useful.
« Last Edit: March 15, 2022, 10:03:22 am by markftl »

 

TinyPortal © 2005-2018