Recent

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

MISV

  • Sr. Member
  • ****
  • Posts: 493
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #30 on: November 30, 2018, 03:08:57 pm »
Problem (lazarus trunk + Mojave):


Whenever I run my app with the new lldb debugger beta I get this error:

Unable to  to open file
Quote
"/users/example/lazarus64bit/config_lazarus/onlinepackagemanager/packages/Indy10/lib/x86-64-darwin/idServerIOHandlerStack.o"

I have of course:
  • Made sure he file exist
  • Tried to delete the "lib" folders incase forcing recompilation would help

Not quite sure what is to blame here or what is going on
« Last Edit: November 30, 2018, 03:18:04 pm by MISV »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4949
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #31 on: November 30, 2018, 05:36:40 pm »
Have you tried to increase "ulimit"? (allowed amount of open files / filehandles)

Unfortunately the debugger attempts to open a lot of files and runs into the limit.
It's a known issue, but may be a while until fixed.

MISV

  • Sr. Member
  • ****
  • Posts: 493
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #32 on: November 30, 2018, 10:27:22 pm »
Had to Google it

If I in terminal write
Code: Pascal  [Select]
  1. launchctl limit maxfiles
I get
Quote
max files 256 unlimited


If I in terminal write
Code: Pascal  [Select]
  1. launchctl limit maxfiles 10240 unlimited
I get
Quote
Could not set resource limits: 1: Operation not permitted


If I in terminal write
Code: Pascal  [Select]
  1. sudo launchctl limit maxfiles 10240 unlimited
it appears I set maxfiles correctly :)

I will now test....

And it seems to work

Yay! :)
« Last Edit: November 30, 2018, 10:29:09 pm by MISV »

bigDan

  • New member
  • *
  • Posts: 21
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #33 on: December 01, 2018, 03:19:31 am »
For app I'm currently developing, using lldb(alpha) it worked, kind of (buggy but at least runs). With lldb(with fpdebug), it crashes immediately:

Unable to open file "/Developer/lazarus/components/tachart/lib/x86_64-darwin/qt5/tadatapointseditor.o".

Laz 2.0RCL2/64bit/Cocoa. Compling to 64bit/Qt5.

bigDan

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4949
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #34 on: December 01, 2018, 10:40:41 am »
For app I'm currently developing, using lldb(alpha) it worked, kind of (buggy but at least runs). With lldb(with fpdebug), it crashes immediately:

Unable to open file "/Developer/lazarus/components/tachart/lib/x86_64-darwin/qt5/tadatapointseditor.o".

Laz 2.0RCL2/64bit/Cocoa. Compling to 64bit/Qt5.
See above
Code: Pascal  [Select]
  1. sudo launchctl limit maxfiles 10240 unlimited

bigDan

  • New member
  • *
  • Posts: 21
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #35 on: December 01, 2018, 06:24:21 pm »
That did the trick!

Looks like step-over still does a step-into, though.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4949
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #36 on: December 01, 2018, 09:16:49 pm »
Looks like step-over still does a step-into, though.
32 and 64 bit?

Can you send a log when that happens?
(I was not aware that happens on the Mac at all)


bigDan

  • New member
  • *
  • Posts: 21
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #37 on: December 01, 2018, 10:57:33 pm »
I can only test for 64bit. Qt5 won't link for i386 for me.

I tried compiling 32bit/cocoa, but that results in the message

Code: Pascal  [Select]
  1. Lazarus IDE v2.0.0RC2 rexported - sjsconfig
  2. Access Violation
  3.  

I don't know how to provide the log you desire. If you send me a link to the procedure, I'll give it a shot.

Enclosed are 2 pics of the failure. In debug1.png, I am at breakpoint on line 596. When I press the step over button, instead of going to line 597, it goes into GridVisible as seen in debug2.png.

bigDan

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4949
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #38 on: December 02, 2018, 01:14:29 am »
Instructions for the log file are in the first message of this grid.

I currently do not have a Mac, so I can not reproduce issues myself (many problems I can test with lldb on windows).


