Forum > Packages and Libraries

how to debug package?

<< < (2/2)

Martin_fr:
"fcl-db" is part of fpc.

The lpk package file is not used. The units are compiled once when fpc is build via its Makefile.

You have to rebuild fpc (using the Makefile / you may have to download fpc sources from git / not sure if the Lazarus install contains all the files needed for a rebuild).

Even if you force-fully rebuild the package, it won't work. Because the resulting ppu will be in the wrong location. And also because any other depending fpc package will not be recompiled.

In some cases, there is a workaround....

---- EDIT: this also suffers from the non debug ppu still being in path - so likely not working...

If you use no other fpc package that includes fcl-db (including not using any lazarus or 3rd party package, that in any way uses any fpc package that uses fcl-db)....

You maybe able to make a copy of fcl-db (and rename it, or you will likely have a whole new lot of troubles), then open that package and recompile it.
Then find any package that uses fcl-db, remove fcl-db from its dependencies, and add your copy instead.

It's still a lot of work.
It only works if all pre-conditions are met.
And you must change some dependencies, which you later have to restore.

iret's idea may also work. But you need to add the path to each package that needs it. And playing with paths is also of the category "you better know what you do".

Mind that you can't easily remove the fcl-db ppu from the include paths. So the may creep in, and cause trouble.


You can easily get a debug build of fpc, if you use FpcUpDeluxe.

At least on Windows it is easy enough to switch between different fpc builds.

On Linux and MacOS that requires some extra steps. Not sure....

balazsszekely:
@powerpcer

--- Quote ---I am debugging the fcl-db, the dbf.pas

--- End quote ---
In order to debug fpc packages you need to rebuild fpc with -g -gl -O-
As @Martin_fr already mentioned, the easiest option is to create a secondary installation with fpcupdeluxe, which won't interfere with your current installation:
1. Download fpcupdeluxe: https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/latest
2. Before install, got to Setup->FPC Options then type -g -gl -O-(see attached image)

wp:
Entering fcl units with the debugger is one part of the story. The other part is: once you found a bug in the fcl and have an idea how to fix it, you must modify the fcl/rtl unit and rebuild the entire fpc just to test it - this is a lengthy process.

A possibility to speed it up is to do which generally is not recommended: Add the fcl/rtl directory of the unit to be debugged to the search path of your project (Project > Options > Paths > Other unit paths). Try to compile. If no other fpc unit depends on it the compiler will be happy and finish its job. If not, it will give you a message which other unit must be recompiled. Add its directory to the search path, too. Continue until the project compiles -- it can require several iterations, though. Now you can apply your changes and test or refine them as if the fpc unit were part of your project.

You can restore the original fpc by removing the fcl units from your search path and by deleting the output directory of your project.

powerpcer:
wow....this is not a happy new year news for me.
i just want find the way to fix the Big5 problem on it.
just let me check if it is worth.

Navigation

[0] Message Index

[*] Previous page

Go to full version