Alexandre Julliard : ntdll: Implemented RtlCaptureStackBackTrace for i386.

Alexandre Julliard julliard at winehq.org
Thu Nov 12 10:22:07 CST 2009


Module: wine
Branch: master
Commit: d90f691e58ccf3deed6bd4a45bcae350bb7587ce
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d90f691e58ccf3deed6bd4a45bcae350bb7587ce

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Nov 11 17:38:18 2009 +0100

ntdll: Implemented RtlCaptureStackBackTrace for i386.

---

 dlls/ntdll/signal_i386.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index 18a574d..79e3806 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -2285,8 +2285,30 @@ DEFINE_REGS_ENTRYPOINT( RtlRaiseException, 1 )
  */
 USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, ULONG *hash )
 {
-    FIXME( "(%d, %d, %p, %p) stub!\n", skip, count, buffer, hash );
-    return 0;
+    CONTEXT context;
+    ULONG i;
+    ULONG *frame;
+
+    RtlCaptureContext( &context );
+    if (hash) *hash = 0;
+    frame = (ULONG *)context.Ebp;
+
+    while (skip--)
+    {
+        if (((void *)frame < NtCurrentTeb()->Tib.StackLimit) ||
+            ((void *)(frame + 1) >= NtCurrentTeb()->Tib.StackBase)) return 0;
+        frame = (ULONG *)*frame;
+    }
+
+    for (i = 0; i < count; i++)
+    {
+        if (((void *)frame < NtCurrentTeb()->Tib.StackLimit) ||
+            ((void *)(frame + 1) >= NtCurrentTeb()->Tib.StackBase)) break;
+        buffer[i] = (void *)frame[1];
+        if (hash) *hash += frame[1];
+        frame = (ULONG *)*frame;
+    }
+    return i;
 }
 
 




More information about the wine-cvs mailing list