[NTOS:KD/KD64/KDBG] Share some code between our legacy KD/KDBG and KD64.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 17 Nov 2019 21:55:36 +0000 (22:55 +0100)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 17 Nov 2019 22:21:54 +0000 (23:21 +0100)
commita890fc64d17e7c4a09a3cbe24e0dfc972d743dda
tree0fa745c441ddb2e34ac9b08bbfe2b823254ccf84
parent54c03f6965ec8fdca52aca75c3baed6e959fb07b
[NTOS:KD/KD64/KDBG] Share some code between our legacy KD/KDBG and KD64.

Our legacy KD module is slowly being phased out for the more recent KD64
Kernel Debugger that supports WinDbg, but at the same time we must retain
support for GCC debugging and the KDBG interface.

For the time being few #ifdef _WINKD_ have been introduced in KD64 so that
some of its code/data does not completely get shared yet with the legacy KD,
until the latter becomes phased out.

KD Modifications:
=================
- Remove the implementation of NtQueryDebugFilterState() /
  NtSetDebugFilterState() that now comes entirely from KD64.

- Remove KD variables that are now shared with KD64.

- Share common code with KD64: KdpMoveMemory(), KdpZeroMemory(),
  KdpCopyMemoryChunks(), KdpPrint(), KdpPrompt().

- KDBG: Remove the duplicated KdpCopyMemoryChunks() function.

- In KdpServiceDispatcher() and KdpEnterDebuggerException(), call the
  KdpPrint() worker function that correctly probes and captures its arguments.

- Temporarily stub out KdEnterDebugger() and KdExitDebugger() that is used
  by the shared code, until KD is removed and only the KD64 version of these
  functions remain.

- Re-implement the KD/KDBG KdpPrompt() function using a custom KdpPromptString()
  helper compatible with KD64, that is called by the KD64 implementation of
  KdpPrompt(). This KdpPromptString() helper now issues the prompt on all
  the KD loggers: e.g. if you use both at the same time COM-port and SCREEN
  debugging, the prompt will appear on both. Before that the prompt was always
  being displayed on COM port even if e.g. a SCREEN-only debug session was used...

- ppc_irq.c: Fix the prototype of KdpServiceDispatcher().

KD64 Fixes:
===========
- Initialize the MaximumLength member of the counted STRING variables
  before using them elsewhere.

- Get rid of alloca() within SEH block in KdpPrint() (addendum to 7b95fcf9).

- Add the ROS-specific handy dump commands in KdSystemDebugControl().
ntoskrnl/include/internal/kd.h
ntoskrnl/kd/kdio.c
ntoskrnl/kd/kdmain.c
ntoskrnl/kd64/kdapi.c
ntoskrnl/kd64/kddata.c
ntoskrnl/kd64/kdprint.c
ntoskrnl/kdbg/kdb.c
ntoskrnl/kdbg/kdb_cli.c
ntoskrnl/ke/powerpc/ppc_irq.c
ntoskrnl/ntos.cmake