Skip to content
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

inoculate gdb wrapper should pass through SIGINTs to gdb #494

Open
hawkw opened this issue Dec 29, 2024 · 0 comments
Open

inoculate gdb wrapper should pass through SIGINTs to gdb #494

hawkw opened this issue Dec 29, 2024 · 0 comments
Labels
good first issue Good for newcomers kind/enhancement New feature or request

Comments

@hawkw
Copy link
Owner

hawkw commented Dec 29, 2024

when gdb is attached to a running process and receives a SIGINT, it pauses the debug target. this is nice because when you're debugging something where the kernel gets into a weird state or hangs or whatever, you can just wait for it to get to that state, whack C-c, and get it to pause wherever it is. this way, you don't have to figure out where you need breakpoints to be ahead of time or anything.

the main way to use GDB to debug mycelium is using the inoculate commands that start the kernel in QEMU and then attach a remote GDB to them. unfortunately, this means that you're not running GDB directly, you're running a Rust program that spawns a GDB process. and when the inoculate process gets a SIGINT, it does the default rust program behavior of killing its children and terminating. so, GDB doesn't handle the SIGINT by suspending the kernel. instead, it freaks out because the debug target has just disappeared, and then it immediately gets killed itself. so you can't just whack C-c and get it to pause.

instead, if you want to make GDB pause a wedged kernel when you whack C-c, you have to figure out the GDB command that the inoculate wrapper would use (mainly "where is the kernel binary to read symbols from") and invoke that command yourself. this is fine but it's not as nice as just using the inoculate command that i wrote to specifically do this.

we could make this nicer and have the inoculate command actually catch SIGINTs and just send them to the GDB process, instead of interpreting it as YES IT IS DEFINITELY TIME FOR ME TO EXIT IMMEDIATELY. this is probably a little annoying to actually do, but not all that hard...and it would make the dev experience way nicer.

@hawkw hawkw added kind/enhancement New feature or request good first issue Good for newcomers labels Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant