From f57567e347fcf0a51631a89b91f4df01efe3b8e0 Mon Sep 17 00:00:00 2001 From: Casper Hornstrup Date: Sun, 10 Feb 2002 20:21:40 +0000 Subject: [PATCH] Capture debug prints in PICE. Break into PICE on control+d. svn path=/trunk/; revision=2620 --- reactos/apps/utils/pice/module/output.c | 35 +++++++++++++++---------- reactos/apps/utils/pice/module/patch.c | 2 +- reactos/apps/utils/pice/module/shell.c | 6 ++++- reactos/apps/utils/pice/module/utils.c | 3 ++- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/reactos/apps/utils/pice/module/output.c b/reactos/apps/utils/pice/module/output.c index 836fa747c10..60ed8303971 100644 --- a/reactos/apps/utils/pice/module/output.c +++ b/reactos/apps/utils/pice/module/output.c @@ -136,8 +136,17 @@ ULONG CountArgs(LPSTR fmt) //*********************************************************************************** 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")); + AddToRingBuffer(String->Buffer); + restore_flags(ulRingBufferLock); } //************************************************************************* // PrintkCallback() @@ -151,11 +160,11 @@ void PrintkCallback(void) ULONG ulAddress; ULONG countArgs,i,len; PANSI_STRING temp; + CHAR buf[128]; - DPRINT((0,"In PrintkCallback:1\n")); + DPRINT((0,"In PrintkCallback\n")); bInPrintk = TRUE; - DPRINT((0,"In PrintkCallback:2\n")); // get the linear address of stack where string resides ulAddress = GetLinearAddress(CurrentSS,CurrentESP); @@ -166,12 +175,9 @@ void PrintkCallback(void) { //KdpPrintString has PANSI_STRING as a parameter temp = (PANSI_STRING)*(PULONG)(ulAddress+sizeof(char *)); - DPRINT((0,"temp: %x\n", temp)); - fmt = temp->Buffer; - - Print(OUTPUT_WINDOW,fmt); - DPRINT((0,"%s\n", fmt)); - CurrentEIP = (ULONG)PICE_KdpPrintString; + DPRINT((0,"PrintkCallback: %s\n", temp->Buffer)); + /* Call our version of KdpPrintString() */ + CurrentEIP = (ULONG_PTR)PICE_KdpPrintString; } } bInPrintk = FALSE; @@ -251,16 +257,17 @@ void InstallPrintkHook(void) if( bIsPrintkPatched ) return; - DPRINT((0,"installing PrintString hook\n")); + DPRINT((0,"installing PrintString hook\n")); ScanExports("_KdpPrintString",(PULONG)&ulPrintk); DPRINT((0,"_KdpPrintString @ %x\n", ulPrintk)); ASSERT( ulPrintk ); // temporary if(ulPrintk) { - bIsPrintkPatched = InstallSWBreakpoint(ulPrintk,TRUE,PrintkCallback); - DPRINT((0,"KdpPrintStringTest breakpoint installed? %d\n", bIsPrintkPatched)); + bIsPrintkPatched = InstallSWBreakpoint(ulPrintk,TRUE,PrintkCallback); + DPRINT((0,"KdpPrintStringTest breakpoint installed? %d\n", bIsPrintkPatched)); } + LEAVE_FUNC(); } @@ -276,8 +283,8 @@ void DeInstallPrintkHook(void) if(bIsPrintkPatched && ulPrintk) { // will be done on exit debugger - if( DeInstallSWBreakpoint(ulPrintk) ) - bIsPrintkPatched = FALSE; + if (DeInstallSWBreakpoint(ulPrintk)) + bIsPrintkPatched = FALSE; } LEAVE_FUNC(); } diff --git a/reactos/apps/utils/pice/module/patch.c b/reactos/apps/utils/pice/module/patch.c index 2d0bb776847..12e5f8f0a06 100644 --- a/reactos/apps/utils/pice/module/patch.c +++ b/reactos/apps/utils/pice/module/patch.c @@ -52,7 +52,7 @@ static ULONG ulKeyPatchFlags; void (*old_handle_scancode)(UCHAR,int); 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 diff --git a/reactos/apps/utils/pice/module/shell.c b/reactos/apps/utils/pice/module/shell.c index 6d0d36b84fa..b59c256f047 100644 --- a/reactos/apps/utils/pice/module/shell.c +++ b/reactos/apps/utils/pice/module/shell.c @@ -1015,6 +1015,8 @@ void DebuggerShell(void) //************************************************************************* void RealIsr(ULONG dwReasonForBreak) { + BOOLEAN ReinstallPermanentBp = FALSE; + DPRINT((0,"reason: %u#################################################################\n", dwReasonForBreak)); ENTER_FUNC(); @@ -1231,6 +1233,8 @@ void RealIsr(ULONG dwReasonForBreak) { DPRINT((0,"permanent breakpoint\n")); + ReinstallPermanentBp = TRUE; + OldCS = CurrentCS; OldEIP = CurrentEIP; @@ -1433,7 +1437,7 @@ void RealIsr(ULONG dwReasonForBreak) } // 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")); // remember how we restarted last time diff --git a/reactos/apps/utils/pice/module/utils.c b/reactos/apps/utils/pice/module/utils.c index 9d4c9534801..a9bd006710c 100644 --- a/reactos/apps/utils/pice/module/utils.c +++ b/reactos/apps/utils/pice/module/utils.c @@ -117,6 +117,7 @@ SCANTOASCII ucShiftScanToAscii_US[]= {0,0} }; + SCANTOASCII ucScanToAscii_DK[]= { // Danish keyboard @@ -129,7 +130,7 @@ SCANTOASCII ucScanToAscii_DK[]= {49,'n'},{50,'m'},{2,'1'},{3,'2'}, {4,'3'},{5,'4'},{6,'5'},{7,'6'}, {8,'7'},{9,'8'},{10,'9'},{11,'0'},{12,'+'}, - {0x39,' '},{0x35,'_'},{0x34,'.'},{0x1b,'¨'}, + {0x39,' '},{0x35,'-'},{0x34,'.'},{0x1b,'¨'}, {0x1a,'å'},{0x33,','},{0x27,'æ'},{0x0d,'´'}, {0x2b,'\''},{0x28,'ø'},{0x29,' '}, {0,0}