fix stack dumps from printing an infinite amount of <0> in some cases
[reactos.git] / reactos / ntoskrnl / ke / i386 / exp.c
index 0ddff89..85544a4 100644 (file)
@@ -124,7 +124,7 @@ static NTSTATUS ExceptionToNtStatus[] =
 
 /* FUNCTIONS ****************************************************************/
 
-#ifdef KDBG
+#if defined(DBG) || defined(KDBG)
 BOOLEAN STDCALL
 KeRosPrintAddress(PVOID address)
 {
@@ -632,10 +632,11 @@ KeDumpStackFrames(PULONG Frame)
        DbgPrint("Frames: ");
        while ( MmIsAddressValid(Frame) )
        {
-               if (!KeRosPrintAddress((PVOID)Frame[1]))
-               {
-                       DbgPrint("<%X>", (PVOID)Frame[1]);
-               }
+               ULONG Addr = Frame[1];
+               if (!KeRosPrintAddress((PVOID)Addr))
+                       DbgPrint("<%X>", Addr);
+               if ( Addr == 0 || Addr == 0xDEADBEEF )
+                       break;
                Frame = (PULONG)Frame[0];
                DbgPrint(" ");
        }
@@ -659,14 +660,11 @@ KeRosDumpStackFrames ( PULONG Frame, ULONG FrameCount )
        }
        while ( MmIsAddressValid(Frame) && i++ < FrameCount )
        {
-               if (!KeRosPrintAddress((PVOID)Frame[1]))
-               {
-                       DbgPrint("<%X>", (PVOID)Frame[1]);
-               }
-               if (Frame[1] == 0xdeadbeef)
-               {
-                   break;
-               }
+               ULONG Addr = Frame[1];
+               if (!KeRosPrintAddress((PVOID)Addr))
+                       DbgPrint("<%X>", Addr);
+               if ( Addr == 0 || Addr == 0xDEADBEEF )
+                       break;
                Frame = (PULONG)Frame[0];
                DbgPrint(" ");
        }