Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-11

Debug Lazarus source

14 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Juha Manninen

Hi,

How do you people debug Lazarus source code when developing it?

Yesterday I was able to open the whole Lazarus project "lazarus/ide/lazarus.lpi" and debug it with Lazarus itself. I was already then wondering how does it find files under directories like "converter" which are not defined anywhere, neither in Required package contents nor in Compiler Options -> Paths.

Then I tested some options and screwed things up. I started again from SVN copy of Lazarus.
Now I get many errors for lazarus.lpi about files not found. It must have been a miracle that it worked earlier. Something a human being can't explain...

Lazarus wiki tells to use ddd for debugging. That is quite masochistic. Even the font is so ugly I have trouble reading it.

So, how to configure Lazarus to debug itself?

Juha Manninen

Reply by email

Mattias Gärtner
to Juha Manninen

Zitat von Juha Manninen :

Show quoted text 6 lines
Hi, How do you people debug Lazarus source code when developing it? Yesterday I was able to open the whole Lazarus project "lazarus/ide/lazarus.lpi" and debug it with Lazarus itself.

Yes, that is one way.

I was already then wondering how does it find files under directories like "converter" which are not defined anywhere, neither in Required package contents nor in Compiler Options -> Paths.

The IDE knows itself, so the lazarus.lpi is not really needed. I added the 'converter' path.

The IDE knows its search paths.
You can compile it via Tools / Build Lazarus. For myself I set a shortcut for that.
You can debug it via lazarus.lpi + F9 or via starting the IDE in gdb.

Show quoted text 5 lines
Then I tested some options and screwed things up. I started again from SVN copy of Lazarus. Now I get many errors for lazarus.lpi about files not found. It must have been a miracle that it worked earlier. Something a human being can't explain...

The IDE warns if a project file is missing. But I had not yet the time to show all missing files in one dialog - project inspector.

Lazarus wiki tells to use ddd for debugging. That is quite masochistic. Even the font is so ugly I have trouble reading it.

;)

So, how to configure Lazarus to debug itself?

see above

Mattias

Reply by email

Juha Manninen
to Mattias Gärtner

Hi,

I don't know what happened here.
At one point I deleted all Lazarus setting files from ~. Then I have reloaded the whole Lazarus source tree from SVN. svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus

"Make clean all" worked fine but when compiling lazarus.lpi I get errors:

The project's compiler options has no compiler command.

In Project Compiler Options -> Compilation -> Compiler the 3 checkboxes are unchecked: "Compile", "Build" and "Run".
I check them.

Trying to compile again:

  lazarus.pp(37,2) Fatal: Can't open include file "ide.inc"

So, in Compiler Options -> Paths -> Include Files I set "include". ... Now it actually compiled many files, but then:

  packagedefs.pas(60,65) Fatal: Can't find unit PackageDefs used by Project

The editor has unit file PackageDefs open when it gives the error, so it actually found it.
I add ";../packager/" to Compiler Options -> Paths -> Other Unit Files. I can see there is already "converter" added.

Now the project actually compiles and runs!
Then I try to set a breakpoint but get an error:

There is no debugger specified...

It mentions a debugger menu setting but I didn't even find it now. Uhh! Maybe I will continue tomorrow. It worked yesterday so maybe it works tomorrow again.

Juha Manninen

Show quoted text 38 lines
> How do you people debug Lazarus source code when developing it? > > Yesterday I was able to open the whole Lazarus project > "lazarus/ide/lazarus.lpi" and debug it with Lazarus itself. Yes, that is one way. > I was already then wondering how does it find files under directories > like "converter" which are not defined anywhere, neither in Required > package contents nor in Compiler Options -> Paths. The IDE knows itself, so the lazarus.lpi is not really needed. I added the 'converter' path. The IDE knows its search paths. You can compile it via Tools / Build Lazarus. For myself I set a shortcut for that. You can debug it via lazarus.lpi + F9 or via starting the IDE in gdb. > Then I tested some options and screwed things up. I started again from > SVN copy of Lazarus. > Now I get many errors for lazarus.lpi about files not found. It must > have been a miracle that it worked earlier. Something a human being > can't explain... The IDE warns if a project file is missing. But I had not yet the time to show all missing files in one dialog - project inspector. > Lazarus wiki tells to use ddd for debugging. That is quite masochistic. > Even the font is so ugly I have trouble reading it. ;) > So, how to configure Lazarus to debug itself? see above Mattias

Reply by email

Hans-Peter Diettrich
to Mattias Gärtner: Zitat von Juha Manninen : Yes, that is one way. The IDE knows itself, so the lazarus.lpi…
Show quoted text 6 lines
> How do you people debug Lazarus source code when developing it? > > Yesterday I was able to open the whole Lazarus project > "lazarus/ide/lazarus.lpi" and debug it with Lazarus itself. Yes, that is one way.

I have more problems, in patching Lazarus. Since the lazarus.lpi is not a complete project, that can be compiled like other projects, every change to the Lazarus code requires to rebuild everything (Tools/Rebuild...), before the compiler notices an error in an updated unit.

Am I missing an easier way to (syntax) check changes applied to the Lazarus source code or project?

DoDi

Reply by email

Martin
to Hans-Peter Diettrich
Hans-Peter Diettrich wrote 14 lines
Mattias G?rtner schrieb: >> How do you people debug Lazarus source code when developing it? >> >> Yesterday I was able to open the whole Lazarus project >> "lazarus/ide/lazarus.lpi" and debug it with Lazarus itself. > > Yes, that is one way. I have more problems, in patching Lazarus. Since the lazarus.lpi is not a complete project, that can be compiled like other projects, every change to the Lazarus code requires to rebuild everything (Tools/Rebuild...), before the compiler notices an error in an updated unit.

Not necessarily everything

Example: if I make a change to SynEdit, I only need to recompile SynEdit, (on the advanced tab, I can disable all others) and I know if the code compiles.
- Of course I cannot test those changes in the IDE then, but I can run a test-case with the recompiled code.
- And of course, if i made changes to the interface, i do not see if I broke depended packages (but then the IDE is not the only dependend package)

Same for the LCL
you can rebuild the LCL alone. Then you have the IDE running as it was, but any project you compile will use the new IDE

Reply by email

Hans-Peter Diettrich
to Juha Manninen: I don't know what happened here. At one point I deleted all Lazarus setting files from ~.…
Show quoted text 6 lines
I don't know what happened here. At one point I deleted all Lazarus setting files from ~. Then I have reloaded the whole Lazarus source tree from SVN. svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus "Make clean all" worked fine but when compiling lazarus.lpi I get errors:

Welcome in the club :-(

Show quoted text 5 lines
The project's compiler options has no compiler command. In Project Compiler Options -> Compilation -> Compiler the 3 checkboxes are unchecked: "Compile", "Build" and "Run". I check them.

Be warned! You should work on a copy of the lazarus.lpi project, else you'll get trouble whenever you want to rebuild lazarus later. In that new project specify an different output location for the executable.

You also may remove packages from the project, in order to speed up compilation and linking. I added a global Define to the compiler options (-dDoDi ;-), that allows to exclude parts of the Lazarus code, to change the caption of the IDE window (for better distinction between the debugging and debugged application) and more. As far as configuration files are read and written by the IDE, it may be necessary to make the Lazarus copy use different files, so that a rebuild of the working IDE will not be affected by experiments.

Show quoted text 5 lines
Trying to compile again: lazarus.pp(37,2) Fatal: Can't open include file "ide.inc" So, in Compiler Options -> Paths -> Include Files I set "include".

We should discuss this and further updates in detail - I stopped after I could not find out what options to set to which values.

My dream is a customizable Lazarus IDE project, where I can experiment with docking, SynEdit and other modifications. We also can meet in #lazarus-ide, to exchange our experiences.

DoDi

Reply by email

Vincent Snijders
to Juha Manninen: I don't know what happened here. At one point I deleted all Lazarus setting files from ~.…
Juha Manninen wrote 14 lines
Hi, I don't know what happened here. At one point I deleted all Lazarus setting files from ~. Then I have reloaded the whole Lazarus source tree from SVN. svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus "Make clean all" worked fine but when compiling lazarus.lpi I get errors: The project's compiler options has no compiler command. In Project Compiler Options -> Compilation -> Compiler the 3 checkboxes are unchecked: "Compile", "Build" and "Run". I check them.

That is because the preferred way of compiling Lazarus is by using Tools -> Build Lazarus, so the IDE should not try to compile lazarus itself before running it.

<snipped errors that are caused by not using Tools -> Build Lazarus>

Show quoted text 6 lines
Now the project actually compiles and runs! Then I try to set a breakpoint but get an error: There is no debugger specified...

Try Environment -> Options -> Debugger -> General

Vincent

Reply by email

Mattias Gaertner
to Juha Manninen: I don't know what happened here. At one point I deleted all Lazarus setting files from ~.…
Show quoted text 14 lines
Hi, I don't know what happened here. At one point I deleted all Lazarus setting files from ~. Then I have reloaded the whole Lazarus source tree from SVN. svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus "Make clean all" worked fine but when compiling lazarus.lpi I get errors: The project's compiler options has no compiler command. In Project Compiler Options -> Compilation -> Compiler the 3 checkboxes are unchecked: "Compile", "Build" and "Run".

This is on purpose.

Show quoted text 16 lines
I check them. Trying to compile again: lazarus.pp(37,2) Fatal: Can't open include file "ide.inc" So, in Compiler Options -> Paths -> Include Files I set "include". ... Now it actually compiled many files, but then: packagedefs.pas(60,65) Fatal: Can't find unit PackageDefs used by Project The editor has unit file PackageDefs open when it gives the error, so it actually found it. I add ";../packager/" to Compiler Options -> Paths -> Other Unit Files. I can see there is already "converter" added.

I added them.

Now the project actually compiles and runs!

This is the minimal IDE without any installed packages.

I changed a few things.
Now F9 will compile an IDE with packages.
No compiler flag is passed.

Mattias

Reply by email

Vincent Snijders
to Mattias Gaertner
Mattias Gaertner wrote 21 lines
On Fri, 6 Nov 2009 16:49:19 +0200 Juha Manninen wrote: > "Make clean all" worked fine but when compiling lazarus.lpi I get > errors: > > The project's compiler options has no compiler command. > > In Project Compiler Options -> Compilation -> Compiler the 3 > checkboxes are unchecked: "Compile", "Build" and "Run". This is on purpose. > Now the project actually compiles and runs! This is the minimal IDE without any installed packages. I changed a few things. Now F9 will compile an IDE with packages. No compiler flag is passed.

It still does not recompile LCL, Synedit, CodeTools and IDEIntf on change, does it? Don't you think it will confuse users, who think to have made a change in one of those package, but don't see the change in the IDE?

Vincent

Reply by email

Mattias Gaertner
to Vincent Snijders
Show quoted text 27 lines
Mattias Gaertner schreef: > On Fri, 6 Nov 2009 16:49:19 +0200 > Juha Manninen wrote: > >> "Make clean all" worked fine but when compiling lazarus.lpi I get >> errors: >> >> The project's compiler options has no compiler command. >> >> In Project Compiler Options -> Compilation -> Compiler the 3 >> checkboxes are unchecked: "Compile", "Build" and "Run". > > This is on purpose. > > >> Now the project actually compiles and runs! > > This is the minimal IDE without any installed packages. > > I changed a few things. > Now F9 will compile an IDE with packages. > No compiler flag is passed. It still does not recompile LCL, Synedit, CodeTools and IDEIntf on change, does it? Don't you think it will confuse users, who think to have made a change in one of those package, but don't see the change in the IDE?

That's the same for every project.
I can't stop users thinking.

Mattias

Reply by email

Hans-Peter Diettrich
to Mattias Gaertner
Show quoted text 5 lines
>> This is the minimal IDE without any installed packages. >> >> I changed a few things. >> Now F9 will compile an IDE with packages. >> No compiler flag is passed.

Thanks :-)

