Forum > General
Help debugging Lazarus IDE
Alex.Machado:
Hi all,
I'm translating a package from Delphi to Lazarus. The work is done but I have a very weird thing happening.
The final version of my package works, I can see all components installed into the Lazarus IDE, but when I drop a control on my form, the unit where the control is declared is included in the uses clause, but the control itself is not included in the source code (e.g. right below the form declaration we should expect the line "myWidget1: TMyWidget;" to be included).
This problem happens with the final release version of the package (built with -Ur) but doesn't happen when I build/install it from the sources.
I'm tring to find what's causing it and debugging the IDE itself.
I found the unit SourceFileManager.pas which seems to be the one that I was looking for but I couldn't determine the exact method that is responsible for writing the newly added component to the PAS and LFM files. Seems that this is written to the files during an Application.OnIdle event (involving message dispatching and such) which makes the debugging experience as pleasant as a root canal treatment.
Anyone knows exactly where the newly added component is written to the PAS and LFM files?
Any tips that could save me long hours fighting the debugger are welcome.
Thanks in advance
Alex.Machado:
Partially responding my own question:
The component declaration is written inside method: TEventsCodeTool.CompleteComponent, unit EventCodeTool.pas.
The mystery behind why it works only when I build/install my package from the sources remains. Need more (lots of) debugging, unfortunately.
n7800:
What does the "-Ur" option even give? I see its description, but I don't really understand its purpose:
--- Quote ----U Unit options:
-Un Do not check where the unit name matches the file name
-Ur Generate release unit files (never automatically recompiled)
-Us Compile a system unit
--- End quote ---
Usually, a special build mode is used for release (there is a built-in "Release" in the project options), which includes many options, but this is not there.
Martin_fr:
I don't know the answer to your question (which part of the code to dig into...).
But there are companies selling closed source packages => so it should work.
Which version of Lazarus have you tried?
You should at least try 3.6 an "git main" (currently named 4.99, former 3.99).
If you source compile with older Lazarus, you can even try an older 2.x version, just to see there is no regression in Lazarus.
---
Also when you test, I assume you remove the sources. Make sure the package and ppu files remain in there place. I do not know if it does have an impact. But at least test it...
Alex.Machado:
Hi n7800,
As I understand the -Ur option should be used in case of packages where the source code is not released (e.g. trial/evaluation versions of commercial packages).
At least this was the main recommendation in this thread:
https://forum.lazarus.freepascal.org/index.php?topic=47582.0
Cheers
Navigation
[0] Message Index
[#] Next page