qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 00/43] Windbg supporting


From: Mihail Abakumov
Subject: Re: [Qemu-devel] [PATCH 00/43] Windbg supporting
Date: Tue, 24 Oct 2017 14:18:34 +0300
User-agent: Roundcube Webmail/1.1.2

Alistair Francis писал 2017-09-26 20:26:
On Tue, Sep 26, 2017 at 4:04 AM, Mihail Abakumov
<address@hidden> wrote:
We made the debugger module WinDbg (like GDB) for QEMU. This is the replacement of the remote stub in Windows kernel. Used for remote Windows kernel debugging without debugging mode.

WinDbg is a multipurpose debugger for the Microsoft Windows computer operating system, distributed by Microsoft. Recent versions of WinDbg have been and are being distributed as part of the free Debugging Tools for Windows suite.

How to start debugging QEMU using WinDbg:
  Run QEMU with next option:
    -windbg pipe:<name>
  QEMU will start and pause for waiting WinDbg connection.
  Run WinDbg with next options:
    -b -k com:pipe,baud=115200,port=\\.\pipe\<name>,resets=0
  Wait for debugger connect to kernel.

Note: You can add Symbol Search Path in WinDbg such as srv*c:\tmp*http://msdl.microsoft.com/download/symbols.

How it works:
The WinDbg debugger has the possibility of connecting to a remote debug service (Kdsrv.exe) in the Windows kernel. Therefore, it is possible to connect to the guest system running in the QEMU emulator. Kernel debugging is possible only with the enabled debugging mode, may change at the same time. Our module of WinDbg debugger for QEMU is an alternative of the remote debugging service in the kernel. Thus, the debugger connects to the debugging module, not to the kernel of the operating system. The module obtains all the necessary information answering debugger requests from the QEMU emulator. At the same time for debugging there is no need to enable debugging mode in the kernel. This leads to hidden debugging. Our module supports all features of WinDbg regarding remote debugging, besides interception of events and exceptions. Only i386 is supported now.

---

This looks pretty cool! Thanks for sending the patches.

I had a quick look through it. I think something worth keeping in mind
is that ideally we want this to support every target. So generally
it's best to have the target specific code in the target/ directory
and then make the stubs all generic. At the moment it looks like there
is a fair bit of x86 specific code in the debugger.

I guess this is a weird case though as Windows only runs on x86, but
in the future it sounds like ARM will be supported and it'd be great
if this could be easily extended to support that.

Thanks,
Alistair


Once again, thank you for your feedback.

I done it. I moved the target specific code in the 'target/' directory and made the stub for unsupported 'targets'.
Problems with targets received by Patchew I've already fixed.

Thanks,
Mihail Abakumov


Mihail Abakumov (43):
      windbg: added empty windbgstub files
      windbg: added windbg's KD header file
      windbg: modified windbgkd.h
      windbg: added '-windbg' option
      windbg: added helper features
      windbg: added WindbgState
      windbg: added chardev
      windbg: hook to wrmsr operation
      windbg: handler of fs/gs register
      windbg: structures for parsing data stream
      windbg: parsing data stream
      windbg: send data and control packets
      windbg: handler of parsing context
      windbg: init DBGKD_ANY_WAIT_STATE_CHANGE
      windbg: sized data buffer
      windbg: generate ExceptionStateChange
      windbg: generate LoadSymbolsStateChange
      windbg: windbg_vm_stop
      windbg: implemented windbg_process_control_packet
      windbg: implemented windbg_process_data_packet
      windbg: implemented windbg_process_manipulate_packet
windbg: implemented kd_api_read_virtual_memory and kd_api_read_virtual_memory
      windbg: kernel's structures
      windbg: implemented kd_api_get_context and kd_api_set_context
windbg: implemented kd_api_read_control_space and kd_api_write_control_space
      windbg: implemented windbg_read_context
      windbg: implemented windbg_write_context
      windbg: implemented windbg_read_ks_regs
      windbg: implemented windbg_write_ks_regs
      windbg: implemented windbg_set_sr
      windbg: implemented windbg_set_dr
      windbg: implemented windbg_set_dr7
windbg: implemented windbg_hw_breakpoint_insert and windbg_hw_breakpoint_remove windbg: implemented kd_api_write_breakpoint and kd_api_restore_breakpoint
      windbg: debug exception subscribing
      windbg: implemented kd_api_continue
windbg: implemented kd_api_read_io_space and kd_api_write_io_space windbg: implemented kd_api_read_physical_memory and kd_api_write_physical_memory
      windbg: implemented kd_api_get_version
      windbg: implemented kd_api_read_msr and kd_api_write_msr
      windbg: implemented kd_api_search_memory
      windbg: implemented kd_api_fill_memory
      windbg: implemented kd_api_query_memory


 Makefile.target                 |    5
 cpus.c                          |   18
 gdbstub.c                       |    4
 include/exec/windbgkd.h         | 1030 ++++++++++++++++++++++
 include/exec/windbgstub-utils.h |  132 +++
 include/exec/windbgstub.h       |   21
 include/sysemu/sysemu.h         |    2
 qemu-options.hx                 |    8
 target/i386/misc_helper.c       |    3
 vl.c                            |    8
windbgstub-utils.c | 1788 +++++++++++++++++++++++++++++++++++++++
 windbgstub.c                    |  464 ++++++++++
 12 files changed, 3482 insertions(+), 1 deletion(-)
 create mode 100755 include/exec/windbgkd.h
 create mode 100755 include/exec/windbgstub-utils.h
 create mode 100755 include/exec/windbgstub.h
 create mode 100755 windbgstub-utils.c
 create mode 100755 windbgstub.c

--
Thanks,
Mihail Abakumov




reply via email to

[Prev in Thread] Current Thread [Next in Thread]