Cannot debug executable with lldb on macOS M1: attach failed ((os/kern) invalid argument

Viewed 835

I am trying to debug a C executable compiled for arm64 on an Apple M1 MacBook Pro, running macOS Monterey. However, when I try to run the program in lldb, I receive the following error:

(lldb) run
error: process exited with status -1 (attach failed ((os/kern) invalid argument))
1 Answers

To debug an arm64 executable on a system running Rosetta, you need to explicitly run lldb within the arm64 architecture. To do this:

arch -arm64 lldb ./your-program
Related