qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ladi Prosek <lprosek@redhat.com>
To: Mihail Abakumov <mikhail.abakumov@ispras.ru>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	sw@weilnetz.de, Pavel Dovgalyuk <dovgaluk@ispras.ru>,
	Roman Kagan <rkagan@virtuozzo.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Denis V. Lunev" <den@openvz.org>
Subject: Re: [Qemu-devel] [PATCH v4 00/46] Windbg supporting
Date: Thu, 14 Dec 2017 13:32:50 +0100	[thread overview]
Message-ID: <CABdb736PM6C4LTxg_-NdcWkcc6v1MxpMkp+2fmnxVBXf77picw@mail.gmail.com> (raw)
In-Reply-To: <151299847127.4808.14646046517426494416.stgit@Misha-PC.lan02.inno>

On Mon, Dec 11, 2017 at 2:21 PM, Mihail Abakumov
<mikhail.abakumov@ispras.ru> wrote:
> An update of:
>
>         v1: https://lists.nongnu.org/archive/html/qemu-devel/2017-09/msg07092.html
>
> 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.
>
> Changed in v4:
>
>  - Add WinDbg stub to the MAINTAINERS file.
>  - Increase size of the search buffer in 'kd_api_search_memory'. (Ladi Prosek)
>  - Add sub functions for helper_wrmsr and helper_rdmsr: cpu_x86_write_msr and
>    cpu_x86_read_msr. Also they are used in packet handlers, i.e. duplication of
>    code is removed. (Ladi Prosek)
>  - Add a more user-friendly error when try to use -windbg and -gdb at the same
>    time. (Ladi Prosek)
>  - Remove macros for SizedBuf. (Ladi Prosek)
>  - Add runtime assert to KD_API_NAME and KD_PKT_TYPE_NAME. (Ladi Prosek)
>  - Remove 'ifneq ($(TARGET_NAME), x86_64)' from the 'Makefile.target' file.
>    (Ladi Prosek)
>  - Remove incorrect macro UINT32_P. Replace it by bit shifts. (Ladi Prosek)
>
> Changed in v3:
>
>  - Add a support of the new api functions from the WinDbg v10.
>
> Changed in v2:
>
>  - Move target specific code in the 'target/' directory. (Alistair Francis)
>  - Change 'kd_api_fill_memory'. Made a fill of memory by line segments. Before
>    that, a full array was immediately collected and written in RAM. (Ladi Prosek)
>  - Change 'kd_api_search_memory'. Made a search for memory by line segments.
>    (Ladi Prosek)
>  - Change ld* to st* where it needs. (Ladi Prosek)
>  - Add a additional check of input arguments in 'windbg_read_context' and
>    'windbg_read_ks_regs'. (Ladi Prosek)
>  - Fix typos. (Ladi Prosek)
>  - Add a fliping back 'windbg_state->is_loaded' after reset VM.
>  - Add a check to disabled kvm. It is supported yet. (Ladi Prosek)
>  - Add a check to device in windbg option. Only pipe is supporting now.
>    (Alistair Francis)
>  - Add a check to 'ifdef' WINDBG_DEBUG_ON before define it. (Alistair Francis)
>  - Replace printf to qemu_log. (Alistair Francis)
>  - Fix build on s390x host. (patchew)
>  - Fix code style error. (patchew)
>
> ---
>
> Mihail Abakumov (46):
>       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: 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_write_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
>       windbg: added new api functions
>       windbg: implemented kd_api_get_context_ex and kd_api_set_context_ex
>       windbg: changed kd_api_read_msr and kd_api_write_msr
>       windbg: maintainers
>
>
>  MAINTAINERS                     |   12
>  Makefile.target                 |    5
>  cpus.c                          |   19 +
>  gdbstub.c                       |    4
>  include/exec/windbgkd.h         |  975 +++++++++++++++++++++++++++++++
>  include/exec/windbgstub-utils.h |  105 +++
>  include/exec/windbgstub.h       |   24 +
>  include/sysemu/sysemu.h         |    2
>  qemu-options.hx                 |    8
>  stubs/Makefile.objs             |    1
>  stubs/windbgstub.c              |   21 +
>  target/i386/Makefile.objs       |    2
>  target/i386/cpu.h               |    3
>  target/i386/misc_helper.c       |   48 +-
>  target/i386/windbgstub.c        | 1223 +++++++++++++++++++++++++++++++++++++++
>  vl.c                            |    8
>  windbgstub-utils.c              |  351 +++++++++++
>  windbgstub.c                    |  498 ++++++++++++++++
>  18 files changed, 3296 insertions(+), 13 deletions(-)
>  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 stubs/windbgstub.c
>  create mode 100755 target/i386/windbgstub.c
>  create mode 100755 windbgstub-utils.c
>  create mode 100755 windbgstub.c

