I can find instructions online to break on accesses to memory addresses using gdb (Watch a memory range in gdb?) but I can't figure out how to do so for memory addresses on the guest machine when I use qemu.
Asked
Active
Viewed 1,865 times
1 Answers
3
You start qemu with gdb server listening on port 1234 by supplying -s
to the qemu comman line. From qemu man page:
-s Shorthand for -gdb tcp::1234, i.e. open a gdbserver on TCP port 1234.
In additon to this, you can also use option -S
which will stop Qemu from progressing until you connect gdb to it and issue continue
command.
-S Do not start CPU at startup (you must type 'c' in the monitor).
From gdb, you connect to the gdb server running on qemu, by starting gdb (version of gdb that fits you guest architecture). Then connect to the gdb server by command (if qemu is running on the same machine):
(gdb) target remote :1234
References:
-
2Here is a more detailed QEMU GDB setup tutorial: https://stackoverflow.com/a/33203642/895245 – Ciro Santilli OurBigBook.com May 29 '17 at 07:45