3.5 QEMU Monitor
The QEMU monitor is used to give complex commands to the QEMU
emulator. You can use it to:
- Remove or insert removable media images
(such as CD-ROM or floppies).
- Freeze/unfreeze the Virtual Machine (VM) and save or restore its state
from a disk file.
- Inspect the VM state without an external debugger.
3.5.1 Commands
The following commands are available:
- help or ? [cmd]
- Show the help for all commands or just for command cmd.
- commit
- Commit changes to the disk images (if -snapshot is used).
- info subcommand
- Show various information about the system state.
- info network
- show the various VLANs and the associated devices
- info block
- show the block devices
- info registers
- show the cpu registers
- info history
- show the command line history
- info pci
- show emulated PCI device
- info usb
- show USB devices plugged on the virtual USB hub
- info usbhost
- show all USB host devices
- info capture
- show information about active capturing
- info snapshots
- show list of VM snapshots
- info mice
- show which guest mouse is receiving events
- q or quit
- Quit the emulator.
- eject [-f] device
- Eject a removable medium (use -f to force it).
- change device setting
-
Change the configuration of a device.
- change diskdevice filename
- Change the medium for a removable disk device to point to filename. eg
(qemu) change cdrom /path/to/some.iso
- change vnc display,options
- Change the configuration of the VNC server. The valid syntax for display
and options are described at sec_invocation. eg
(qemu) change vnc localhost:1
- change vnc password
-
Change the password associated with the VNC server. The monitor will prompt for
the new password to be entered. VNC passwords are only significant upto 8 letters.
eg.
(qemu) change vnc password
Password: ********
- screendump filename
- Save screen into PPM image filename.
- mouse_move dx dy [dz]
- Move the active mouse to the specified coordinates dx dy
with optional scroll axis dz.
- mouse_button val
- Change the active mouse button state val (1=L, 2=M, 4=R).
- mouse_set index
- Set which mouse device receives events at given index, index
can be obtained with
info mice
- wavcapture filename [frequency [bits [channels]]]
- Capture audio into filename. Using sample rate frequency
bits per sample bits and number of channels channels.
Defaults:
- Sample rate = 44100 Hz - CD quality
- Bits = 16
- Number of channels = 2 - Stereo
- stopcapture index
- Stop capture with a given index, index can be obtained with
info capture
- log item1[,...]
- Activate logging of the specified items to /tmp/qemu.log.
- savevm [tag|id]
- Create a snapshot of the whole virtual machine. If tag is
provided, it is used as human readable identifier. If there is already
a snapshot with the same tag or ID, it is replaced. More info at
vm_snapshots.
- loadvm tag|id
- Set the whole virtual machine to the snapshot identified by the tag
tag or the unique snapshot ID id.
- delvm tag|id
- Delete the snapshot identified by tag or id.
- stop
- Stop emulation.
- c or cont
- Resume emulation.
- gdbserver [port]
- Start gdbserver session (default port=1234)
- x/fmt addr
- Virtual memory dump starting at addr.
- xp /fmt addr
- Physical memory dump starting at addr.
fmt is a format which tells the command how to format the
data. Its syntax is: /{count}{format}{size}
- count
- is the number of items to be dumped.
- format
- can be x (hex), d (signed decimal), u (unsigned decimal), o (octal),
c (char) or i (asm instruction).
- size
- can be b (8 bits), h (16 bits), w (32 bits) or g (64 bits). On x86,
h
or w
can be specified with the i
format to
respectively select 16 or 32 bit code instruction size.
Examples:
- Dump 10 instructions at the current instruction pointer:
(qemu) x/10i $eip
0x90107063: ret
0x90107064: sti
0x90107065: lea 0x0(%esi,1),%esi
0x90107069: lea 0x0(%edi,1),%edi
0x90107070: ret
0x90107071: jmp 0x90107080
0x90107073: nop
0x90107074: nop
0x90107075: nop
0x90107076: nop
- Dump 80 16 bit values at the start of the video memory.
(qemu) xp/80hx 0xb8000
0x000b8000: 0x0b50 0x0b6c 0x0b65 0x0b78 0x0b38 0x0b36 0x0b2f 0x0b42
0x000b8010: 0x0b6f 0x0b63 0x0b68 0x0b73 0x0b20 0x0b56 0x0b47 0x0b41
0x000b8020: 0x0b42 0x0b69 0x0b6f 0x0b73 0x0b20 0x0b63 0x0b75 0x0b72
0x000b8030: 0x0b72 0x0b65 0x0b6e 0x0b74 0x0b2d 0x0b63 0x0b76 0x0b73
0x000b8040: 0x0b20 0x0b30 0x0b35 0x0b20 0x0b4e 0x0b6f 0x0b76 0x0b20
0x000b8050: 0x0b32 0x0b30 0x0b30 0x0b33 0x0720 0x0720 0x0720 0x0720
0x000b8060: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
0x000b8070: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
0x000b8080: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
0x000b8090: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
- p or print/fmt expr
-
Print expression value. Only the format part of fmt is
used.
- sendkey keys
-
Send keys to the emulator. Use
-
to press several keys
simultaneously. Example:
sendkey ctrl-alt-f1
This command is useful to send keys that your graphical user interface
intercepts at low level, such as ctrl-alt-f1
in X Window.
- system_reset
-
Reset the system.
- usb_add devname
-
Add the USB device devname. For details of available devices see
usb_devices
- usb_del devname
-
Remove the USB device devname from the QEMU virtual USB
hub. devname has the syntax
bus.addr
. Use the monitor
command info usb
to see the devices you can remove.
3.5.2 Integer expressions
The monitor understands integers expressions for every integer
argument. You can use register names to get the value of specifics
CPU registers by prefixing them with $.