QEMU Debugging Windows

Source: Internet
Author: User
Tags gdb debugger

Original address: http://blog.csdn.net/ariesjzj/article/details/8698439

Kernel-level Windows debugging, Windbg+virtualbox (Vmware) is a good solution, but Windbg relies on guest (that is, windows). If the guest of Windows Small crash, you can catch, but if the crash is more serious, and WinDbg communication that part of the damage, then WinDbg can not work. With QEMU, there is no problem, because the gdbserver in QEMU is in the virtual machine, and the guest no matter how crash has no effect.

1. To prepare the image file for Windows, you can install it with QEMU's virtual CDROM. You can also use VirtualBox to select the Qcow format and install it (the latest VirtualBox has this feature). Note that Qcow does not support snapshot, and qcow2 support, both can be turned through qemu-img.


2. Run QEMU, such as:

$ qemu-sytem-x86_64-hda/home/zjin/win7.qcow-m 2048-net nic.vlan=0-net user,vlan=0,hostname=emu-boot C
It is best not to add KVM:-machine ACCEL=KVM or-ENABLE-KVM, otherwise the system can run, but the software interrupt cannot stop.


3. From Gdbserver

Ctrl+alt+2 into the monitor in Qemu, then (QEMU) gdbserver

You can also start the system with the QEMU command line plus-s-s.


4. Start GDB on Host, execute

(GDB) Target remote localhost:1234

If the guest is 64, you have to do it.

(GDB) Set architecture i386:x86-64

Then you can use GDB to tune, to see some analog hardware information (TLB, CRX, MSR, GDT, etc.) can be ctrl+alt+2 to monitor.



Some questions:

* NO available block device supports snapshots
may be image file format not supported, turn image file into Qcow2

* Remote ' g ' packet reply is too long:

The change of mode gdb does not know, so to manually change:
GDB Set Architecture i386:x86-64

GDB Set Archtecture i386

Reference:

Running Virtual machines with QEMU-KVM http://doc.opensuse.org/products/draft/SLES/SLES-kvm_sd_draft/cha.qemu.running.html

Debugging Tips (qemu+windbg) http://www.h7.dion.ne.jp/~qemu-win/DebuggingTips-en.html#windbg

Developing Linux inside QEMU/KVM Virtual machines http://chemnitzer.linux-tage.de/2012/vortraege/folien/1061- Virtualdebugging.pdf

Qemu+gdb http://www.ece.cmu.edu/~ee349/f-2012/lab2/qemu.pdf

Using IDA ' s GDB debugger with QEMU emulator https://www.hex-rays.com/products/ida/support/tutorials/debugging_gdb_qemu.pdf


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.