From 219e4b6e75618e9e2d1dc399d71544c4fb4f0035 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Tue, 26 Oct 2021 11:45:20 +0200 Subject: [PATCH] dbghelp: Implement SymFromInlineContext() when context isn't in inline mode. Signed-off-by: Eric Pouech Signed-off-by: Alexandre Julliard --- dlls/dbghelp/dbghelp_private.h | 21 +++++++++++++++++++++ dlls/dbghelp/symbol.c | 15 ++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 2ebe6699a1d..6217701a457 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -845,3 +845,24 @@ extern struct symt_pointer* extern struct symt_typedef* symt_new_typedef(struct module* module, struct symt* ref, const char* name) DECLSPEC_HIDDEN; + +/* Inline context encoding (different from what native does): + * bits 31:30: 3 ignore (includes INLINE_FRAME_CONTEXT_IGNORE=0xFFFFFFFF) + * 2 regular frame + * 1 frame with inlined function(s). + * 0 init (includes INLINE_FRAME_CONTEXT_INIT=0) + * so either stackwalkex is called with: + * - inlinectx=IGNORE, and we use (old) StackWalk64 behavior: + * - inlinectx=INIT, and StackWalkEx will upon return swing back&forth between: + * INLINE when the frame is from an inline site (inside a function) + * REGULAR when the frame is for a function without inline site + * bits 29:00 depth of inline site (way too big!!) + * 0 being the lowest inline site + */ +#define IFC_MODE_IGNORE 0xC0000000 +#define IFC_MODE_REGULAR 0x80000000 +#define IFC_MODE_INLINE 0x40000000 +#define IFC_MODE_INIT 0x00000000 +#define IFC_DEPTH_MASK 0x3FFFFFFF +#define IFC_MODE(x) ((x) & ~IFC_DEPTH_MASK) +#define IFC_DEPTH(x) ((x) & IFC_DEPTH_MASK) diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index 19374999070..21616627af9 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -2497,9 +2497,18 @@ PWSTR WINAPI SymSetHomeDirectoryW(HANDLE hProcess, PCWSTR dir) */ BOOL WINAPI SymFromInlineContext(HANDLE hProcess, DWORD64 addr, ULONG inline_ctx, PDWORD64 disp, PSYMBOL_INFO si) { - FIXME("(%p, %#I64x, 0x%x, %p, %p): stub\n", hProcess, addr, inline_ctx, disp, si); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + TRACE("(%p, %#I64x, 0x%x, %p, %p)\n", hProcess, addr, inline_ctx, disp, si); + + switch (IFC_MODE(inline_ctx)) + { + case IFC_MODE_IGNORE: + case IFC_MODE_REGULAR: + return SymFromAddr(hProcess, addr, disp, si); + case IFC_MODE_INLINE: + default: + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } } /****************************************************************** -- 2.11.4.GIT