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; }