Recent

Author Topic: Debugger crash on OSX El Capitan  (Read 3686 times)

Frogfather

  • New member
  • *
  • Posts: 9
Debugger crash on OSX El Capitan
« on: April 06, 2018, 11:13:33 pm »
Hi all,

New to this forum. I've got Lazarus running fine on my desktop machine (Fedora 25) and also on a raspberry pi, but have got stuck with an installation on OSX El Capitan on an admittedly ancient Macbook pro (2008 - core 2 duo)
Installation went fine. Setup is as follows:
fpc 3.0.4
lazarus 1.8
gdb 8.1

IDE finds all components but compiling any application (even a blank form) results in
the attached error.

I've done a bit of searching round the forum but haven't found any similar errors. I'll assume someone has seen this before.

Thanks in advance for any help.





Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Debugger crash on OSX El Capitan
« Reply #1 on: April 06, 2018, 11:27:01 pm »
I've done a bit of searching round the forum but haven't found any similar errors. I'll assume someone has seen this before.

Search wiki for instructions on codesigning the debugger. I believe that's required now. Lazarus doesn't use the current Apple debugger (lldb), so you have to get gdb set up yourself.

You can also run without the debugger. See Tools | Options.

You can also export to Xcode and debug there with lldb:

https://macpgmr.github.io/ObjP/ProjectXC.html#LazProject


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4945
    • wiki
Re: Debugger crash on OSX El Capitan
« Reply #2 on: April 07, 2018, 12:03:03 am »
btw, the info what exact error you got is hidden. press the "more" button.

But codesigning seems likely

Frogfather

  • New member
  • *
  • Posts: 9
Re: Debugger crash on OSX El Capitan
« Reply #3 on: April 07, 2018, 10:16:03 pm »
Thanks for both replies - I did follow the instructions on codesigning and everything appeared to work.

Complete error message is
--------------------------------------------
The GDB command:
"-gdb-set confirm off"
did not return any result.

The GDB process is no longer running.
--------------------------------------------
and the executable looks to be correctly signed:

Executable=/usr/local/Cellar/gdb/8.1/bin/gdb
Identifier=org.gnu.gdb
Format=Mach-O thin (x86_64)
CodeDirectory v=20100 size=62396 flags=0x0(none) hashes=1946+2 location=embedded
Hash type=sha256 size=32
CandidateCDHash sha256=37f81e9e2c57681b6ad94e4285efca2269b0aa0e
Hash choices=sha256
CDHash=37f81e9e2c57681b6ad94e4285efca2269b0aa0e
Signature size=1834
Authority=gdb-cert
Signed Time=5 Apr 2018, 07:34:59
Info.plist entries=4
TeamIdentifier=not set
Sealed Resources=none
Internal requirements count=1 size=88

and yes, the IDE works fine without debugging but that's of limited use :P

Thanks again for any advice.

John


« Last Edit: April 07, 2018, 10:22:39 pm by Frogfather »

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Debugger crash on OSX El Capitan
« Reply #4 on: April 07, 2018, 10:32:13 pm »
Thanks again for any advice.

I have a MacBook of the same vintage as yours, but I don't hassle with gdb, so I can't help much there.

Note that you can debug any .app with the Mac's lldb debugger:

lldb myapp.app

https://developer.apple.com/library/content/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-terminal-workflow-tutorial.html

If you're familiar with gdb commands, here's the equivalent lldb commands:

https://lldb.llvm.org/lldb-gdb.html

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4945
    • wiki
Re: Debugger crash on OSX El Capitan
« Reply #5 on: April 07, 2018, 11:19:22 pm »
"set confirm off" is the first thing the IDE sends to gdb. Even with no code signing I would expect this to work.
It seems the IDE can not launch your gdb at all.

You can start with 2 if this fixes it, then 1 is not needed.

1) Test gdb on the commandline
try both of the following
Code: Pascal  [Select]
  1. gdb
Code: Pascal  [Select]
  1. gdb -i mi
If the 2nd comes up with a prompt: gdb
enter
Code: Pascal  [Select]
  1. -gdb-set confirm off
and see if you get an error, nothing, or another prompt

2)
Code: Pascal  [Select]
  1. which gdb
Make sure the result is NOT some shell script. If so look into it and find the real executable for gdb.
The IDE requires the path to the real exe.

2a)
Make sure the gdb executable has the "x" (executable) flag set, in such a way that the lazarus IDE is allowed to launch it. (whatever user/group the lazarus IDE runs as (or for everyone).

Frogfather

  • New member
  • *
  • Posts: 9
Re: Debugger crash on OSX El Capitan
« Reply #6 on: April 08, 2018, 04:42:59 am »
Thanks Martin - some progress but not quite there yet.

There were two dependencies missing - libffi and mpfr. Installed them via homebrew and can start gdb and issue the set-confirm off command without error.

Now, however I get a different error:

The GDB command:
"-gdb-set new-console off"
did not return any result.

The GDB process is no longer running.

Attempting this command in the console results in:

-gdb-set new-console off
Abort trap: 6

A quick search of stack overflow reveals I'm not alone here
https://stackoverflow.com/questions/48241639/abort-trap-6-when-running-gdb-on-mac-os
unfortunately that post doesn't have a resolution yet.

So maybe it's an El Capitan issue - sadly can't upgrade beyond that on this machine.
Unless anyone has any other suggestions I'll leave it until I can afford a new computer  :'(


Thanks all for help.

John


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4945
    • wiki
Re: Debugger crash on OSX El Capitan
« Reply #7 on: April 08, 2018, 09:40:26 am »
Does homebrew allow you to install an older gdb? Maybe, just maybe. I dont know....

Or if you can get an old version of apples dev tools, not sure how old. They used to ship an old gdb 6.3.50 specially extended for mac.

Frogfather

  • New member
  • *
  • Posts: 9
Re: Debugger crash on OSX El Capitan
« Reply #8 on: April 08, 2018, 11:37:55 pm »
Success - almost!

Installed gdb 8.0 (manually - couldn't get Homebrew to cooperate), created new certificate and Lazarus successfully debugs a Hello World program.

... until I close the main form.

at which point the attached error message pops up. I can live with that - it's more annoyance than showstopper but if anyone has a fix that would be great.

Thank you to everyone who replied.

John  8)


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4945
    • wiki

Frogfather

  • New member
  • *
  • Posts: 9
Re: Debugger crash on OSX El Capitan
« Reply #10 on: April 09, 2018, 11:58:15 am »
Morning!

I've set the debug options as per the wiki - only effect is I now get a message when I start the debugger telling me that auto-solib-add is now off. The error message when the debugger stops is unchanged.

Thanks again for continuing advice :)

John

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1014
Re: Debugger crash on OSX El Capitan
« Reply #11 on: April 09, 2018, 12:06:00 pm »
Don't know if it will help, but you could also try this:
(helps me)

--eval-command="set startup-with-shell off"

Frogfather

  • New member
  • *
  • Posts: 9
Re: Debugger crash on OSX El Capitan
« Reply #12 on: April 09, 2018, 12:26:45 pm »
Hi,

Yup, that works!

Many thanks everyone.

John  ;D