This serie implements SymAddrIncludeInlineTrace() and partially SymQueryInlineTrace().
It includes and supersedes MR!1395.
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Football Manager 2023 Editor calls this function.
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- dlls/dbghelp/dbghelp.spec | 2 +- dlls/dbghelp/symbol.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/dbghelp/dbghelp.spec b/dlls/dbghelp/dbghelp.spec index 754fb456611..336a6f7aefd 100644 --- a/dlls/dbghelp/dbghelp.spec +++ b/dlls/dbghelp/dbghelp.spec @@ -38,7 +38,7 @@ @ stub SymAddSourceStreamW @ stdcall SymAddSymbol(ptr int64 str int64 long long) @ stdcall SymAddSymbolW(ptr int64 wstr int64 long long) -@ stub SymAddrIncludeInlineTrace +@ stdcall SymAddrIncludeInlineTrace(long int64) @ stdcall SymCleanup(long) @ stub SymCompareInlineTrace @ stub SymDeleteSymbol diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index c82b5b3d4ef..226f473e485 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -2787,6 +2787,16 @@ BOOL WINAPI SymGetLineFromInlineContextW(HANDLE hProcess, DWORD64 addr, ULONG in return internal_line_copy_toW64(&intl, line); }
+/****************************************************************** + * SymAddrIncludeInlineTrace (DBGHELP.@) + * + */ +DWORD WINAPI SymAddrIncludeInlineTrace(HANDLE hProcess, DWORD64 addr) +{ + FIXME("(%p, %I64x): stub\n", hProcess, addr); + return 0; +} + /****************************************************************** * SymSrvGetFileIndexInfo (DBGHELP.@) *
From: Eric Pouech eric.pouech@gmail.com
Replacing symt_get_inlinesite_depth() with SymAddrIncludeInlineTrace() as they look very (very) similar.
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- dlls/dbghelp/dbghelp_private.h | 1 - dlls/dbghelp/stack.c | 4 +-- dlls/dbghelp/symbol.c | 47 +++++++++++++++++----------------- 3 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 22e9eec8805..177032d0ff4 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -953,7 +953,6 @@ static inline struct symt_function* extern struct symt_function* symt_find_inlined_site(struct module* module, DWORD64 addr, DWORD inline_ctx) DECLSPEC_HIDDEN; -extern DWORD symt_get_inlinesite_depth(HANDLE hProcess, DWORD64 addr) DECLSPEC_HIDDEN;
/* Inline context encoding (different from what native does): * bits 31:30: 3 ignore (includes INLINE_FRAME_CONTEXT_IGNORE=0xFFFFFFFF) diff --git a/dlls/dbghelp/stack.c b/dlls/dbghelp/stack.c index 97bd885dcc7..8b573feee77 100644 --- a/dlls/dbghelp/stack.c +++ b/dlls/dbghelp/stack.c @@ -312,7 +312,7 @@ BOOL WINAPI StackWalkEx(DWORD MachineType, HANDLE hProcess, HANDLE hThread,
if (IFC_MODE(frame->InlineFrameContext) == IFC_MODE_INLINE) { - DWORD depth = symt_get_inlinesite_depth(hProcess, addr); + DWORD depth = SymAddrIncludeInlineTrace(hProcess, addr); if (IFC_DEPTH(frame->InlineFrameContext) + 1 < depth) /* move to next inlined function? */ { TRACE("found inline ctx: depth=%lu current=%lu++\n", @@ -330,7 +330,7 @@ BOOL WINAPI StackWalkEx(DWORD MachineType, HANDLE hProcess, HANDLE hThread, if (frame->InlineFrameContext != INLINE_FRAME_CONTEXT_IGNORE) { addr = sw_xlat_addr(&csw, &frame->AddrPC); - frame->InlineFrameContext = symt_get_inlinesite_depth(hProcess, addr) == 0 ? IFC_MODE_REGULAR : IFC_MODE_INLINE; + frame->InlineFrameContext = SymAddrIncludeInlineTrace(hProcess, addr) == 0 ? IFC_MODE_REGULAR : IFC_MODE_INLINE; TRACE("setting IFC mode to %lx\n", frame->InlineFrameContext); } } diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index 226f473e485..1c57f9beec2 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -1258,27 +1258,6 @@ struct symt_function* symt_find_inlined_site(struct module* module, DWORD64 addr return NULL; }
-DWORD symt_get_inlinesite_depth(HANDLE hProcess, DWORD64 addr) -{ - struct module_pair pair; - DWORD depth = 0; - - if (module_init_pair(&pair, hProcess, addr)) - { - struct symt_ht* symt = symt_find_symbol_at(pair.effective, addr); - if (symt_check_tag(&symt->symt, SymTagFunction)) - { - struct symt_function* inlined = symt_find_lowest_inlined((struct symt_function*)symt, addr); - if (inlined) - { - for ( ; &inlined->symt != &symt->symt; inlined = (struct symt_function*)symt_get_upper_inlined(inlined)) - ++depth; - } - } - } - return depth; -} - /****************************************************************** * sym_enum * @@ -2788,13 +2767,33 @@ BOOL WINAPI SymGetLineFromInlineContextW(HANDLE hProcess, DWORD64 addr, ULONG in }
/****************************************************************** - * SymAddrIncludeInlineTrace (DBGHELP.@) + * SymAddrIncludeInlineTrace (DBGHELP.@) * + * MSDN doesn't state that the maximum depth (of embedded inline sites) at <addr> + * is actually returned. (It just says non zero means that there are some inline site(s)). + * But this is what native actually returns. */ DWORD WINAPI SymAddrIncludeInlineTrace(HANDLE hProcess, DWORD64 addr) { - FIXME("(%p, %I64x): stub\n", hProcess, addr); - return 0; + struct module_pair pair; + DWORD depth = 0; + + TRACE("(%p, %#I64x)\n", hProcess, addr); + + if (module_init_pair(&pair, hProcess, addr)) + { + struct symt_ht* symt = symt_find_symbol_at(pair.effective, addr); + if (symt_check_tag(&symt->symt, SymTagFunction)) + { + struct symt_function* inlined = symt_find_lowest_inlined((struct symt_function*)symt, addr); + if (inlined) + { + for ( ; &inlined->symt != &symt->symt; inlined = (struct symt_function*)symt_get_upper_inlined(inlined)) + ++depth; + } + } + } + return depth; }
/******************************************************************
From: Eric Pouech eric.pouech@gmail.com
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- dlls/dbghelp/dbghelp.spec | 2 +- dlls/dbghelp/symbol.c | 49 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/dlls/dbghelp/dbghelp.spec b/dlls/dbghelp/dbghelp.spec index 336a6f7aefd..fc2218f636b 100644 --- a/dlls/dbghelp/dbghelp.spec +++ b/dlls/dbghelp/dbghelp.spec @@ -153,7 +153,7 @@ @ stub SymNextW @ stub SymPrev @ stub SymPrevW -@ stub SymQueryInlineTrace +@ stdcall SymQueryInlineTrace(long int64 long int64 int64 ptr ptr) @ stdcall SymRefreshModuleList(long) @ stdcall SymRegisterCallback(long ptr ptr) @ stdcall SymRegisterCallback64(long ptr int64) diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index 1c57f9beec2..b508ebe66eb 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -2796,6 +2796,55 @@ DWORD WINAPI SymAddrIncludeInlineTrace(HANDLE hProcess, DWORD64 addr) return depth; }
+/****************************************************************** + * SymQueryInlineTrace (DBGHELP.@) + * + */ +BOOL WINAPI SymQueryInlineTrace(HANDLE hProcess, DWORD64 StartAddress, DWORD StartContext, + DWORD64 StartRetAddress, DWORD64 CurAddress, + LPDWORD CurContext, LPDWORD CurFrameIndex) +{ + struct module_pair pair; + struct symt_ht* sym_curr; + struct symt_ht* sym_start; + struct symt_ht* sym_startret; + DWORD depth; + + TRACE("(%p, %#I64x, 0x%lx, %#I64x, %I64x, %p, %p)\n", + hProcess, StartAddress, StartContext, StartRetAddress, CurAddress, CurContext, CurFrameIndex); + + if (!module_init_pair(&pair, hProcess, CurAddress)) return FALSE; + if (!(sym_curr = symt_find_symbol_at(pair.effective, CurAddress))) return FALSE; + if (!symt_check_tag(&sym_curr->symt, SymTagFunction)) return FALSE; + + sym_start = symt_find_symbol_at(pair.effective, StartAddress); + sym_startret = symt_find_symbol_at(pair.effective, StartRetAddress); + if (sym_start != sym_curr && sym_startret != sym_curr) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + if (sym_start != sym_curr || StartContext) + { + FIXME("(%p, %#I64x, 0x%lx, %#I64x, %I64x, %p, %p): semi-stub\n", + hProcess, StartAddress, StartContext, StartRetAddress, CurAddress, CurContext, CurFrameIndex); + return ERROR_CALL_NOT_IMPLEMENTED; + } + + depth = SymAddrIncludeInlineTrace(hProcess, CurAddress); + if (depth) + { + *CurContext = IFC_MODE_INLINE; /* deepest inline site */ + *CurFrameIndex = depth; + } + else + { + *CurContext = IFC_MODE_REGULAR; + *CurFrameIndex = 0; + } + return TRUE; +} + /****************************************************************** * SymSrvGetFileIndexInfo (DBGHELP.@) *
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=126357
Your paranoid android.
=== debian11 (32 bit report) ===
d3d9: stateblock: Timeout visual: Timeout
d3dcompiler_43: asm: Timeout blob: Timeout hlsl_d3d11: Timeout hlsl_d3d9: Timeout reflection: Timeout
d3dcompiler_46: asm: Timeout blob: Timeout hlsl_d3d11: Timeout hlsl_d3d9: Timeout reflection: Timeout
d3dcompiler_47: asm: Timeout blob: Timeout hlsl_d3d11: Timeout hlsl_d3d9: Timeout reflection: Timeout
d3drm: d3drm: Timeout vector: Timeout
d3dx10_34: d3dx10: Timeout
d3dx10_35: d3dx10: Timeout
Report validation errors: d3dx10: Timeout
=== debian11 (build log) ===
WineRunWineTest.pl:error: The task timed out
This merge request was approved by eric pouech.