mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[KDGDB] Support "int 0x2c" for x86 & amd64 targets
This commit is contained in:
parent
e278b59d3a
commit
6e0d8de013
1 changed files with 16 additions and 31 deletions
|
@ -914,8 +914,8 @@ handle_gdb_c(
|
||||||
ULONG_PTR ProgramCounter = KdpGetContextPc(&CurrentContext);
|
ULONG_PTR ProgramCounter = KdpGetContextPc(&CurrentContext);
|
||||||
|
|
||||||
/* See if we should update the program counter */
|
/* See if we should update the program counter */
|
||||||
if (Exception && (Exception->ExceptionRecord.ExceptionCode == STATUS_BREAKPOINT)
|
if ((Exception->ExceptionRecord.ExceptionCode == STATUS_BREAKPOINT)
|
||||||
&& ((*(KD_BREAKPOINT_TYPE*)ProgramCounter) == KD_BREAKPOINT_VALUE))
|
&& ((*(KD_BREAKPOINT_TYPE*)ProgramCounter) == KD_BREAKPOINT_VALUE))
|
||||||
{
|
{
|
||||||
/* We must get past the breakpoint instruction */
|
/* We must get past the breakpoint instruction */
|
||||||
KdpSetContextPc(&CurrentContext, ProgramCounter + KD_BREAKPOINT_SIZE);
|
KdpSetContextPc(&CurrentContext, ProgramCounter + KD_BREAKPOINT_SIZE);
|
||||||
|
@ -924,37 +924,24 @@ handle_gdb_c(
|
||||||
KdpManipulateStateHandler = ContinueManipulateStateHandler;
|
KdpManipulateStateHandler = ContinueManipulateStateHandler;
|
||||||
return KdPacketReceived;
|
return KdPacketReceived;
|
||||||
}
|
}
|
||||||
|
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||||
|
if ((Exception->ExceptionRecord.ExceptionCode == STATUS_ASSERTION_FAILURE)
|
||||||
|
&& ((*(KD_BREAKPOINT_TYPE*)ProgramCounter) == 0xCD)
|
||||||
|
&& (*((KD_BREAKPOINT_TYPE*)ProgramCounter + 1) == 0x2C))
|
||||||
|
{
|
||||||
|
/* INT 2C (a.k.a. runtime check failure) */
|
||||||
|
KdpSetContextPc(&CurrentContext, ProgramCounter + 2);
|
||||||
|
|
||||||
|
SetContextManipulateHandler(State, MessageData, MessageLength, KdContext);
|
||||||
|
KdpManipulateStateHandler = ContinueManipulateStateHandler;
|
||||||
|
return KdPacketReceived;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return ContinueManipulateStateHandler(State, MessageData, MessageLength, KdContext);
|
return ContinueManipulateStateHandler(State, MessageData, MessageLength, KdContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
|
||||||
KDSTATUS
|
|
||||||
handle_gdb_C(
|
|
||||||
_Out_ DBGKD_MANIPULATE_STATE64* State,
|
|
||||||
_Out_ PSTRING MessageData,
|
|
||||||
_Out_ PULONG MessageLength,
|
|
||||||
_Inout_ PKD_CONTEXT KdContext)
|
|
||||||
{
|
|
||||||
KDSTATUS Status;
|
|
||||||
|
|
||||||
/* Tell GDB everything is fine, we will handle it */
|
|
||||||
Status = send_gdb_packet("OK");
|
|
||||||
if (Status != KdPacketReceived)
|
|
||||||
return Status;
|
|
||||||
|
|
||||||
if (CurrentStateChange.NewState == DbgKdExceptionStateChange)
|
|
||||||
{
|
|
||||||
/* Debugger didn't handle the exception, report it back to the kernel */
|
|
||||||
State->u.Continue2.ContinueStatus = CurrentStateChange.u.Exception.ExceptionRecord.ExceptionCode;
|
|
||||||
State->ApiNumber = DbgKdContinueApi2;
|
|
||||||
return KdPacketReceived;
|
|
||||||
}
|
|
||||||
/* We should never reach this ? */
|
|
||||||
return ContinueManipulateStateHandler(State, MessageData, MessageLength, KdContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
static
|
||||||
KDSTATUS
|
KDSTATUS
|
||||||
handle_gdb_s(
|
handle_gdb_s(
|
||||||
|
@ -1033,10 +1020,8 @@ gdb_receive_and_interpret_packet(
|
||||||
Status = LOOP_IF_SUCCESS(send_gdb_packet("OK"));
|
Status = LOOP_IF_SUCCESS(send_gdb_packet("OK"));
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
Status = handle_gdb_c(State, MessageData, MessageLength, KdContext);
|
|
||||||
break;
|
|
||||||
case 'C':
|
case 'C':
|
||||||
Status = handle_gdb_C(State, MessageData, MessageLength, KdContext);
|
Status = handle_gdb_c(State, MessageData, MessageLength, KdContext);
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
Status = LOOP_IF_SUCCESS(gdb_send_registers());
|
Status = LOOP_IF_SUCCESS(gdb_send_registers());
|
||||||
|
|
Loading…
Reference in a new issue