Recent

Author Topic: New debugger for Mac based on lldb (Call for testers)  (Read 31531 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5524
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #135 on: February 13, 2019, 06:04:11 pm »
I confirmed that selecting/pressing current made the "watch" work!   I agree totally that the watch isn't working correctly because the thread isn't set correctly at watch evaluation time.
Ok, technically that means the watch works. But the thread does not. (and in more ways, than just being the wrong one selected)
I am working on this.

Quote
I would be interested to know if the "watch" issue arises in this example (multi-threaded) for your normal working non/Mac environment or if it is specific to OSX, or maybe 64 bit environments?
I have not checked 32 bit Mac, but it does not arise on windows.
I also already spotted the differences. So it should be fix-able.

Just fitting it into my busy schedule.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5524
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #136 on: February 14, 2019, 03:54:49 am »
I committed a further part of the fix in r60419. It should select the correct thread now.

There is still something wrong.

"newStatus" is a local variable.
Yet if I select thread 1, which is not in that procedure, it still shows a value for it (random or nil). It should show "invalid" since the variable does not exist.

If thread1 was in valid pascal code, it could then not see its own variables.

kcandrews

  • New Member
  • *
  • Posts: 42
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #137 on: February 14, 2019, 04:16:29 am »
Confirmed correct thread selection and proper watch evaluation w/ r60419 :-)
Understand the remaining scope issue -- let me know if there is anything I can do to help.  I really appreciate all your work on this -- knowing there are other priorities!
« Last Edit: February 14, 2019, 04:58:13 am by kcandrews »

dbannon

  • Hero Member
  • *****
  • Posts: 603
    • tomboy-ng, a rewrite of the classic Tomboy
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #138 on: February 15, 2019, 11:00:29 am »

Neither a complaint nor a bug report  :)

This thread is up to 10 pages, I'd like to update the wiki page as its probably easier for new users. Can you confirm a couple of things please, relating to Lazarus 2.0.0 -

1. Right at the start, you mentioned that LazDebuggerFpLLdb "should be in the list of available packages" but on my system, Packages->Install/UninstallPackages does not list it. It is, as you also mention, in Components->....
Should I assume thats as expected ?

2. When setting the IDE to use LLdb, we should choose "LLDB debugger (with fpdebug) (Beta)" ?

3. The IDE then requires us to choose one of several exe formats. Is there any  particular preference ?

Davo

PS I don't do much debugging om the Mac, prefer Linux but recently, when I have had occasion to need it, it works fine on my very old, very secondhand Sierra Powerbook. Thanks !
Lazarus 1.8, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5524
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #139 on: February 15, 2019, 03:57:34 pm »
Can you confirm a couple of things please, relating to Lazarus 2.0.0 -

1. Right at the start, you mentioned that LazDebuggerFpLLdb "should be in the list of available packages" but on my system, Packages->Install/UninstallPackages does not list it. It is, as you also mention, in Components->....
Should I assume thats as expected ?
It should be in the left side list, as it should already be installed.

If you open Tools > Options, and go to the Debugger page, then "LLDB with fpdebug) should be in the dropdown of debugger types
Once selected, you need to give it the location of lldb (/usr/bin/lldb) in the edit field below.

Quote
2. When setting the IDE to use LLdb, we should choose "LLDB debugger (with fpdebug) (Beta)" ?
Yes.

Not tested, but afaik lldb (without fpdebug) does not understand a watch like "MyObject.FValue". Instead it takes "MyObject->FValue"
And typecasts would be c-style too "(int) FValue"

Quote
3. The IDE then requires us to choose one of several exe formats. Is there any  particular preference ?
Not sure what you refer to? I assume "debug info"?

This applies on all platforms, and for all type of debuggers. (So it is the same for gdb on win/linux). Only which one is best, is different depending on the debugger.

For "lldb + fpdebug" the best is "dwarf3".
In the unexpected case of problems, it may be worth trying "dwarf with sets".

This setting only affects the units directly in your project.
However units in packages may have debug info too.
This can be
- set per package
- for many, but not all packages in menu Tools > Configure build Lazarus
- project settings > "Additions and overrides"(search wiki)

If you change settings for package, you may as well check into which package you expect to step. Package you do not step into, do not need debug info.
If you use a type from a package (such as TForm from LCL) it is enough that your unit (in which you declare the variable / must declare and use a variable to include the type) has debug info.

Reducing the amount of packages with debug info (including those that default to have debug info), can shorten the debuggers start-up time.