Thank you. I have sent a small proposal as a reply to patch 5.

Regardless:

Acked-by: Ladi Prosek <lprosek@redhat.com>

This is a great work with many interesting uses. For instance, Windows
can't be kernel-debugged if secure boot is enabled. And "printf"
debugging is painful, too, as modern Windows requires that all kernel
code be signed by Microsoft.

Now you'll probably have to find somebody who'll do a thorough review
and merge the code.

Thanks again,
Ladi

  parent reply	other threads:[~2017-12-14 12:32 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11 13:21 [Qemu-devel] [PATCH v4 00/46] Windbg supporting Mihail Abakumov
2017-12-11 13:21 ` [Qemu-devel] [PATCH v4 01/46] windbg: added empty windbgstub files Mihail Abakumov
2018-01-12  8:46   ` Paolo Bonzini
2017-12-11 13:21 ` [Qemu-devel] [PATCH v4 02/46] windbg: added windbg's KD header file Mihail Abakumov
2017-12-11 13:21 ` [Qemu-devel] [PATCH v4 03/46] windbg: modified windbgkd.h Mihail Abakumov
2018-01-12  8:44   ` Paolo Bonzini
2017-12-11 13:21 ` [Qemu-devel] [PATCH v4 04/46] windbg: added '-windbg' option Mihail Abakumov
2017-12-11 13:21 ` [Qemu-devel] [PATCH v4 05/46] windbg: added helper features Mihail Abakumov
2017-12-14 12:13   ` Ladi Prosek
2017-12-11 13:21 ` [Qemu-devel] [PATCH v4 06/46] windbg: added WindbgState Mihail Abakumov
2017-12-11 13:21 ` [Qemu-devel] [PATCH v4 07/46] windbg: added chardev Mihail Abakumov
2017-12-11 13:22 ` [Qemu-devel] [PATCH v4 08/46] windbg: hook to wrmsr operation Mihail Abakumov
2017-12-11 13:22 ` [Qemu-devel] [PATCH v4 09/46] windbg: handler of fs/gs register Mihail Abakumov
2017-12-11 13:22 ` [Qemu-devel] [PATCH v4 10/46] windbg: structures for parsing data stream Mihail Abakumov
2017-12-11 13:22 ` [Qemu-devel] [PATCH v4 11/46] windbg: " Mihail Abakumov
2017-12-11 13:22 ` [Qemu-devel] [PATCH v4 12/46] windbg: send data and control packets Mihail Abakumov
2017-12-11 13:22 ` [Qemu-devel] [PATCH v4 13/46] windbg: handler of parsing context Mihail Abakumov
2017-12-11 13:22 ` [Qemu-devel] [PATCH v4 14/46] windbg: init DBGKD_ANY_WAIT_STATE_CHANGE Mihail Abakumov
2017-12-11 13:22 ` [Qemu-devel] [PATCH v4 15/46] windbg: generate ExceptionStateChange Mihail Abakumov
2017-12-11 13:22 ` [Qemu-devel] [PATCH v4 16/46] windbg: generate LoadSymbolsStateChange Mihail Abakumov
2017-12-11 13:22 ` [Qemu-devel] [PATCH v4 17/46] windbg: windbg_vm_stop Mihail Abakumov
2017-12-11 13:23 ` [Qemu-devel] [PATCH v4 18/46] windbg: implemented windbg_process_control_packet Mihail Abakumov
2017-12-11 13:23 ` [Qemu-devel] [PATCH v4 19/46] windbg: implemented windbg_process_data_packet Mihail Abakumov
2017-12-11 13:23 ` [Qemu-devel] [PATCH v4 20/46] windbg: implemented windbg_process_manipulate_packet Mihail Abakumov
2017-12-11 13:23 ` [Qemu-devel] [PATCH v4 21/46] windbg: implemented kd_api_read_virtual_memory and kd_api_write_virtual_memory Mihail Abakumov
2017-12-11 13:23 ` [Qemu-devel] [PATCH v4 22/46] windbg: kernel's structures Mihail Abakumov
2017-12-11 13:23 ` [Qemu-devel] [PATCH v4 23/46] windbg: implemented kd_api_get_context and kd_api_set_context Mihail Abakumov
2017-12-11 13:23 ` [Qemu-devel] [PATCH v4 24/46] windbg: implemented kd_api_read_control_space and kd_api_write_control_space Mihail Abakumov
2017-12-11 13:23 ` [Qemu-devel] [PATCH v4 25/46] windbg: implemented windbg_read_context Mihail Abakumov
2017-12-11 13:23 ` [Qemu-devel] [PATCH v4 26/46] windbg: implemented windbg_write_context Mihail Abakumov
2017-12-11 13:23 ` [Qemu-devel] [PATCH v4 27/46] windbg: implemented windbg_read_ks_regs Mihail Abakumov
2017-12-11 13:23 ` [Qemu-devel] [PATCH v4 28/46] windbg: implemented windbg_write_ks_regs Mihail Abakumov
2017-12-11 13:24 ` [Qemu-devel] [PATCH v4 29/46] windbg: implemented windbg_set_sr Mihail Abakumov
2017-12-11 13:24 ` [Qemu-devel] [PATCH v4 30/46] windbg: implemented windbg_set_dr Mihail Abakumov
2017-12-11 13:24 ` [Qemu-devel] [PATCH v4 31/46] windbg: implemented windbg_set_dr7 Mihail Abakumov
2017-12-11 13:24 ` [Qemu-devel] [PATCH v4 32/46] windbg: implemented windbg_hw_breakpoint_insert and windbg_hw_breakpoint_remove Mihail Abakumov
2017-12-11 13:24 ` [Qemu-devel] [PATCH v4 33/46] windbg: implemented kd_api_write_breakpoint and kd_api_restore_breakpoint Mihail Abakumov
2017-12-11 13:24 ` [Qemu-devel] [PATCH v4 34/46] windbg: debug exception subscribing Mihail Abakumov
2017-12-11 13:24 ` [Qemu-devel] [PATCH v4 35/46] windbg: implemented kd_api_continue Mihail Abakumov
2017-12-11 13:24 ` [Qemu-devel] [PATCH v4 36/46] windbg: implemented kd_api_read_io_space and kd_api_write_io_space Mihail Abakumov
2017-12-11 13:24 ` [Qemu-devel] [PATCH v4 37/46] windbg: implemented kd_api_read_physical_memory and kd_api_write_physical_memory Mihail Abakumov
2017-12-11 13:24 ` [Qemu-devel] [PATCH v4 38/46] windbg: implemented kd_api_get_version Mihail Abakumov
2017-12-11 13:25 ` [Qemu-devel] [PATCH v4 39/46] windbg: implemented kd_api_read_msr and kd_api_write_msr Mihail Abakumov
2017-12-11 13:25 ` [Qemu-devel] [PATCH v4 40/46] windbg: implemented kd_api_search_memory Mihail Abakumov
2017-12-11 13:25 ` [Qemu-devel] [PATCH v4 41/46] windbg: implemented kd_api_fill_memory Mihail Abakumov
2017-12-11 13:25 ` [Qemu-devel] [PATCH v4 42/46] windbg: implemented kd_api_query_memory Mihail Abakumov
2017-12-11 13:25 ` [Qemu-devel] [PATCH v4 43/46] windbg: added new api functions Mihail Abakumov
2018-01-12  8:53   ` Paolo Bonzini
2017-12-11 13:25 ` [Qemu-devel] [PATCH v4 44/46] windbg: implemented kd_api_get_context_ex and kd_api_set_context_ex Mihail Abakumov
2017-12-11 13:25 ` [Qemu-devel] [PATCH v4 45/46] windbg: changed kd_api_read_msr and kd_api_write_msr Mihail Abakumov
2018-01-12  8:48   ` Paolo Bonzini
2017-12-11 13:25 ` [Qemu-devel] [PATCH v4 46/46] windbg: maintainers Mihail Abakumov
2017-12-11 14:22 ` [Qemu-devel] [PATCH v4 00/46] Windbg supporting no-reply
2017-12-11 14:30 ` no-reply
2018-01-12  8:52   ` Paolo Bonzini
2017-12-14 12:32 ` Ladi Prosek [this message]
2017-12-22 13:21   ` Pavel Dovgalyuk
2017-12-22 14:00     ` Paolo Bonzini
2018-01-10  8:40       ` Pavel Dovgalyuk
2018-01-10 13:08         ` Paolo Bonzini
2018-01-10 13:19           ` Peter Maydell
2018-01-12  8:27 ` Paolo Bonzini
2018-01-15 10:58   ` Mihail Abakumov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABdb736PM6C4LTxg_-NdcWkcc6v1MxpMkp+2fmnxVBXf77picw@mail.gmail.com \
    --to=lprosek@redhat.com \
    --cc=den@openvz.org \
    --cc=dovgaluk@ispras.ru \
    --cc=mikhail.abakumov@ispras.ru \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rkagan@virtuozzo.com \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).