Recent

Author Topic: macOS Sierra - Debugging not working  (Read 56967 times)

tshahzad

  • New member
  • *
  • Posts: 9
Re: macOS Sierra - Debugging not working
« Reply #15 on: October 05, 2016, 09:51:37 am »
GDB installed using fink and brew did not work for me. However GDB installed through macports did the trick and works.

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: macOS Sierra - Debugging not working
« Reply #16 on: October 05, 2016, 10:54:18 am »
Yes, because I can confirm that one is correctly signed.
Maybe of interest to Jonas et al.
And should be in the wiki.
Specialize a type, not a var.

mbdev

  • New Member
  • *
  • Posts: 44
Re: macOS Sierra - Debugging not working
« Reply #17 on: October 05, 2016, 11:37:15 am »
Hi,
I tried to install gdb using MacPorts, but it failed :/

I did the following steps and attached a screenshot of the error:


Xcode and Xcode Command Line Tools were already installed on my machine. GDB was removed using:
Code: Text  [Select][+][-]
  1. brew remove gdb

1. I downloaded and installed MacPorts from: https://www.macports.org/install.php

2. I created a new terminal and executed:
Code: Text  [Select][+][-]
  1. sudo port install gdb

3. After the installation progress gdb was installed and can be executed using ggdb. The normal gdb command will not work. When starting Lazarus I had to change the debugger path to /opt/local/bin/ggdb
To display the path of gdb run:
Code: Text  [Select][+][-]
  1. which -a ggdb

4. Moreover I had to assign the certificate


Coldzer0

  • Jr. Member
  • **
  • Posts: 50
Re: macOS Sierra - Debugging not working
« Reply #18 on: October 22, 2016, 05:39:33 am »
at first if it's not signed sign it >> u will find a lot of tut on google

then on IDE

Click on Tools > Options > Debugger
in
Debugger_Startup_Options
add this with quotes

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


and if u use gdb alone put this inside .gdbinit
this one without quotes
"set startup-with-shell off"

mac01

  • New Member
  • *
  • Posts: 15
Re: macOS Sierra - Debugging not working
« Reply #19 on: October 28, 2016, 09:24:43 pm »
Any update on a fix for this.

I too have upgraded to Mac OS Sierra and Xcode 8.1; and now have the same issue of no GDB.
I have installed/re-installed GGDB currently running ggdb 7.9.1
I also get the same error when using Gdb (7.11.1).

I have created new certificates and assigned to both ggd and ggdb ( laz-gdb and laz-gddb).

I have also disabled sip, and also DE-installed Anti Virus.

I have tried setting the debugger options
Quote
"--eval-command=set startup-with-shell off"


and if u use gdb alone put this inside .gdbinit
this one without quotes
"set startup-with-shell off"


When ever I try to run an application with debugger I get.
Debugger Error....
"-exec-run"
returned the error
",msg="During startup program terminated with signal SIG113, Real-time event 113."

Any other ideas or possible solutions out there ?


Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: macOS Sierra - Debugging not working
« Reply #20 on: October 28, 2016, 09:58:07 pm »
Any other ideas or possible solutions out there ?

If necessary, you can always debug any executable with the debugger included with Xcode. Open a Terminal window and run it like this:

  lldb myprogram.app

If you're familiar with gdb command-line commands, here's the mapping from gdb to lldb:

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

mac01

  • New Member
  • *
  • Posts: 15
Re: macOS Sierra - Debugging not working
« Reply #21 on: October 28, 2016, 11:49:57 pm »
Hi Phil,

Thanks for that;  I will definitely use that for the moment until the integration of the debugger can be fixed.

Not ideal obviously; as setting breakpoints etc on the fly as far as  can see is not possible.

Again thanks for the info.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: macOS Sierra - Debugging not working
« Reply #22 on: October 29, 2016, 02:03:25 am »
Not ideal obviously; as setting breakpoints etc on the fly as far as  can see is not possible.

Sure you can. You just have to familiarize yourself with the lldb commands. Example:

lldb myapp.app

To set a breakpoint at line 75 of mainform.pas:

breakpoint set -f mainform.pas -l 75

run

When breakpoint hit, examine variable contents. Variable names must be all caps since that's how they appear in debug info:

p VARNAME

Continue with execution:

c

Exit debugger:

q

Martin V

  • Full Member
  • ***
  • Posts: 139
Re: macOS Sierra - Debugging not working
« Reply #23 on: October 31, 2016, 09:44:28 am »
Thank you for the lldb description. I have got MacOS 10.11, XCode 7 and the gdb IDE intetration also does not work.

To find the position where my program crashes, the lldb terminal way is sufficient. But I do not manage that the source file name and line number is shown. In the IDE, I have got all debug options activated besides the "other debugging info". dwarf2 is selected. Any ideas?

ThierryJ

  • New Member
  • *
  • Posts: 21
Re: macOS Sierra - Debugging not working
« Reply #24 on: October 31, 2016, 05:16:42 pm »
Hello,
Under OSX 10.11.5 I was able to debug normally. Than I have made the upgrade to MacOS 10.12 and... everything was still OK ! No problems.
Than I made the upgrade to MacOS 10.12.1, and the debugger was once mode broken. I have tried to sign ggdb and/or to stop the security system, either partially or totally, no success.
I decided to rollback to 10.12, and it works.
But I hate to be faced to such an instability.

mac01

  • New Member
  • *
  • Posts: 15
Re: macOS Sierra - Debugging not working
« Reply #25 on: October 31, 2016, 05:24:14 pm »
Hi
I agree; after days of trying all kinds of things. I decided to go back to El Capitan. All working now..
I will watch threads and posts for any updates; in case at some time I want to try again.


ThierryJ

  • New Member
  • *
  • Posts: 21
Re: macOS Sierra - Debugging not working
« Reply #26 on: October 31, 2016, 06:44:58 pm »
@mac01
Note : I have been able to migrate to Sierra (10.12) easily. In fact I have done nothing. Than the last update to 10.12.1  broke the stuff.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: macOS Sierra - Debugging not working
« Reply #27 on: November 01, 2016, 12:46:47 am »
To find the position where my program crashes, the lldb terminal way is sufficient. But I do not manage that the source file name and line number is shown.

Sorry, I'm not sure I follow what you're asking.

Are you asking, how to generate a backtrace?

Same as gdb: bt

How to disable application-level exception handling?

In gdb, it's this:  break fpc_raiseexception

In lldb, it's this:  breakpoint set -n fpc_raiseexception

Works fine here with, for example, an exception raised like this:

procedure TForm1.Button1Click(Sender: TObject);
begin
  raise Exception.Create('Some exception would occur');
end;

Displays this:

  * frame #0: 0x0001d670 project1`FPC_RAISEEXCEPTION
    frame #1: 0x00037b9c project1`BUTTON1CLICK(this=0x00654d30, SENDER=0x00657890) + 60 at unit1.pas:31
    frame #2: 0x00104d08 project1`CLICK(this=0x00657890) + 88 at control.inc:2736
    frame #3: 0x0013d94d project1`CLICK(this=0x00657890) + 29 at buttoncontrol.inc:54
    frame #4: 0x0013dfcd project1`CLICK(this=0x00657890) + 61 at buttons.inc:169
etc...

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: macOS Sierra - Debugging not working
« Reply #28 on: November 01, 2016, 12:56:22 am »
@mac01
Note : I have been able to migrate to Sierra (10.12) easily. In fact I have done nothing. Than the last update to 10.12.1  broke the stuff.

The GDB debugger is part of GNU. Xcode does not use GNU tools (gcc, gdb) anymore. Xcode uses LLVM. LLVM's debugger is LLDB.

No surprise that unsupported software might eventually stop working.

Some links of interest:

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

http://lldb.llvm.org/

Even Eclipse is adding support for LLDB:

https://wiki.eclipse.org/CDT/User/FAQ#How_do_I_get_the_LLDB_debugger.3F

Martin V

  • Full Member
  • ***
  • Posts: 139
Re: macOS Sierra - Debugging not working
« Reply #29 on: November 01, 2016, 08:40:21 am »
Thank you all for your hints. Now I managed to get the line where my program crashes. Here's the step-by-step explanation:

1. start lldb from the terminal:

lldb myprog.app -- optionalparameters

2. enter: breakpoint set -n fpc_raisceexception

3: enter: run

Now the program runs, let it crash, the stack trace address list with hex addresses appears.

4. enter: bt

Now the program line numbers and other information is shown, your program is frozen

5. enter: finish

program runs again and shows its own error message.

I have another bug where my program simply ends without exeption. Even running via lldb let me only get a runtime error number and hex addresses. Typing "bt" does not work because the thread has already ended. How can I convert the addresses into source line numbers?

But I still don't understand why the lldb integration does not work on my El Captain MacosX. I have got an older Mac with 10.6 with fpc 2.6 and there it did not work, too.
« Last Edit: November 01, 2016, 08:54:04 am by Martin V »

 

TinyPortal © 2005-2018