Author: tkreuzer
Date: Mon Nov 17 18:39:39 2008
New Revision: 37428
URL:
http://svn.reactos.org/svn/reactos?rev=37428&view=rev
Log:
RtlWalkFrameChain:
- stop when we leave the stack or Rip gets 0
Modified:
branches/ros-amd64-bringup/reactos/lib/rtl/amd64/unwind.c
Modified: branches/ros-amd64-bringup/reactos/lib/rtl/amd64/unwind.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/r…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/rtl/amd64/unwind.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/lib/rtl/amd64/unwind.c [iso-8859-1] Mon Nov 17
18:39:39 2008
@@ -336,11 +336,14 @@
PVOID HandlerData;
INT i;
PRUNTIME_FUNCTION FunctionEntry;
-DPRINT1("RtlWalkFrameChain called\n");
+
+ DPRINT("Enter RtlWalkFrameChain\n");
+
+ /* Capture the current Context */
RtlCaptureContext(&Context);
-
ControlPc = Context.Rip;
+ /* Get the stack limits */
RtlpGetStackLimits(&StackLow, &StackHigh);
/* Check if we want the user-mode stack frame */
@@ -374,13 +377,24 @@
DPRINT("normal funtion, new Rip = %p, new Rsp = %p\n",
(PVOID)Context.Rip, (PVOID)Context.Rsp);
}
+ /* Check if new Rip is valid */
+ if (!Context.Rip)
+ {
+ break;
+ }
+
+ /* Check, if we have left our stack */
+ if ((Context.Rsp < StackLow) || (Context.Rsp > StackHigh))
+ {
+ break;
+ }
+
+ /* Save this frame and continue with new Rip */
ControlPc = Context.Rip;
- /* Save this frame */
-
Callers[i] = (PVOID)ControlPc;
-
- }
-
+ }
+
+ DPRINT("RtlWalkFrameChain returns %ld\n", i);
return i;
}