Recent

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

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #60 on: December 06, 2018, 06:22:47 pm »
It seems that unchecking "Use Application Bundle" in Project Options breaks debugger. Is this a known bug? Or should I check it deeper?
No, not known. Please provide a log.

How exactly does the "break" manifest? What error is displayed, or what feature stops working.

Does it work or break with a simple program? (Just one pas file)

Are you testing with:
RC2
fixes2_0 branch svn
trunk svn
?


carl_caulkett

  • Sr. Member
  • ****
  • Posts: 306
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #61 on: December 07, 2018, 09:52:34 pm »
I've installed Lazarus v2.0.0RC2 and have got the LLDB debugger working there. I've also installed separately v2.1.0 r59743 from SVN and built using the Cocoa widget set. I cannot find the option for LLDB in the options there. Is this expected behaviour?
"It builds... ship it!"

Mac Mini M1
macOS 13.6 Ventura
Lazarus 2.2.6 (release version)
FPC 3.2.2 (release version)

carl_caulkett

  • Sr. Member
  • ****
  • Posts: 306
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #62 on: December 07, 2018, 10:00:33 pm »
Sorry! My mistake! In my eagerness I forgot what I did last night and forgot to install the LazDebuggerFpLLdb package. Seems to be working fine now.
« Last Edit: December 07, 2018, 10:02:38 pm by carl_caulkett »
"It builds... ship it!"

Mac Mini M1
macOS 13.6 Ventura
Lazarus 2.2.6 (release version)
FPC 3.2.2 (release version)

Arvur

  • New Member
  • *
  • Posts: 48
    • My GitHub
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #63 on: December 10, 2018, 02:49:27 pm »
It seems that unchecking "Use Application Bundle" in Project Options breaks debugger. Is this a known bug? Or should I check it deeper?
No, not known. Please provide a log.

I didn't manage to reproduce it on a simple project.

Lazarus RC2, Mac OS Mojave (10.14.1), dwarf2 debug info, cleanup and build before run.
No error when I turn off bundle option, it just shows me Assembler window. So I supposed debug info cannot be found.
But... If I press Run to continue, Assembler window stucks to the same address point (938B7284 : 8b 50 04 movl 0x4(%eax), %edx).

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #64 on: December 10, 2018, 03:23:59 pm »
Try to get a log file (see 1st message of this thread)

Stepping, Running, Stopping, are done by lldb. If lldb can not handle that situation, then there is probably nothing that can be done to fix it.

If you do change between app-bundle / no app-bundle, then make sure the old app bundle is no longer there. (The same, if you had compiled with external debug info, and change to none external, ensure the old external info is deleted).
If you have such remains, the debugger (both lldb, which for that part is outside our control / and fpdebug in the IDE) may find the old left overs. And that may cause hick ups.
(lldb may (?) give warnings, and they may show in the logfile).

Please also note, that once compiled, you must not touch any of the .o files that are in the project's and packages' lib directories. The debugger (lldb and fpdebug) will read those. They must match what is in the exe.

