Forum > Debugger
Debugging Lazarus in Lazarus
(1/1)
dbannon:
In another post, an Mac Arm user needs help to debug lazarus RC2 startup.
Just the normal log does not show anything interesting so, I assume we need to run Lazarus RC2 under a debugger and fortunately 4.0RC1 is working OK
A long time since I did this, so, better I test it first.
But I am find I am unable to build 4.0RC2 in RC1 on my Linux laptop. The 4.0RC2 tree builds nicely with a make clean bigide. Given the errors I see, I have to assume I am doing it wrong !
Because of the changes around IDEPackager, seems must be RC1 running RC2 ? So I build a clean 4.0RC1 and opened the lazarus.lpi in my 4.0RC2 source tree.
Things I noted -
No compiler set in project, need to set Project->ProjectOptions->CompilerOptions->Compiler
No boxes ticked, need to tick all three. Easy.
Missing Symbols (eg) - KeyAndShiftStateToEditorKeyString seems to have moved to components/ideintf/idecommands.pas so I added that path to -Fu
And a few more. All up I ended adding
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---./components/ideintf;packages/ideproject;packages/idedebugger;../components/lazcontrols
to the -Fu line.
But then, I get treefilteredit.pas(469,3) Error: Identifier not found "fAlreadyFiltered"
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---$> grep -niR "fAlreadyFiltered" *...lcl/editbtn.pas:244: fAlreadyFiltered: Boolean;
So, declared in editbtn.pas ? I need to add editbtn to the uses line ?? No, I am clearly on the wrong train. Help please !
Davo
Ref : https://forum.lazarus.freepascal.org/index.php/topic,70214.0/topicseen.html
Martin_fr:
--- Quote from: dbannon on February 18, 2025, 07:08:50 am ---No compiler set in project, need to set Project->ProjectOptions->CompilerOptions->Compiler
No boxes ticked, need to tick all three. Easy.
--- End quote ---
That is intentional. (for lazarus.lpi)
The IDE can currently not be build using the normal project build system (not sure why / just from what I have once been told).
To debug the IDE, you build it via: Tools > Configure Build Lazarus
If you debug a different IDE version, then you build it before hand, from within that version - or via make.
When you press run to debug, and files where changed (I think in packages), you may see those packages being compiled. But they won't be linked into an exe. After all the IDE is not going to be rebuild.
Not sure on the other errors, but likely a consequence of trying to compile from within the project.
dbannon:
Thanks Martin, I guess that all makes sense. I initially had a debug version ready to run (I thought) but IDE wanted to rebuild it. I'll try your approach a bit more carefully.
Davo
Martin_fr:
If you are debugging between 2 Lazarus installations...
I haven't tested if opening the lazarus.lpi from the other install, will also run the lazarus executable from that other installs folder. (It might, but I don't know).
But you always can ensure this by using: Run > Run params
and set the "host application"
The other way is to just do everything in the folder of the install that you want to debug.
Copy the "good" lazarus executable into that folder (but under a new name lazarus_1), then start this, and it will run using the folder that you want to debug. Then you can debug the exe in that folder.
Be aware, if you have a normal install, so the install is in /usr/ and not writeable to you, then your lazarus executable (if you installed package or did rebuild) is not in the install folder, it is somewhere inside the PCP (usually ~/.lazarus) / not sure where exactly).
startlazarus would start this, but you can't use that in the debugger, as the debugger would not follow the launch of the process for lazarus.
So you need to copy that rebuild lazarus, or you need to use "run param"
dbannon:
We are all good Martin. I cleaned out the RC2 dir, put in a fresh source tree, make clean bigide.
Then started the RC1 ide, pointed to the RC2 lazarus.lpi, project opened, click Run (not Build!). And the RC1 ide/debugger ran my RC2 binary without problems.
Lets hope Jim, the Mac user (who also has RC1 and RC2 source builds) can do the same and pin point the problem.
Davo
(don't we have a cool built in debugger these days ?)
Navigation
[0] Message Index