-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
m1n1.hv: Introduce gdbserver #194
Conversation
1d8b13c
to
07b80df
Compare
I have done changes I have planned for so here is a summary of changes since the initial version: General m1n1.hv changes
gdbserver-specific changes
|
4d4cc57
to
155eca9
Compare
b5350de
to
5294bd7
Compare
Thank you for working on this! This is a really cool feature I wanted to have for a long time. Can you fix the conflicts on hv.py, and maybe explain a bit how the exception handling / CPU switching stuff changes? From what I can tell:
I've long been bothered by the cpu() stuff causing an exit out of the shell. If I figure out a better way to implement it without an unwind (e.g. with proxy changes so the context switch happens without an exit out to the main loop, at least from the Python perspective) would that help make this a bit simpler? |
I just pushed some refactoring that makes |
Though I guess you'd still need a signal or something similar to exit the shell if you want synchronize the gdbserver and hv proxy shell execution state and allow using both at once (which I guess might be handy?) while still supporting break/continue from both sides. But at least it should simplify the CPU switching stuff. Alternatively you could have the gdbserver stuff mutex with the shell, so only one side can "own" the HV (when paused) at once. |
e998c36
to
396e177
Compare
Changes since my last comment:
Main advantages of LLDB are TBI/PAC support and Darwin kernel dyld support. GDB's TBI/PAC support is somewhat limited; it can only clear the upper bits and cannot handle TBI/PAC pointers in the kernel, which needs the upper bits to be filled. Darwin kernel dyld support on LLDB is enabled by default so LLDB can provide decent kernel debugging experience out-of-box. You may create a LLDB script to load the kernel and extensions: echo target create -s kernel.development.t8101.dSYM kernel.development.t8101 > target.lldb
for k in $(find Extensions); do [ "$(file -b --mime-type $k)" != application/x-mach-binary ] || printf 'image add %q\n' $k; done >> target.lldb The following commands for LLDB loads the generated script and connects to m1n1.
@marcan Rebased to commit 60254a3. I'll explain the rebased code from now on: The SIGUSR1/SIGUSR2 hack and the change for CPU switching code and should be distinguished. The SIGUSR1/SIGUSR2 hack are necessary to exit the shell as you noticed. gdbserver runs concurrently with the shell so you can use both of them at the same time. The change for CPU switching code is to prevent from switching the CPU when stepping, which causes GDB trigger an assertion failure. The behavior is implemented with the new The version before rebasing also had a change to maintain the exception contexts while switching CPUs to propagate breakpoints and watchpoints, but it is no longer necessary thanks to your refactoring. The refactoring also made things simpler by removing the necessity to store the intermediate states when switching contexts. |
Makes sense! I left some comments as to how to implement the |
6fcd18c
to
6f89fa4
Compare
Thanks! Looks good to me, if you can fix the merge conflicts I'll merge it! I think it's just an artifact of having moved |
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
c6e60c2: Added initialization of I forgot to recompile m1n1 so the code has actually not been tested at all(!). Fortunately the two changes were enough to get it work. (Background: I use a Makefile which automatically compiles the binary before launching m1n1 for Linux kernel debugging, but I don't use it for Darwin kernel debugging.) |
Thanks again! FWIW my approach with the hypervisor is to move fast and break things, so I'm not worried if there are any regressions lurking, we'll fix them in time. Sorry for taking so long to review this - it was large enough that I wanted to take a decent look and I've been busy, but I'm glad it's in! |
No description provided.