Did you get this stepping issue with "lldb (alpha)" too?
Probably, yes, because stepping is done the same in both of the lldb based debuggers.  The difference with the fpdebug version, is only about displaying watches and locals.

There are 2 possibilities here (and the log will tell which one)
1) The IDE sends the correct command, but lldb has a problem. Then there is little that can be done.
   (There is a very similar issue on win64 with gdb. It is not yet known what causes this. )
2) The IDE sends the wrong command. Or there was an ignored exception, and the IDE did not manage to recover that.

bigDan

  • New member
  • *
  • Posts: 21
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #39 on: December 02, 2018, 06:25:04 pm »
Crud. Unable to get log working. I get the same 'unable to open file /Developer/....../qt5/taenumerators.o' even though I have done the 'launch limit maxfiles 10240 unlimited'.

Yes, this same issue occurs with the lldb(alpha) as well.


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4949
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #40 on: December 02, 2018, 07:02:50 pm »
In this case, open the IDE normally, and before starting to debug go to menu:
   View > Ide Internals > Debug Output

Once you run your project, the window will fill with the IDE <> lldb communication.

When you press F8, you can see what the IDE issues:
thread step-in
thread step-over

Thought there will be plenty of more lines, as stack and watches gets done.

You can copy the content, and attach it.
Take the copy immediately after step-over went wrong, so I know the last step command should have been step over.


bigDan

  • New member
  • *
  • Posts: 21
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #41 on: December 02, 2018, 08:19:18 pm »
OK, finally got it!

VTwin

  • Hero Member
  • *****
  • Posts: 504
  • Former Turbo Pascal 3 user
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #42 on: December 02, 2018, 09:18:15 pm »
Martin,

I managed to get lldb working on macOS cocoa lazarus 2.0 revision 59715, the latest fixes, after a great deal of fiddling. lldb seems to be working on very simple projects, but I tried to run one of my large projects with it, and get an access violation. The project runs fine without lldb.

I have attached the log in case it may be helpful.

VTwin
“Talk is cheap. Show me the code.” Linus Torvalds

Lazarus 2.1 svn trunk 59794: macOS 10.11.6 (64 bit Cocoa)
Lazarus 1.8.4: Win 7 (64 bit) & Ubuntu 16.04.3 (64 bit) on VBox

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4949
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #43 on: December 02, 2018, 09:24:19 pm »
@bigDan

Ok, I had a look. LLDB actually believes that it stopped at the end of the "step over". Or in other words, lldb seems to think that the (first (few) ?) line(s) of the subroutine are part of the caller.

I have seen the same issue with gdb on win (but only 64 bit apps).

Given that 2 different external debuggers give that issue, I would currently guess that this is some problem with the debug info written by fpc.

I dont know what the equivalent of objcopy is on Mac, on Windows it seems the following may help: http://forum.lazarus-ide.org/index.php/topic,42183.msg294247.html#msg294247


Ultimately what is needed is a small project with as little dependencies as possible that allows to reproduce this, and then report it to the fpc bugtracker.
But sofar it has only occurred in  complex projects and was not reproduced: https://bugs.freepascal.org/view.php?id=34159

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4949
    • wiki
Re: New debugger for Mac based on lldb (Call for testers)
« Reply #44 on: December 02, 2018, 09:34:30 pm »
I managed to get lldb working on macOS cocoa lazarus 2.0 revision 59715, the latest fixes, after a great deal of fiddling. lldb seems to be working on very simple projects, but I tried to run one of my large projects with it, and get an access violation. The project runs fine without lldb.

I have attached the log in case it may be helpful.

Is that RC2 ?

There is one known crash (inspecting watches/locals/hint...) that is fixed for RC3 already.

If you want to apply the changes:
https://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&root=lazarus&revision=59443


Unfortunately the log has no line numbers on the traces, there is a bug in FPC that prevents them from being printed.

If you run the IDE itself under lldb (probably easiest to use lldb from commandline for that / but you can debug the IDE inside the IDE too).
"access violation" should get caught, and lldb should be able to do a proper stack trace with lines.

---
EDIT:
just seen you are on svn.

If you could try to get the stacktrace please.