You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`gdbserver` command starts the server implementation that can be connected to GDB or LLDB. LLDB is more recommended because it supports pointer authentication and Darwin kernel dyld.
161
-
162
-
You need to load kernel extensions to get symbols on LLDB. The below shell script generates `target.lldb`, a convenient LLDB script that sets the target and loads kernel extensions:
158
+
## Using a debugger
159
+
m1n1 supports networked debugging. Running `gdbserver` in the hypervisor shell will start a debug
160
+
server implementation that can be connected to from GDB or LLDB. We recommend using LLDB, as it
161
+
has better support for Mach-O, pointer authentication, and XNU's use of dyld.
163
162
163
+
An LLDB script is needed to load symbols for all kernel extensions. The shell script below
164
+
can be used from macOS to generate an LLDB script which will do this for you:
The following commands for LLDB loads the generated script and connects to m1n1:
172
+
The above assumes that you are booted on macOS and inside the KDK `Kernels` directory.
173
+
174
+
From LLDB, you can then run the generated script and connect to m1n1's debug server:
170
175
```
171
176
command source -e false target.lldb
172
177
process connect unix-connect:///tmp/.m1n1-unix
173
178
```
174
179
175
-
Do not run hypervisor console commands interfering with GDB/LLDB, or they will be out-of-sync. For example, do not edit breakpoints from both of hypervisor console and GDB/LLDB at the same time.
180
+
Do not attempt to use both the hypervisor shell's builtin debugging features and an external
181
+
debugger at the same time. For example, do not attempt to add or edit breakpoints from the hypervisor
182
+
shell while using LLDB.
176
183
177
184
# Sources
178
185
Source for the kernelcache creation: [https://kernelshaman.blogspot.com/2021/02/building-xnu-for-macos-112-intel-apple.html](https://kernelshaman.blogspot.com/2021/02/building-xnu-for-macos-112-intel-apple.html)
0 commit comments