Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/tests/dbghelp.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/dlls/dbghelp/tests/dbghelp.c b/dlls/dbghelp/tests/dbghelp.c index 4e8907ac26b..be3418b9ff5 100644 --- a/dlls/dbghelp/tests/dbghelp.c +++ b/dlls/dbghelp/tests/dbghelp.c @@ -40,6 +40,8 @@ struct debuggee */ };
+extern DWORD stack_walk_bottom(void); + #if defined(__i386__) || defined(__x86_64__)
static DWORD CALLBACK stack_walk_thread(void *arg) @@ -56,7 +58,7 @@ static void test_stack_walk(const struct debuggee* dbg) STACKFRAME64 frame = {{0}}, frame0; BOOL found_our_frame = FALSE; DWORD machine; - DWORD64 disp; + DWORD64 disp, stack_walk_thread_addr; CONTEXT ctx; BOOL ret;
@@ -102,24 +104,31 @@ static void test_stack_walk(const struct debuggee* dbg) ok(frame.AddrReturn.Offset && frame.AddrReturn.Offset != frame.AddrPC.Offset, "got bad return address %s\n", wine_dbgstr_longlong(frame.AddrReturn.Offset));
+ if (dbg->external_process) + { + si->SizeOfStruct = sizeof(*si); + si->MaxNameLen = 200; + ret = SymFromName(dbg->hProcess, "stack_walk_bottom", si); + ok(ret, "SymFromName failed\n"); + stack_walk_thread_addr = si->Address; + } + else + stack_walk_thread_addr = (DWORD_PTR)&stack_walk_thread; while (frame.AddrReturn.Offset) { - char *addr; - ret = StackWalk64(machine, dbg->hProcess, dbg->hThread, &frame, &ctx, NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL); ok(ret, "StackWalk64() failed: %u\n", GetLastError());
- addr = (void *)(DWORD_PTR)frame.AddrPC.Offset; - - if (!found_our_frame && addr > (char *)stack_walk_thread && addr < (char *)stack_walk_thread + 0x100) + if (!found_our_frame && frame.AddrPC.Offset > stack_walk_thread_addr && frame.AddrPC.Offset < stack_walk_thread_addr + 0x100) { found_our_frame = TRUE;
si->SizeOfStruct = sizeof(SYMBOL_INFO); si->MaxNameLen = 200; if (SymFromAddr(dbg->hProcess, frame.AddrPC.Offset, &disp, si)) - ok(!strcmp(si->Name, "stack_walk_thread"), "got wrong name %s\n", si->Name); + ok(dbg->external_process ? !strcmp(si->Name, "stack_walk_bottom") : !strcmp(si->Name, "stack_walk_thread"), + "got wrong name %s\n", si->Name); } }