Commit f127448d authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Implement RtlWalkFrameChain on x86-64.

parent 6d8b4e66
......@@ -958,6 +958,36 @@ __ASM_GLOBAL_FUNC( RtlRaiseException,
"call " __ASM_NAME("RtlRaiseStatus") /* does not return */ );
/*************************************************************************
* RtlWalkFrameChain (NTDLL.@)
*/
ULONG WINAPI RtlWalkFrameChain( void **buffer, ULONG count, ULONG flags )
{
UNWIND_HISTORY_TABLE table;
RUNTIME_FUNCTION *func;
PEXCEPTION_ROUTINE handler;
ULONG_PTR frame, base;
CONTEXT context;
void *data;
ULONG i, skip = flags >> 8, num_entries = 0;
RtlCaptureContext( &context );
for (i = 0; i < count; i++)
{
func = RtlLookupFunctionEntry( context.Rip, &base, &table );
if (RtlVirtualUnwind2( UNW_FLAG_NHANDLER, base, context.Rip, func, &context, NULL,
&data, &frame, NULL, NULL, NULL, &handler, 0 ))
break;
if (!context.Rip) break;
if (!frame || !is_valid_frame( frame )) break;
if (context.Rsp == (ULONG_PTR)NtCurrentTeb()->Tib.StackBase) break;
if (i >= skip) buffer[num_entries++] = (void *)context.Rip;
}
return num_entries;
}
static inline ULONG hash_pointers( void **ptrs, ULONG count )
{
/* Based on MurmurHash2, which is in the public domain */
......
......@@ -28,6 +28,7 @@ NTSYSAPI void WINAPI RtlRaiseException(EXCEPTION_RECORD*);
NTSYSAPI void CDECL RtlRestoreContext(CONTEXT*,EXCEPTION_RECORD*);
NTSYSAPI void WINAPI RtlUnwind(void*,void*,EXCEPTION_RECORD*,void*);
NTSYSAPI void* WINAPI RtlPcToFileHeader(void*,void**);
NTSYSAPI ULONG WINAPI RtlWalkFrameChain(void**,ULONG,ULONG);
#ifndef __i386__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment