Forum > macOS / Mac OS X

Debugger not working with Apple Silicon code

(1/4) > >>

jwdietrich:
When trying to start a file compiled for Apple Silicon processors the debugger enters an error state. The program can be executed but without a debugger only.

This issue may have been discussed previously, but I am not sure if this is the same error and, obviously, no solution is available.

[Edit: clarified post title]

Martin_fr:
I assume you are using "lldb + fpdebug"?

What does the menu: View > IDE internals > Debug output show? (Note: First open the window, then try to run the app in the debugger)


Is it possible to load the app in lldb, and run it under lldb?
- See above output for lldb commands needed. / Do any of them need change?
- What does lldb report

jwdietrich:
Well, I can run my program from lldb.

The debug output from Lazarus is very long:

>> settings set -- frame-format "frame #${frame.index}: ${frame.pc}, {${frame.sp}}, {${frame.fp}} &&//FULL: {${line.file.fullpath}} &&//SHORT: {${line.file.basename}} &&//LINE: {${line.number}} &&//MOD: {${module.file.basename}} &&//FUNC: {${function.name-with-args}} <<&&//FRAME\n"
(lldb) settings set -- frame-format "frame #${frame.index}: ${frame.pc}, {${frame.sp}}, {${frame.fp}} &&//FULL: {${line.file.fullpath}} &&//SHORT: {${line.file.basename}} &&//LINE: {${line.number}} &&//MOD: {${module.file.basename}} &&//FUNC: {${function.name-with-args}} <<&&//FRAME\n"
>> settings set -- thread-format "thread #${thread.index}: tid=${thread.id%tid}: ${frame.pc}, {${frame.sp}}, {${frame.fp}} &&//FULL: {${line.file.fullpath}} &&//SHORT: {${line.file.basename}} &&//LINE: {${line.number}} &&//MOD: {${module.file.basename}} &&//FUNC: {${function.name-with-args}} <<&&//FRAME{, stop reason = ${thread.stop-reason}}\n"
(lldb) settings set -- thread-format "thread #${thread.index}: tid=${thread.id%tid}: ${frame.pc}, {${frame.sp}}, {${frame.fp}} &&//FULL: {${line.file.fullpath}} &&//SHORT: {${line.file.basename}} &&//LINE: {${line.number}} &&//MOD: {${module.file.basename}} &&//FUNC: {${function.name-with-args}} <<&&//FRAME{, stop reason = ${thread.stop-reason}}\n"
>> settings set -- thread-stop-format "thread #${thread.index}: tid=${thread.id%tid}: ${frame.pc}, {${frame.sp}}, {${frame.fp}} &&//FULL: {${line.file.fullpath}} &&//SHORT: {${line.file.basename}} &&//LINE: {${line.number}} &&//MOD: {${module.file.basename}} &&//FUNC: {${function.name-with-args}} <<&&//FRAME{, stop reason = ${thread.stop-reason}}\n"
(lldb) settings set -- thread-stop-format "thread #${thread.index}: tid=${thread.id%tid}: ${frame.pc}, {${frame.sp}}, {${frame.fp}} &&//FULL: {${line.file.fullpath}} &&//SHORT: {${line.file.basename}} &&//LINE: {${line.number}} &&//MOD: {${module.file.basename}} &&//FUNC: {${function.name-with-args}} <<&&//FRAME{, stop reason = ${thread.stop-reason}}\n"
>> target stop-hook add -o "thread list"
(lldb) target stop-hook add -o "thread list"
Stop hook #1 added.
>> settings set -- stop-line-count-after 0
(lldb) settings set -- stop-line-count-after 0
>> settings set -- stop-line-count-before 0
(lldb) settings set -- stop-line-count-before 0
>> settings set -- stop-disassembly-count 0
(lldb) settings set -- stop-disassembly-count 0
>> settings set -- target.env-vars "USER=johannes"
(lldb) settings set -- target.env-vars "USER=johannes"
>> settings set -- target.env-vars "COMMAND_MODE=unix2003"
(lldb) settings set -- target.env-vars "COMMAND_MODE=unix2003"
>> settings set -- target.env-vars "__CFBundleIdentifier=lazarus.freepascal.ide"
(lldb) settings set -- target.env-vars "__CFBundleIdentifier=lazarus.freepascal.ide"
>> settings set -- target.env-vars "PATH=/usr/bin:/bin:/usr/sbin:/sbin"
(lldb) settings set -- target.env-vars "PATH=/usr/bin:/bin:/usr/sbin:/sbin"
>> settings set -- target.env-vars "LOGNAME=johannes"
(lldb) settings set -- target.env-vars "LOGNAME=johannes"
>> settings set -- target.env-vars "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.0uHEBrpxu5/Listeners"
(lldb) settings set -- target.env-vars "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.0uHEBrpxu5/Listeners"
>> settings set -- target.env-vars "SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS=/Users/johannes/Library/WebKit/Databases"
(lldb) settings set -- target.env-vars "SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS=/Users/johannes/Library/WebKit/Databases"
>> settings set -- target.env-vars "HOME=/Users/johannes"
(lldb) settings set -- target.env-vars "HOME=/Users/johannes"
>> settings set -- target.env-vars "SHELL=/bin/zsh"
(lldb) settings set -- target.env-vars "SHELL=/bin/zsh"
>> settings set -- target.env-vars "TMPDIR=/var/folders/fh/2r9_mhf953l9f10kmr7by46w0000gn/T/"
(lldb) settings set -- target.env-vars "TMPDIR=/var/folders/fh/2r9_mhf953l9f10kmr7by46w0000gn/T/"
>> settings set -- target.env-vars "__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x3"
(lldb) settings set -- target.env-vars "__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x3"
>> settings set -- target.env-vars "XPC_SERVICE_NAME=application.lazarus.freepascal.ide.1177857.3841679"
(lldb) settings set -- target.env-vars "XPC_SERVICE_NAME=application.lazarus.freepascal.ide.1177857.3841679"
>> settings set -- target.env-vars "XPC_FLAGS=0x0"
(lldb) settings set -- target.env-vars "XPC_FLAGS=0x0"
>> target create '/Users/Shared/Projekte/Endokrinologie/SD/TFC und SD-Homöostase/SimThyr/code/trunk/SimThyr GUI/SimThyr.app'
(lldb) target create '/Users/Shared/Projekte/Endokrinologie/SD/TFC und SD-Homöostase/SimThyr/code/trunk/SimThyr GUI/SimThyr.app'
Current executable set to '/Users/Shared/Projekte/Endokrinologie/SD/TFC und SD-Homöostase/SimThyr/code/trunk/SimThyr GUI/SimThyr.app' (arm64).
>> settings clear target.run-args
(lldb) settings clear target.run-args
>> breakpoint set --func fpc_break_error -K false
(lldb) breakpoint set --func fpc_break_error -K false
Breakpoint 1: no locations (pending).
>> breakpoint set --func fpc_runerror -K false
WARNING:  Unable to resolve breakpoint to any actual locations.
(lldb) breakpoint set --func fpc_runerror -K false
Breakpoint 2: no locations (pending).
>> breakpoint set --func fpc_raiseexception -K false
WARNING:  Unable to resolve breakpoint to any actual locations.
(lldb) breakpoint set --func fpc_raiseexception -K false
Breakpoint 3: where = SimThyr`FPC_RAISEEXCEPTION, address = 0x0000000100013c50
>> breakpoint command add 3
>> p/x $x0
>> p/x $x2
>> p ((char ***)$x0)[0][3]
>> p ((char **)$x0)[1]
>> DONE
>> version
(lldb) breakpoint command add 3
(lldb) version
>> breakpoint command add 2
>> p/x $x0
>> DONE
>> version
lldb-1403.0.17.67
Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)
(lldb) breakpoint command add 2
(lldb) version
>> breakpoint command add 1
>> p/x $x0
>> DONE
>> version
lldb-1403.0.17.67
Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)
(lldb) breakpoint command add 1
(lldb) version
>> process launch -n
lldb-1403.0.17.67
Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)
(lldb) process launch -n
error: the platform is not currently connected
>> process kill
>> quit


lldb reports a lot of warnings:

(lldb) target create "/Users/Shared/Projekte/Endokrinologie/SD/TFC und SD-Homöostase/SimThyr/code/trunk/SimThyr GUI/SimThyr"
Current executable set to '/Users/Shared/Projekte/Endokrinologie/SD/TFC und SD-Homöostase/SimThyr/code/trunk/SimThyr GUI/SimThyr' (arm64).
(lldb) r
Process 38671 launched: '/Users/Shared/Projekte/Endokrinologie/SD/TFC und SD-Homöostase/SimThyr/code/trunk/SimThyr GUI/SimThyr' (arm64)
2023-07-05 17:42:54.070356+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x106906d10 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.070997+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x106906d10 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.222083+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x104d0a4b0 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.324564+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x1020058f0 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.350967+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x100f13b80 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.365819+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x100f61e40 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.395551+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x104d232a0 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.397030+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x104d232a0 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.397194+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x104d232a0 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.397724+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x104d232a0 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.401484+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x100f85ad0 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.411120+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x106906f40 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.421616+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x10208de40 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.423126+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x10208de40 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.423304+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x10208de40 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.423971+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x10208de40 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.428609+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x10209c2a0 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.429348+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x10209c2a0 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.432052+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x1020a8160 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.439699+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x104d0a4b0 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.439884+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x104d0a4b0 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.440370+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x104d0a4b0 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.441026+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x106906f40 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.441556+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x106906f40 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.442017+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x106906f40 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.443000+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x100f85ad0 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.443190+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x100f85ad0 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.443620+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x100f85ad0 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.455275+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x100fa5a20 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.468162+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x12543cc50 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.480620+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x1020f4e40 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.481435+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x1020f4e40 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.481940+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x1020f4e40 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.482730+0200 SimThyr[38671:1729295] [Window] Warning: Window TCocoaWindow 0x1020f4e40 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-05 17:42:54.499202+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.499390+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.499548+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.499680+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.499819+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.499961+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.500089+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.501003+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.501394+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.501532+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.501659+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.501798+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.502092+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.502959+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.503088+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.503306+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.503434+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.503570+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.504553+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.504690+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0
2023-07-05 17:42:54.504823+0200 SimThyr[38671:1729295] [default] CGSWindowShmemCreateWithPort failed on port 0


I don't think that they are too important. At least the program starts.

Could the line "the platform is not currently connected" in the Lazarus output be the key?

Martin_fr:

--- Quote ---Could the line "the platform is not currently connected" in the Lazarus output be the key?
--- End quote ---

Quite possible.
Or "r" vs "process launch -n"
Also a diff in your test, the name of the app. Under the IDE it ended in ".app"

The problem is I don't develop on Mac, so I can't test it.
I know some people are (or at least were) able to start M1 apps. But I can't tell what changed.

jwdietrich:

--- Quote from: Martin_fr on July 06, 2023, 12:13:47 am ---The problem is I don't develop on Mac, so I can't test it.
I know some people are (or at least were) able to start M1 apps. But I can't tell what changed.

--- End quote ---

OK. Thanks for your advice anyway.

Navigation

[0] Message Index

[#] Next page

Go to full version