boot-qemu.sh: Add the ability to debug with GDB#5
Conversation
Adding '-s -S' stops the CPU and allows us to connect with GDB via 'target remote :1234'. This implies '-i' so that the machine does not get killed in the middle of debugging. Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
nickdesaulniers
left a comment
There was a problem hiding this comment.
Might be nice to:
- print a helpful message like "starting qemu debugging on port XYX\nUse:\ntarget remote :XYZ\nto connect`
- move boot-qemu-help.txt to a README.md file, so that we show info in the github, too. All we do otherwise is cat it. Doesn't need to actually contain markdown.
thanks for the patch!
Suggested-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Thanks for the suggestion, done! Let me know if it looks good to you before I merge it.
I will do this in a follow up PR once this has been merged since it is a good idea. |
I wonder if it's good idea to actually start gdb from the script with appropriate commandline like
GitHub renders |
Yeah, as it currently stands the script will just "hang" after printing that message and the QEMU command via
Good to know! |
Oh! Yeah, that's great! I would love if it prompted me to restart if I quit gdb, too, since you can't restart a kernel image withing gdb AFAIK. |
| echo "to connect" | ||
| echo | ||
| printf '\033[0m' | ||
| QEMU=( "${QEMU[@]}" -s -S ) |
There was a problem hiding this comment.
I'm playing with this now; does this just fallthrough and execute qemu below?
There was a problem hiding this comment.
ah, I see, it sets the arg, then executes below. got it.
Adding '-s -S' stops the CPU and allows us to connect with GDB via
'target remote :1234'.
This implies '-i' so that the machine does not get killed in the middle
of debugging.