Vinay
Vinay

Reputation: 21

Can't debug arm64 binary with lldb in MAC m1 (can't revert back to arm64 from i386 in mac m1)

Check this screenshot for reference.

enter image description here

❯ uname -a
Darwin APPLEs-MacBook-Air.local 23.6.0 Darwin Kernel Version 23.6.0: Wed Jul 31 20:49:46 PDT 2024; root:xnu-10063.141.1.700.5~1/RELEASE_ARM64_T8103 x86_64

I can't debug an arm64 binary with lldb. I made a simple "Hello World" C program and compiled it using clang -target arm64-apple-darwin hello.c -o hello-arm. It runs fine on my Mac M1, but the architecture is set to i386 even though I have an M1 chip.

When I try to attach lldb to the arm64 binary, it says "platform not connected." So, I specified the architecture and ran lldb, but I got this error:

❯ arch -arm64 lldb ./hello-arm
arch: posix_spawnp: lldb: Bad CPU type in executable

Note: I was able to attach lldb to the same C program when it was compiled with:

~/sample-c
❯ clang hello.c -o hello-x86

~/sample-c
❯ file hello-x86
hello-x86: Mach-O 64-bit executable x86_64

How can I debug arm64 binaries with lldb? I can't attach lldb to Finder, even with SIP disabled:

❯ lldb -n Finder
(lldb) process attach --name "Finder"
error: attach failed: debugserver is x86_64 binary running in translation, attach failed.

Upvotes: 1

Views: 28

Answers (0)

Related Questions