Reputation: 2807
I know how to set up kernel debugging with qemu-gdbserver
using -s
switch. In Linux, kernel memory is non-swapable. Hence, the kernel virtual address remains the same for all processes in the system. Setting a breakpoint on a kernel address is a non-issue. However, there are multiple processes running on the system with potentially overlapping address ranges, but on their very own address spaces. Is there any means to set a breakpoint on (a) a specific process which is already running, and I know the PID of? (b) a specific process that is going to be created and I know the name of the binary/application?
Upvotes: 1
Views: 1619
Reputation: 11433
QEMU's gdbstub is essentially a "system level" debug, similar to what you would get from a JTAG debugger. Any support for knowledge of guest-OS-specific concepts like user processes is something that would need to be in the debugger (where it works by knowing enough about guest OS internals to query the OS process table, set breakpoints for when the OS switches tasks, etc).
You might look at whether the kernel's gdb helper scripts have anything useful here, though I'm not sure if they get as sophisticated as "breakpoints in user processes": https://www.kernel.org/doc/html/latest/dev-tools/gdb-kernel-debugging.html
Upvotes: 1