Show Register Values of QEMU Emulator

To accomplish it, you can pass -monitor stdio option to qemu-system-TARGET. This option provides a monitor console for interacting with QEMU. And then info registers command prints the register values to stdout.

$ qemu-system-x86_64 -monitor stdio -kernel kernel.elf
(qemu) info registers
EAX=cafebabe EBX=00009500 ECX=0010000c EDX=00000511

Also, it can be done with gdb. If -s option was passed, QEMU listen on port 1234 and wait for gdb connection.

$ qemu-system-x86_64 -s -kernel kernel.elf &
$ gdb
(gdb) target remote localhost:1234
(gdb) info registers
eax            0xcafebabe       -889275714
ecx            0x10000c 1048588
edx            0x511    1297
ebx            0x9500   38144

Now you can make sure the value of EAX is 0xcafebabe.

Gentaro "hibariya" Terada

Otaka-no-mori, Chiba, Japan
Email me

Likes Ruby, Internet, and Programming.