Eric Pouech : dbghelp: Implement SymFromInlineContext for inlined frames.
Alexandre Julliard
julliard at winehq.org
Thu Oct 28 16:07:45 CDT 2021
Module: wine
Branch: master
Commit: eee701ad52b31b3484734c8c259e628475ce9842
URL: https://source.winehq.org/git/wine.git/?a=commit;h=eee701ad52b31b3484734c8c259e628475ce9842
Author: Eric Pouech <eric.pouech at gmail.com>
Date: Thu Oct 28 08:58:31 2021 +0200
dbghelp: Implement SymFromInlineContext for inlined frames.
Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dbghelp/dbghelp_private.h | 3 +++
dlls/dbghelp/symbol.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h
index 014e793b6a1..7a0f089877e 100644
--- a/dlls/dbghelp/dbghelp_private.h
+++ b/dlls/dbghelp/dbghelp_private.h
@@ -927,6 +927,9 @@ static inline struct symt_function*
inlined = (struct symt_inlinesite*)symt_get_upper_inlined(inlined);
return &inlined->func;
}
+extern struct symt_inlinesite*
+ 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):
diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c
index 5dd989b5489..503432e461f 100644
--- a/dlls/dbghelp/symbol.c
+++ b/dlls/dbghelp/symbol.c
@@ -1250,6 +1250,24 @@ struct symt* symt_get_upper_inlined(struct symt_inlinesite* inlined)
return symt;
}
+/* lookup in module for an inline site (from addr and inline_ctx) */
+struct symt_inlinesite* symt_find_inlined_site(struct module* module, DWORD64 addr, DWORD inline_ctx)
+{
+ struct symt_ht* symt = symt_find_nearest(module, addr);
+
+ if (symt_check_tag(&symt->symt, SymTagFunction))
+ {
+ struct symt_function* func = (struct symt_function*)symt;
+ struct symt_inlinesite* curr = symt_find_lowest_inlined(func, addr);
+ DWORD depth = IFC_DEPTH(inline_ctx);
+
+ if (curr)
+ for ( ; &curr->func != func; curr = (struct symt_inlinesite*)symt_get_upper_inlined(curr))
+ if (depth-- == 0) return curr;
+ }
+ return NULL;
+}
+
DWORD symt_get_inlinesite_depth(HANDLE hProcess, DWORD64 addr)
{
struct module_pair pair;
@@ -2626,6 +2644,9 @@ PWSTR WINAPI SymSetHomeDirectoryW(HANDLE hProcess, PCWSTR dir)
*/
BOOL WINAPI SymFromInlineContext(HANDLE hProcess, DWORD64 addr, ULONG inline_ctx, PDWORD64 disp, PSYMBOL_INFO si)
{
+ struct module_pair pair;
+ struct symt_inlinesite* inlined;
+
TRACE("(%p, %#I64x, 0x%x, %p, %p)\n", hProcess, addr, inline_ctx, disp, si);
switch (IFC_MODE(inline_ctx))
@@ -2634,6 +2655,15 @@ BOOL WINAPI SymFromInlineContext(HANDLE hProcess, DWORD64 addr, ULONG inline_ctx
case IFC_MODE_REGULAR:
return SymFromAddr(hProcess, addr, disp, si);
case IFC_MODE_INLINE:
+ if (!module_init_pair(&pair, hProcess, addr)) return FALSE;
+ inlined = symt_find_inlined_site(pair.effective, addr, inline_ctx);
+ if (inlined)
+ {
+ symt_fill_sym_info(&pair, NULL, &inlined->func.symt, si);
+ *disp = addr - inlined->func.address;
+ return TRUE;
+ }
+ /* fall through */
default:
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
More information about the wine-cvs
mailing list