You may be able to notice this, if you try to debug the IDE itself within the IDE.
If you build the IDE with extra options (Tools menu), and then open the ide/lazarus.lpi and select Run. The project may get compiled again, but without the final linking (because the IDE project is setup specially). So the .o files will then be newer than the exe. (But the debug info might still match, IF the opt level, or other code generating related flags (asserts, range checks ...) have NOT changed.
If you run the IDE from console (or tail the logfile) you should see warnings in this case.
But then this case should not happen with normal projects.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #65 on: December 11, 2018, 01:22:24 pm »
You can also try to compile with -godwarfcpp

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #66 on: December 12, 2018, 11:44:47 pm »
Could those on trunk please update to revision 59812

rev 59811: This enables capturing debug history.
 if you think it affects the speed of continuous stepping (repeated F7/F8), compile with -dLLDB_SKIP_IDLE
 if you have issues stepping (F8) over (ignored) exceptions, or stepping from raise to except/finally-block then try -dLLDB_SKIP_SNAP

Note: independent of this rev, stepping from raise to except/finally-block will always visually stop at the last statement before except. even though it is on except. (or finally)


rev 59812: some startup processing moved to thread. On very large apps this may lead to slightly faster start up.
  no side effects expected

Please let me know if those work well for you.
« Last Edit: December 13, 2018, 12:12:17 am by Martin_fr »

Arvur

  • New Member
  • *
  • Posts: 48
    • My GitHub
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #67 on: December 18, 2018, 10:44:45 am »
Try to get a log file (see 1st message of this thread)
Removed bundle, cleanup&build, run -> laz1.log
Added -godwarfcpp, cleanup&build, run -> laz2.log
In both cases breakpoints have ticks but Lazarus falls to Assembler window after run.

I can also provide successfull log with bundle option turned on. But it is 55Mb.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #68 on: December 18, 2018, 01:15:22 pm »
I had a look at the log.

Your app stops with
   stop reason = EXC_BAD_ACCESS (code=1, address=0x4)
at  CoreFoundation  CFGetTypeID

called from
/Users/Administrator/Projects/Tokens/src/OCX.SYS/BSSHost/../../PACKAGES/BSSTOOLS/BSFiles.pas
BSFiles.pas
LINE: 1100
MOD: bssPluginHostTest
FUNC: GETINFOPLISTSTRIN

That would be a good starting point, to see if you can find if any address/object is nil (and should not be).


I don't know if lldb does something that triggers this, or if there is a bug in your app.

Shortly before the crash, the LCL (I assume) logged the following: "(V)TCarbonWSCustomForm.ShowHide Error: GetWindowClass  failed with result -5600"
I do not know if that is related (I don't know the cocoa, nor carbon workings; just the debugger)


---
The debugger should of course show the stop-reason. That needs to be fixed
« Last Edit: December 18, 2018, 01:22:15 pm by Martin_fr »

fasdfasdfasdfasdfasdf

  • New Member
  • *
  • Posts: 45
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #69 on: December 18, 2018, 01:29:55 pm »
What is the status for LLDB on Windowze?

Arvur

  • New Member
  • *
  • Posts: 48
    • My GitHub
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #70 on: December 18, 2018, 02:31:15 pm »
FUNC: GETINFOPLISTSTRIN

That would be a good starting point, to see if you can find if any address/object is nil (and should not be).
You are right! It was error in sample from wiki. CFBundleGetMainBundle is not good for checking bundle existance. I've described it in wiki.

It seems there are some other errors in project that prevent working without bundle... But I can trace this GetInfoPlistString routine successfully and no assembler window by now. Thanks a lot!!

Shortly before the crash, the LCL (I assume) logged the following: "(V)TCarbonWSCustomForm.ShowHide Error: GetWindowClass  failed with result -5600"
I do not know if that is related (I don't know the cocoa, nor carbon workings; just the debugger)
I suppose it is not related. The same lines are in log with bundle option turned on.

The debugger should of course show the stop-reason. That needs to be fixed
That would be great!
« Last Edit: December 18, 2018, 02:46:19 pm by Arvur »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #71 on: December 18, 2018, 02:59:02 pm »
The debugger should of course show the stop-reason. That needs to be fixed
That would be great!
Just committed. Should even make it into RC3

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #72 on: December 18, 2018, 03:09:30 pm »
What is the status for LLDB on Windowze?
Same as on Mac.
Of course:
- you have to download lldb yourself.
- And you relay on lldb being stable (this may differ between OS)

On Linux, lldb keeps crashing (must be a problem with the build from the repro of my Linux (bit older). So may well work if you are all up to date, but I do not know.)
On Windows, I have tested the 32 bit version of LLDB, and it works. I have no idea about 64 bit on Win.

Mind the LLDB based debuggers in Lazarus are all more basic than the GDB based ones. So I am not sure why you want to use LLDB on Windows? What are you trying to fix?

On Windows (Linux too) you have a choice of other options.
- "GDB (with fpdebug)". Use fpdebug for data display
- Pure fpdebug. You should be at least on fixes2.0 (better trunk). On Linux it does not do well if your app uses threads. It is still beta, but "late beta". Works well in many cases.


att2

  • Jr. Member
  • **
  • Posts: 52
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #73 on: December 20, 2018, 02:38:31 pm »
I would test LLDB on Linux if you tell me how-to.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #74 on: December 20, 2018, 03:35:23 pm »
I would test LLDB on Linux if you tell me how-to.

Install lldb (e.g. from your distros package repository).

Then follow the instructions from the initial post of this thread (install packages, and config in Tools > Options > Debugger)

 

TinyPortal © 2005-2018