Recent

Author Topic: MacBook M1 Silicon install debugger help  (Read 2354 times)

redspark

  • Newbie
  • Posts: 6
MacBook M1 Silicon install debugger help
« on: January 18, 2021, 07:11:36 pm »
Today, I managed to get through this whole process except for the Debugger.  I installed the packages for:

  • fpdebug
  • LazDebuggerFpLldb
  • LazDebuggerFp

But the Debugger isn't being found when I start Lazarus.  Any idea what I missed?  Do I just use the /usr/bin/lldb?

Thanks.

James

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: MacBook M1 Silicon install debugger help
« Reply #1 on: January 19, 2021, 12:15:50 am »
Did you follow the Wiki Installing Lazarus on macOS instructions? There's a section on setting up the debugger.

Grahame Grieve

  • Sr. Member
  • ****
  • Posts: 365
Re: MacBook M1 Silicon install debugger help
« Reply #2 on: January 31, 2021, 10:21:36 am »
I have followed these instructions, and I have FPC+Lazarus (3.3.1/2.1.0 - trunk) running on my Mac M1. I have, so far as I can figure, only one problem:

when I am debugging, and I try to see a variable value, I got the following message:

s = Internal error: Missing data location

Project options are -gw -godwarfsets -gl. Preferences say that the debugger backend is LLDB debugger (with fpdebug).  (path = /usr/bin/lldb).

I do see a stack, and breakpoints work.

Debug Output shows this:
(lldb) version
lldb-1200.0.44.2
Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)

but nothing useful in the dump of stuff that gets cut off above that

What can I do so I can see variable values?

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: MacBook M1 Silicon install debugger help
« Reply #3 on: January 31, 2021, 11:12:58 am »
What can I do so I can see variable values?

Alas, I'm an old C programmer, this is what I usually do (don't laugh):

Code: Pascal  [Select][+][-]
  1. program myvartest;
  2.  
  3. {$mode objfpc}{$H+}
  4. {$modeswitch objectivec1}
  5.  
  6. {$DEFINE DEBUG}
  7.  
  8. uses
  9.   CocoaAll;
  10.  
  11. var
  12.   myVarStr: string;
  13.   myVarInt: Integer;
  14.  
  15. begin
  16.   myVarStr := 'Testing';
  17.   myVarInt := 23;
  18.  
  19.   {$IFDEF DEBUG}
  20.   NSLog(NSStr('myVarStr: %@'), NSStr(myVarStr));
  21.   NSLog(NSStr('myVarInt: %i'), myVarint);
  22.   {$ENDIF}
  23. end.

when needed which produces:

Code: Text  [Select][+][-]
  1. 2021-01-31 21:06:29.683 myvar[1859:132217] myVarStr: Testing
  2. 2021-01-31 21:06:29.683 myvar[1859:132217] myVarInt: 23

in the terminal and:

Code: Text  [Select][+][-]
  1. Type    Time                    Process Message
  2. ---------------------------------------------------------
  3. default 21:08:15.211153 +1100   myvar   myVarStr: Testing
  4. default 21:08:15.211240 +1100   myvar   myVarInt: 23

in the console system log.

Grahame Grieve

  • Sr. Member
  • ****
  • Posts: 365
Re: MacBook M1 Silicon install debugger help
« Reply #4 on: February 03, 2021, 11:06:05 am »
well... yes, I can do that, but it's not substitute for seeing variable values in the debugger....

redspark

  • Newbie
  • Posts: 6
Re: MacBook M1 Silicon install debugger help
« Reply #5 on: February 15, 2021, 04:10:58 pm »
Did you follow the Wiki Installing Lazarus on macOS instructions? There's a section on setting up the debugger.

I thought I had followed those instructions but it looks like I may have been in another document.  There is a lot of jumping around for FPC and Lazarus to compile both.  Anyway, I got lldb set as my debugger and Lazarus seems to like that.  Thanks.


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: MacBook M1 Silicon install debugger help
« Reply #6 on: February 15, 2021, 04:46:27 pm »
There isn't a good Lazarus debugger for M1 yet...

FpDebug (and anything based on it, like lldb+fpdebug) are Intel only. (and to some extend avr)

You can use the "pure" LLDB. Package LazDebuggerLldb (without any "FP" in the name).
It should work -ish....

Not tested, but I would expect:

It will expect any watch in C-style.  A single identifier (local var, global var, probably field?) should be fine.

Instead of "self" you need "this"

Instead of MyObject.FMyField  you need MyObject->FMyField
Instead of MyPointer^ you need *MyPointer


Also you should add the custom option
-godwarfcpp

And keep it "dwarf + sets"  / Do not use "dwarf 3".

 

TinyPortal © 2005-2018