Also it may be worth comparing (I have not tested) the debuggers start up time for the same settings, only changing the checkbox "use external debug info".
This needs to be only set in your project. If set in your project it will affect all packages. (If set in a package it will do nothing / at least should...)

--EDIT
I updated the initial post. Hope it is more accurate now.
« Last Edit: February 15, 2019, 11:02:09 pm by Martin_fr »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5524
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #140 on: February 15, 2019, 11:03:20 pm »
I added a further fix for the threading context issue. (See first post of topic, for info on where to get the files)

This should hopefully be it.

kcandrews

  • New Member
  • *
  • Posts: 42
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #141 on: February 17, 2019, 02:12:08 am »
Just requesting a point of clarification...
From 1st post of this thread:
Quote
Known Issues in the 2.0 release that are fixed for 2.0.2:
Single stepping, may sometimes step the wrong thread (if paused in a multithreading app)
To apply the fix in Lazarus 2.0.0 go to https://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&root=lazarus&revision=60339 and download the 2 files. You can replace the entire files in your 2.0.0 install. Rebuild the IDE and restart.
Fix a crash for local/watches on begin/end of procedure.
To apply the fix in Lazarus 2.0.0 go to https://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&root=lazarus&revision=60353 and download the file. You can replace the entire files in your 2.0.0 install. Rebuild the IDE and restart.
Fix several issues when debugging multi-threaded apps:
- Eval watches,hints,locals according to selected thread (and stackframe)
- Select correct thread at breakpoint
- Select correct Stackframe for thread, when switching threads
To apply the fix in Lazarus 2.0.0 go to https://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&root=lazarus&revision=60436 and download the file. You can replace the entire files in your 2.0.0 install.
In order for this to work you must also install the file lldbinstructions.pas from for revision=60339 / 1st in this list. (the file lldbdebugger.pas must be taken from this changeset (revision=60436).
Rebuild the IDE and restart.

My current svn fixes checkout confirms I "Checked out revision 60436".

If one gets the current fixes through and including r60436, aren't all earlier debugger fixes covered or is there a problem with lldbintructions.pas that was introduced AFTER r60339?
« Last Edit: February 18, 2019, 06:14:57 am by kcandrews »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5524
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #142 on: February 17, 2019, 02:43:02 am »
If you do an svn checkout up to and including 60436, then you have all of those fixes.

The statements are directed at people without svn, who want to download (not patch, but get entire file) the files and replace them.
Someone who only wants the fixes in 60436 (no idea why they would want that, but...) must use patch. Because if they download the file it contains the earlier revisions. And the earlier revision depends on the changes in the other file.


Made some updates. If you have a better wording...
« Last Edit: February 17, 2019, 02:46:35 am by Martin_fr »

kcandrews

  • New Member
  • *
  • Posts: 42
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #143 on: February 17, 2019, 02:53:33 am »
Understood!  Thank you :-)  You are far better at wording than I!

dbannon

  • Hero Member
  • *****
  • Posts: 603
    • tomboy-ng, a rewrite of the classic Tomboy
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #144 on: February 17, 2019, 11:48:57 am »
Can you confirm a couple of things please, relating to Lazarus 2.0.0 -
.... LazDebuggerFpLLdb "should be in the list of available packages" but ......
It should be in the left side list, as it should already be installed.
......
OK, clarified. Its there on the left side (Installed) only in the bigide model. On the Mac at least it probably needs to be in either build.

Will update that page soon....

Davo
Lazarus 1.8, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #145 on: February 25, 2019, 10:58:54 am »
Just thought I'd post a problem and solution I had with lldb in Mac OS X in case anyone else has the same problem.

The reproduction steps of the problem are:
1> Install Lazarus 2.0 in a Mac with lldb and without gdb
2> Start a new project, save it, run it.

Result: The following error message appears:

Debugger
Initialization output:
error: file specified in --source (-s) options doesn't exist: 'ilent'

In the next dialog there is:

The GDB command:
-gdb-set confirm off
did not return any result

Solution:

Go to Tools->Options->Debugger

You see that the path will be right "/usr/bin/lldb", but the debugger type is wrong! It is GDB, change to "LLDB Debugger (with fpdebug) (Beta)" and it will work fine!

This can be tricky because if you just look at the path to the debugger tool, it will be right, so you might miss that the combobox default value is wrong.

Lazarus should probably auto-change the combobox depending on the detected debugger.

I actually had previously installed 1.8 so maybe this could be the cause of the problem (old lazarus config pointing to GDB?), I can't be sure.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5524
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #146 on: February 25, 2019, 12:02:10 pm »
IIRC There is no autodetect for lldb yet.

And if you have old config it should not have been changed at all. Strange.