mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
Cary Xiao" <xiaowave@gmail.com>
- Add some code to complete breakpoint of gdbstub. See issue #1817 for more details. svn path=/trunk/; revision=38024
This commit is contained in:
parent
dd0e4d213f
commit
f611b44733
1 changed files with 25 additions and 0 deletions
|
@ -1011,6 +1011,7 @@ typedef struct _GSPSWBREAKPOINT
|
|||
#define MAX_SW_BREAKPOINTS 64
|
||||
static unsigned GspSwBreakpointCount = 0;
|
||||
static GSPSWBREAKPOINT GspSwBreakpoints[MAX_SW_BREAKPOINTS];
|
||||
static CHAR GspSwBreakpointsInstructions[MAX_SW_BREAKPOINTS];
|
||||
|
||||
static void
|
||||
GspSetHwBreakpoint(ULONG Type, ULONG_PTR Address, ULONG Length)
|
||||
|
@ -1096,9 +1097,23 @@ GspSetSwBreakpoint(ULONG_PTR Address)
|
|||
}
|
||||
else
|
||||
{
|
||||
unsigned Index;
|
||||
|
||||
for (Index = 0; Index < GspSwBreakpointCount; Index++)
|
||||
{
|
||||
if (GspSwBreakpoints[Index].Address == Address)
|
||||
{
|
||||
strcpy(GspOutBuffer, "E22");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
DPRINT("Stored at index %u\n", GspSwBreakpointCount);
|
||||
GspSwBreakpoints[GspSwBreakpointCount].Address = Address;
|
||||
GspSwBreakpoints[GspSwBreakpointCount].Active = FALSE;
|
||||
GspSwBreakpointsInstructions[GspSwBreakpointCount] =
|
||||
GspReadMemSafe((PCHAR )Address);
|
||||
GspWriteMemSafe((PCHAR )Address, 0xCC);
|
||||
GspSwBreakpointCount++;
|
||||
strcpy(GspOutBuffer, "OK");
|
||||
}
|
||||
|
@ -1116,12 +1131,19 @@ GspRemoveSwBreakpoint(ULONG_PTR Address)
|
|||
{
|
||||
DPRINT("Found match at index %u\n", Index);
|
||||
ASSERT(! GspSwBreakpoints[Index].Active);
|
||||
|
||||
GspWriteMemSafe((PCHAR )Address,
|
||||
GspSwBreakpointsInstructions[Index]);
|
||||
|
||||
if (Index + 1 < GspSwBreakpointCount)
|
||||
{
|
||||
memmove(GspSwBreakpoints + Index,
|
||||
GspSwBreakpoints + (Index + 1),
|
||||
(GspSwBreakpointCount - Index - 1) *
|
||||
sizeof(GSPSWBREAKPOINT));
|
||||
memmove(GspSwBreakpointsInstructions + Index,
|
||||
GspSwBreakpointsInstructions + (Index + 1),
|
||||
(GspSwBreakpointCount - Index - 1) * sizeof(CHAR));
|
||||
}
|
||||
GspSwBreakpointCount--;
|
||||
strcpy(GspOutBuffer, "OK");
|
||||
|
@ -1360,6 +1382,7 @@ KdpGdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
|
|||
*ptr = '\0';
|
||||
|
||||
GspPutPacket(&GspOutBuffer[0]);
|
||||
/* DPRINT("------- replied status: (%s) -------\n", GspOutBuffer); */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1373,6 +1396,7 @@ KdpGdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
|
|||
/* Zero the buffer now so we don't have to worry about the terminating zero character */
|
||||
memset(GspOutBuffer, 0, sizeof(GspInBuffer));
|
||||
ptr = GspGetPacket();
|
||||
/* DPRINT("------- Get (%s) command -------\n", ptr); */
|
||||
|
||||
switch(*ptr++)
|
||||
{
|
||||
|
@ -1643,6 +1667,7 @@ KdpGdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
|
|||
|
||||
/* reply to the request */
|
||||
GspPutPacket(GspOutBuffer);
|
||||
/* DPRINT("------- reply command (%s) -------\n", GspOutBuffer); */
|
||||
}
|
||||
|
||||
/* not reached */
|
||||
|
|
Loading…
Reference in a new issue