Eric Pouech : dbghelp: Implement SymSetScopeFromAddr() and SymSetScopeFromIndex().

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


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

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

dbghelp: Implement SymSetScopeFromAddr() and SymSetScopeFromIndex().

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

---

 dlls/dbghelp/dbghelp.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/dlls/dbghelp/dbghelp.c b/dlls/dbghelp/dbghelp.c
index 64ceb447ee9..81a43327708 100644
--- a/dlls/dbghelp/dbghelp.c
+++ b/dlls/dbghelp/dbghelp.c
@@ -644,11 +644,18 @@ BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame,
  */
 BOOL WINAPI SymSetScopeFromAddr(HANDLE hProcess, ULONG64 addr)
 {
-    struct process*     pcs;
+    struct module_pair pair;
+    struct symt_ht* sym;
 
-    FIXME("(%p %#I64x): stub\n", hProcess, addr);
+    TRACE("(%p %#I64x)\n", hProcess, addr);
+
+    if (!module_init_pair(&pair, hProcess, addr)) return FALSE;
+    if ((sym = symt_find_nearest(pair.effective, addr)) == NULL) return FALSE;
+    if (sym->symt.tag != SymTagFunction) return FALSE;
+
+    pair.pcs->localscope_pc = addr;
+    pair.pcs->localscope_symt = &sym->symt;
 
-    if (!(pcs = process_find_by_handle(hProcess))) return FALSE;
     return TRUE;
 }
 
@@ -657,11 +664,18 @@ BOOL WINAPI SymSetScopeFromAddr(HANDLE hProcess, ULONG64 addr)
  */
 BOOL WINAPI SymSetScopeFromIndex(HANDLE hProcess, ULONG64 addr, DWORD index)
 {
-    struct process*     pcs;
+    struct module_pair pair;
+    struct symt* sym;
 
-    FIXME("(%p %#I64x %u): stub\n", hProcess, addr, index);
+    TRACE("(%p %#I64x %u)\n", hProcess, addr, index);
+
+    if (!module_init_pair(&pair, hProcess, addr)) return FALSE;
+    sym = symt_index2ptr(pair.effective, index);
+    if (!symt_check_tag(sym, SymTagFunction)) return FALSE;
+
+    pair.pcs->localscope_pc = ((struct symt_function*)sym)->address; /* FIXME of FuncDebugStart when it exists? */
+    pair.pcs->localscope_symt = sym;
 
-    if (!(pcs = process_find_by_handle(hProcess))) return FALSE;
     return TRUE;
 }
 




More information about the wine-cvs mailing list