Commit graph

78 commits

Author SHA1 Message Date
Hervé Poussineau 76a41370d0 [NTOS:KD] Move dump of stack trace on crash to debugger
Release builds now show again the bugcheck screen, instead of freezing.
2020-03-30 15:23:34 +02:00
Hervé Poussineau 8b6e441a6e [NTOS:KD] Fix compilation with CMAKE_BUILD_TYPE=Release
This was broken by commit a890fc64d1
2020-03-30 15:23:25 +02:00
Dmitry Borisov 222e79232c
[CPORTLIB][NTOS:INBV][KDCOM][FREELDR] Add ComPort library for NEC PC-98 series (#2407)
There are 2 known serial ports:
    COM1 - based on Intel 8251A
    COM2 - National Semiconductor 16550
2020-03-06 19:50:31 +01:00
Hermès Bélusca-Maïto d32e96d602
This was not meant to be committed!
This reverts commit 5e14dbd648.
2019-12-26 17:19:11 +01:00
Hermès Bélusca-Maïto 5e14dbd648
WIP kdbg work. 2019-12-26 13:53:50 +01:00
Hermès Bélusca-Maïto 548393c6e7
[NTOS:KD/KD64] Fix x64 build. 2019-11-18 01:36:04 +01:00
Hermès Bélusca-Maïto a890fc64d1
[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().
2019-11-17 23:21:54 +01:00
Hermès Bélusca-Maïto 9537653ee7
[NTOS:KD/KDBG] Code enhancements for KDBG/KD.
- Introduce KdpScreenAcquire() / KdpScreenRelease() helpers that allow
  to correctly acquire or release the screen when using INBV for
  "Screen-Mode" debugging.

- Introduce KdpAcquireLock() / KdpReleaseLock() helpers so as to reduce
  the copy-pasted code required when acquiring spin-locks in the KD debug
  logger functions.

- Close the opened KdpLogFileHandle file in the KdpInitDebugLog() logger
  in case we failed to create the logger writer thread.
  Also use explicit kernel-mode handle when opening the log file.

- static-ify some local variables, remove few hardcoded values, and
  minor formatting.

- Correctly define the INIT_FUNCTION's.
2019-11-17 23:21:50 +01:00
Hermès Bélusca-Maïto aff644a1a2
[NTOS:KD][KDBG] Get rid of kdmemsup.c as its functionality has been superseded by that implemented in mm/arm3/mmdbg.c.
- Import KdpCopyMemoryChunks() from kd64/kdapi.c, and re-implement
  KdbpSafeReadMemory() and KdbpSafeWriteMemory() around it.
  Note that these functions read virtual memory and are equivalent of
  the kd64 KdpReadVirtualMemory() and KdpWriteVirtualMemory()
  respectively.

- Get rid of the KdpEnableSafeMem() call in KdInitSystem().
- Adjust kd gdbstub.c wrapper in accordance.
2019-11-03 23:46:52 +01:00
Hermès Bélusca-Maïto 954f7c0660
[NTOS:KD] Check for valid LoaderBlock and LoaderBlock->LoadOptions pointers when calling KdInitSystem() in BootPhase == 0. 2019-11-03 05:08:33 +01:00
Hermès Bélusca-Maïto ef5f034974
[NTOS:KD] Whitespace fixes + fix helper function name. 2019-11-03 05:07:32 +01:00
Hervé Poussineau f7ec84eea0 [NTOS:KD] Remove some _WINDK_ usages
- Always include kd64.h
- Change KdpPrompt() prototype to be compatible between KDBG and _WINDK_
- Rename KdComponentTable to KdpComponentTable to prevent a conflict
- Add some functions stubs and global variables
2019-05-23 11:04:40 +02:00
Hervé Poussineau f5e962ff2e [NTOS:KD] Remove dead code 2019-05-23 11:04:40 +02:00
Hervé Poussineau 95d5b39b57 [NTOS:KD] Remove CTRL+C pending support left over, likely broken by 5a6adb4f13 2019-05-23 11:04:40 +02:00
Hervé Poussineau f6cec6d5cb [NTOS:KD] Remove /BREAK support left over, likely broken by 819a0ed90a 2019-05-23 11:04:40 +02:00
Serge Gautherie a06b425839 [NTOS:KD] A few trivial code improvements 2018-10-12 08:43:02 +02:00
Serge Gautherie 561a10056b [NTOS:KD] Remove an unreachable "break;"
On behalf of Kudratov Olimjon.
CORE-8545
2018-10-12 08:43:02 +02:00
Serge Gautherie 9ff9bd81c4 [NTOSKRNL] Round memory size up, "debug log" part
Assumed to better match actual physical RAM size.

CORE-12321
2018-08-07 20:36:04 +02:00
Katayama Hirofumi MZ a8bd06be98
[NTOS:KDBG] Fix DPRINT format specifier in KdPortInitializeEx. CORE-14174 2018-01-04 11:37:50 +01:00
Thomas Faber 7e8de26164
[NTOS:KD] Pass PreviousMode down to KdpPrintString, since ExGetPreviousMode is not accurate. CORE-14103 2017-12-14 11:46:18 +01:00
Thomas Faber 7b95fcf93d
[NTOS:KD] Avoid _alloca inside SEH, as it's apparently incompatible with PSEH. CORE-14103 2017-12-14 11:46:16 +01:00
Thomas Faber a07b569b25
[NTOS:KD] Don't assume null termination in KdpSerialDebugPrint and KdpScreenPrint. CORE-14057 CORE-14103 2017-12-14 11:46:14 +01:00
Thomas Faber 68ebcf16b8 [NTOS:KD] Protect against invalid user arguments for BREAKPOINT_LOAD_SYMBOLS. CORE-14057 2017-12-10 15:26:18 +01:00
Thomas Faber 34ccecbce8 [NTOS:KD] Protect against invalid user arguments in KdpPrintString. CORE-14057 2017-12-10 15:26:18 +01:00
Thomas Faber 1a38c76266 [NTOS:KD] Protect against invalid user arguments in KdpPrompt. CORE-14057 2017-12-10 15:26:18 +01:00
Colin Finck a7d388c350 [KD] [KD64] Introduce KdpPrintBanner and use it in all places where we print the (now consistent) banner instead of copying the code over and over again.
I still don't like that we're copying code between KD and KD64 instead of sharing it.
But as both modules are totally distinct at the moment, I won't be the one introducing shared functions between them.

This is a follow up to 50ae5e7c52, which TortoiseGit accidentally turned into a "Message only" commit...
Never hit ALT+Y by mistake! ;)
2017-10-16 11:47:14 +02:00
Colin Finck 2cf30244cf [KD] Output the long commit hash as well at the start of the debug log.
This will be used by Testman.
Previously, it had to translate the short hash from the build number to a long hash, but such a database (GitInfo) only exists for commits in the master branch.
2017-10-16 10:38:12 +02:00
Colin Finck c2c66aff7d Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00