Author: jgardou
Date: Fri Aug 26 21:07:27 2016
New Revision: 72467
URL:
http://svn.reactos.org/svn/reactos?rev=72467&view=rev
Log:
[KDGDB]
- Add a ugly and grotesque hack to give "o" back to RtlAssert so that we
actually break on ASSERTs
- Check for the breakpoint instruction for deciding when to move forward the
ProgramCounter. This is OK since KD removes all breakpoints set when hitting a soft BP
Modified:
trunk/reactos/drivers/base/kdgdb/gdb_input.c
trunk/reactos/drivers/base/kdgdb/kdgdb.h
trunk/reactos/drivers/base/kdgdb/kdpacket.c
Modified: trunk/reactos/drivers/base/kdgdb/gdb_input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kdgdb/gdb_inp…
==============================================================================
--- trunk/reactos/drivers/base/kdgdb/gdb_input.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/kdgdb/gdb_input.c [iso-8859-1] Fri Aug 26 21:07:27 2016
@@ -830,7 +830,7 @@
/* See if we should update the program counter */
if (Exception && (Exception->ExceptionRecord.ExceptionCode ==
STATUS_BREAKPOINT)
- && ProgramCounter ==
KdDebuggerDataBlock->BreakpointWithStatus.Pointer)
+ && ((*(KD_BREAKPOINT_TYPE*)ProgramCounter) ==
KD_BREAKPOINT_VALUE))
{
/* We must get past the breakpoint instruction */
KdpSetContextPc(&CurrentContext, ProgramCounter + KD_BREAKPOINT_SIZE);
Modified: trunk/reactos/drivers/base/kdgdb/kdgdb.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kdgdb/kdgdb.h…
==============================================================================
--- trunk/reactos/drivers/base/kdgdb/kdgdb.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/kdgdb/kdgdb.h [iso-8859-1] Fri Aug 26 21:07:27 2016
@@ -121,7 +121,9 @@
((Context)->Eip)
# define KdpSetContextPc(Context, ProgramCounter) \
((Context)->Eip = (ProgramCounter))
+# define KD_BREAKPOINT_TYPE UCHAR
# define KD_BREAKPOINT_SIZE sizeof(UCHAR)
+# define KD_BREAKPOINT_VALUE 0xCC
/* Single step mode */
# define KdpSetSingleStep(Context) \
((Context)->EFlags |= EFLAGS_TF)
Modified: trunk/reactos/drivers/base/kdgdb/kdpacket.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kdgdb/kdpacke…
==============================================================================
--- trunk/reactos/drivers/base/kdgdb/kdpacket.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/kdgdb/kdpacket.c [iso-8859-1] Fri Aug 26 21:07:27 2016
@@ -183,6 +183,7 @@
switch (DebugIO->ApiNumber)
{
case DbgKdPrintStringApi:
+ case DbgKdGetStringApi:
gdb_send_debug_io(String, TRUE);
break;
default:
@@ -362,28 +363,34 @@
_Out_ PULONG DataLength,
_Inout_ PKD_CONTEXT KdContext)
{
- DBGKD_MANIPULATE_STATE64* State;
-
- /* Special handling for breakin packet */
if (PacketType == PACKET_TYPE_KD_POLL_BREAKIN)
{
return KdpPollBreakIn();
}
- if (PacketType != PACKET_TYPE_KD_STATE_MANIPULATE)
- {
- /* What should we do ? */
- while (1);
- }
-
- State = (DBGKD_MANIPULATE_STATE64*)MessageHeader->Buffer;
-
- /* Maybe we are in a send<->receive loop that GDB doesn't need to know
about */
- if (KdpManipulateStateHandler != NULL)
- return KdpManipulateStateHandler(State, MessageData, DataLength, KdContext);
-
- /* Receive data from GDB and interpret it */
- return gdb_receive_and_interpret_packet(State, MessageData, DataLength, KdContext);
+ if (PacketType == PACKET_TYPE_KD_DEBUG_IO)
+ {
+ /* HACK ! RtlAssert asks for (boipt), always say "o" --> break once.
*/
+ MessageData->Length = 1;
+ MessageData->Buffer[0] = 'o';
+ return KdPacketReceived;
+ }
+
+ if (PacketType == PACKET_TYPE_KD_STATE_MANIPULATE)
+ {
+ DBGKD_MANIPULATE_STATE64* State =
(DBGKD_MANIPULATE_STATE64*)MessageHeader->Buffer;
+
+ /* Maybe we are in a send<->receive loop that GDB doesn't need to know
about */
+ if (KdpManipulateStateHandler != NULL)
+ return KdpManipulateStateHandler(State, MessageData, DataLength, KdContext);
+
+ /* Receive data from GDB and interpret it */
+ return gdb_receive_and_interpret_packet(State, MessageData, DataLength,
KdContext);
+ }
+
+ /* What should we do ? */
+ while (1);
+ return KdPacketNeedsResend;
}
VOID