QEMU: Difference between revisions

Add useful tips about debugging with QEMU
[unchecked revision][unchecked revision]
m (→‎GDB-stub: Added note about omtimizations potentially breaking the debugger, and how to fix. ~~~~)
(Add useful tips about debugging with QEMU)
Line 115:
 
Whilst inside the emulator you can use CTRL-ALT-{1,2,3} to swap in/out of the emulation screen, the QEMU console and a serial console. The system console lets you change disk images and other things and do memory dumps etc.
 
In order to track down a triple fault, you can use the <tt>-d int</tt> option to show what interrupts happen. Work can be done even more easily when passing the <tt>-no-shutdown -no-reboot</tt> options, since that causes the virtual machine not to reboot, but instead halt. Then, in conjunction with the QEMU monitor (see below), you can debug the machine state more thoroughly.
 
===The QEMU Console===
 
It is possible to communicate with the QEMU console like one communicates with the Bochs console. However, this does not occur through port 0xE9 (which may be achieved by patching the source code however), but by using a serial port. ReactOS uses this to dump warning messages in the QEMU console. See [http://www.reactos.org/wiki/QEMU#Redirect_to_the_console the ReactOS wiki] for details.
 
===The QEMU monitor===
 
When you hit CTRL-ALT-2 you are placed in the QEMU monitor which is a command-line for querying information about the system while it is running. It does not quite act as a debugger, but, used in combination with GDB-stub, you can get pretty much all the functionality you will need. In Unix hosts, you can even redirect this monitor interface to the standard output using the
-monitor stdio
Line 143 ⟶ 147:
 
===Getting detailed logs===
 
Most of the QEMU source code has commented lines of the form:
 
241

edits