mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Capture debug prints in PICE.
Break into PICE on control+d. svn path=/trunk/; revision=2620
This commit is contained in:
parent
7a5ecf6515
commit
f57567e347
4 changed files with 29 additions and 17 deletions
|
@ -136,8 +136,17 @@ ULONG CountArgs(LPSTR fmt)
|
||||||
//***********************************************************************************
|
//***********************************************************************************
|
||||||
ULONG PICE_KdpPrintString(PANSI_STRING String)
|
ULONG PICE_KdpPrintString(PANSI_STRING String)
|
||||||
{
|
{
|
||||||
//dummy function
|
ULONG ulRingBufferLock;
|
||||||
|
|
||||||
|
save_flags(ulRingBufferLock);
|
||||||
|
cli();
|
||||||
|
|
||||||
|
/* CH: What is bIsDebugPrint used for? */
|
||||||
|
bIsDebugPrint = FALSE;
|
||||||
|
|
||||||
DPRINT((0,"PICE_KdpPrintString\n\n\n"));
|
DPRINT((0,"PICE_KdpPrintString\n\n\n"));
|
||||||
|
AddToRingBuffer(String->Buffer);
|
||||||
|
restore_flags(ulRingBufferLock);
|
||||||
}
|
}
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// PrintkCallback()
|
// PrintkCallback()
|
||||||
|
@ -151,11 +160,11 @@ void PrintkCallback(void)
|
||||||
ULONG ulAddress;
|
ULONG ulAddress;
|
||||||
ULONG countArgs,i,len;
|
ULONG countArgs,i,len;
|
||||||
PANSI_STRING temp;
|
PANSI_STRING temp;
|
||||||
|
CHAR buf[128];
|
||||||
|
|
||||||
DPRINT((0,"In PrintkCallback:1\n"));
|
DPRINT((0,"In PrintkCallback\n"));
|
||||||
|
|
||||||
bInPrintk = TRUE;
|
bInPrintk = TRUE;
|
||||||
DPRINT((0,"In PrintkCallback:2\n"));
|
|
||||||
|
|
||||||
// get the linear address of stack where string resides
|
// get the linear address of stack where string resides
|
||||||
ulAddress = GetLinearAddress(CurrentSS,CurrentESP);
|
ulAddress = GetLinearAddress(CurrentSS,CurrentESP);
|
||||||
|
@ -166,12 +175,9 @@ void PrintkCallback(void)
|
||||||
{
|
{
|
||||||
//KdpPrintString has PANSI_STRING as a parameter
|
//KdpPrintString has PANSI_STRING as a parameter
|
||||||
temp = (PANSI_STRING)*(PULONG)(ulAddress+sizeof(char *));
|
temp = (PANSI_STRING)*(PULONG)(ulAddress+sizeof(char *));
|
||||||
DPRINT((0,"temp: %x\n", temp));
|
DPRINT((0,"PrintkCallback: %s\n", temp->Buffer));
|
||||||
fmt = temp->Buffer;
|
/* Call our version of KdpPrintString() */
|
||||||
|
CurrentEIP = (ULONG_PTR)PICE_KdpPrintString;
|
||||||
Print(OUTPUT_WINDOW,fmt);
|
|
||||||
DPRINT((0,"%s\n", fmt));
|
|
||||||
CurrentEIP = (ULONG)PICE_KdpPrintString;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bInPrintk = FALSE;
|
bInPrintk = FALSE;
|
||||||
|
@ -251,16 +257,17 @@ void InstallPrintkHook(void)
|
||||||
if( bIsPrintkPatched )
|
if( bIsPrintkPatched )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DPRINT((0,"installing PrintString hook\n"));
|
DPRINT((0,"installing PrintString hook\n"));
|
||||||
ScanExports("_KdpPrintString",(PULONG)&ulPrintk);
|
ScanExports("_KdpPrintString",(PULONG)&ulPrintk);
|
||||||
|
|
||||||
DPRINT((0,"_KdpPrintString @ %x\n", ulPrintk));
|
DPRINT((0,"_KdpPrintString @ %x\n", ulPrintk));
|
||||||
ASSERT( ulPrintk ); // temporary
|
ASSERT( ulPrintk ); // temporary
|
||||||
if(ulPrintk)
|
if(ulPrintk)
|
||||||
{
|
{
|
||||||
bIsPrintkPatched = InstallSWBreakpoint(ulPrintk,TRUE,PrintkCallback);
|
bIsPrintkPatched = InstallSWBreakpoint(ulPrintk,TRUE,PrintkCallback);
|
||||||
DPRINT((0,"KdpPrintStringTest breakpoint installed? %d\n", bIsPrintkPatched));
|
DPRINT((0,"KdpPrintStringTest breakpoint installed? %d\n", bIsPrintkPatched));
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE_FUNC();
|
LEAVE_FUNC();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,8 +283,8 @@ void DeInstallPrintkHook(void)
|
||||||
if(bIsPrintkPatched && ulPrintk)
|
if(bIsPrintkPatched && ulPrintk)
|
||||||
{
|
{
|
||||||
// will be done on exit debugger
|
// will be done on exit debugger
|
||||||
if( DeInstallSWBreakpoint(ulPrintk) )
|
if (DeInstallSWBreakpoint(ulPrintk))
|
||||||
bIsPrintkPatched = FALSE;
|
bIsPrintkPatched = FALSE;
|
||||||
}
|
}
|
||||||
LEAVE_FUNC();
|
LEAVE_FUNC();
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ static ULONG ulKeyPatchFlags;
|
||||||
|
|
||||||
void (*old_handle_scancode)(UCHAR,int);
|
void (*old_handle_scancode)(UCHAR,int);
|
||||||
char tempPatch[256];
|
char tempPatch[256];
|
||||||
UCHAR ucBreakKey = 'D'; // key that will break into debugger in combination with CTRL
|
UCHAR ucBreakKey = 'd'; // key that will break into debugger in combination with CTRL
|
||||||
|
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
// FUNCTIONS
|
// FUNCTIONS
|
||||||
|
|
|
@ -1015,6 +1015,8 @@ void DebuggerShell(void)
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
void RealIsr(ULONG dwReasonForBreak)
|
void RealIsr(ULONG dwReasonForBreak)
|
||||||
{
|
{
|
||||||
|
BOOLEAN ReinstallPermanentBp = FALSE;
|
||||||
|
|
||||||
DPRINT((0,"reason: %u#################################################################\n", dwReasonForBreak));
|
DPRINT((0,"reason: %u#################################################################\n", dwReasonForBreak));
|
||||||
ENTER_FUNC();
|
ENTER_FUNC();
|
||||||
|
|
||||||
|
@ -1231,6 +1233,8 @@ void RealIsr(ULONG dwReasonForBreak)
|
||||||
{
|
{
|
||||||
DPRINT((0,"permanent breakpoint\n"));
|
DPRINT((0,"permanent breakpoint\n"));
|
||||||
|
|
||||||
|
ReinstallPermanentBp = TRUE;
|
||||||
|
|
||||||
OldCS = CurrentCS;
|
OldCS = CurrentCS;
|
||||||
OldEIP = CurrentEIP;
|
OldEIP = CurrentEIP;
|
||||||
|
|
||||||
|
@ -1433,7 +1437,7 @@ void RealIsr(ULONG dwReasonForBreak)
|
||||||
}
|
}
|
||||||
|
|
||||||
// if there was a SW breakpoint at CS:EIP
|
// if there was a SW breakpoint at CS:EIP
|
||||||
if(NeedToReInstallSWBreakpoints(GetLinearAddress(CurrentCS,CurrentEIP),TRUE))
|
if(NeedToReInstallSWBreakpoints(GetLinearAddress(CurrentCS,CurrentEIP),TRUE) || ReinstallPermanentBp)
|
||||||
{
|
{
|
||||||
DPRINT((0,"need to reinstall INT3\n"));
|
DPRINT((0,"need to reinstall INT3\n"));
|
||||||
// remember how we restarted last time
|
// remember how we restarted last time
|
||||||
|
|
|
@ -117,6 +117,7 @@ SCANTOASCII ucShiftScanToAscii_US[]=
|
||||||
{0,0}
|
{0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SCANTOASCII ucScanToAscii_DK[]=
|
SCANTOASCII ucScanToAscii_DK[]=
|
||||||
{
|
{
|
||||||
// Danish keyboard
|
// Danish keyboard
|
||||||
|
@ -129,7 +130,7 @@ SCANTOASCII ucScanToAscii_DK[]=
|
||||||
{49,'n'},{50,'m'},{2,'1'},{3,'2'},
|
{49,'n'},{50,'m'},{2,'1'},{3,'2'},
|
||||||
{4,'3'},{5,'4'},{6,'5'},{7,'6'},
|
{4,'3'},{5,'4'},{6,'5'},{7,'6'},
|
||||||
{8,'7'},{9,'8'},{10,'9'},{11,'0'},{12,'+'},
|
{8,'7'},{9,'8'},{10,'9'},{11,'0'},{12,'+'},
|
||||||
{0x39,' '},{0x35,'_'},{0x34,'.'},{0x1b,'ィ'},
|
{0x39,' '},{0x35,'-'},{0x34,'.'},{0x1b,'ィ'},
|
||||||
{0x1a,'å'},{0x33,','},{0x27,'æ'},{0x0d,'´'},
|
{0x1a,'å'},{0x33,','},{0x27,'æ'},{0x0d,'´'},
|
||||||
{0x2b,'\''},{0x28,'ø'},{0x29,' '},
|
{0x2b,'\''},{0x28,'ø'},{0x29,' '},
|
||||||
{0,0}
|
{0,0}
|
||||||
|
|
Loading…
Reference in a new issue