Eric Pouech : dbghelp: Implement SymFromInlineContext() when context isn't in inline mode.

Alexandre Julliard julliard at winehq.org
Wed Oct 27 16:26:04 CDT 2021


Module: wine
Branch: master
Commit: 219e4b6e75618e9e2d1dc399d71544c4fb4f0035
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=219e4b6e75618e9e2d1dc399d71544c4fb4f0035

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Tue Oct 26 11:45:20 2021 +0200

dbghelp: Implement SymFromInlineContext() when context isn't in inline mode.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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;
+    }
 }
 
 /******************************************************************




More information about the wine-cvs mailing list