Show quoted text 7 lines
> It still does not recompile LCL, Synedit, CodeTools and IDEIntf on > change, does it? Don't you think it will confuse users, who think to > have made a change in one of those package, but don't see the change > in the IDE? That's the same for every project. I can't stop users thinking.

Wouldn't it force a rebuild of the LCL etc., when only the packages are added to the project requirements?

Just a suggestion: can you provide a second lazarus-test project, that will not overwrite or otherwise affect the rebuild of the working version? Then every interested user can play with *that* project, and still can rebuild Lazarus using the normal procedures.

TIA
DoDi

Reply by email

Mattias Gaertner
to Hans-Peter Diettrich
Show quoted text 12 lines
Mattias Gaertner schrieb: [...] >> It still does not recompile LCL, Synedit, CodeTools and IDEIntf on >> change, does it? Don't you think it will confuse users, who think >> to have made a change in one of those package, but don't see the >> change in the IDE? > > That's the same for every project. > I can't stop users thinking. Wouldn't it force a rebuild of the LCL etc., when only the packages are added to the project requirements?

No.
LCL, Synedit, CodeTools and IDEIntf are still special built in packages. Not much is missing to make codetools, IDEIntf and synedit normal packages.
The LCL needs the whole build modes.

Just a suggestion: can you provide a second lazarus-test project, that will not overwrite or otherwise affect the rebuild of the working version? Then every interested user can play with *that* project, and still can rebuild Lazarus using the normal procedures.

We have already a second place for the rebuilt IDE. It already confuses users.
But there is a simple solution, that works since 10 years: keep a backup of a good lazarus executable.

Mattias

Reply by email

Mattias Gaertner
to Hans-Peter Diettrich: Thanks :-) Wouldn't it force a rebuild of the LCL etc., when only the packages are added…
Show quoted text 9 lines
Mattias Gaertner schrieb: >>> This is the minimal IDE without any installed packages. >>> >>> I changed a few things. >>> Now F9 will compile an IDE with packages. >>> No compiler flag is passed. Thanks :-)

It does not work as expected.
It had to be removed.

Reason:
The IDE with packages require updating some more files, including the installed packages.
lazarus.lpi can not handle all the needed checks and updates.

You must use the Tools / build lazarus.

If you want F9 to compile an IDE, then create a lpi for that.

Mattias

Reply by email