Commit 706c5400 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Rewrite SymSetContext() on top of SymSetScopeFromAddr().

parent 925182b0
...@@ -607,34 +607,27 @@ BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame, ...@@ -607,34 +607,27 @@ BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame,
PIMAGEHLP_CONTEXT Context) PIMAGEHLP_CONTEXT Context)
{ {
struct process* pcs; struct process* pcs;
struct module_pair pair; BOOL same;
struct symt_ht* sym;
pair.pcs = pcs = process_find_by_handle(hProcess); if (!(pcs = process_find_by_handle(hProcess))) return FALSE;
if (!pcs) return FALSE; same = pcs->ctx_frame.ReturnOffset == StackFrame->ReturnOffset &&
pcs->ctx_frame.FrameOffset == StackFrame->FrameOffset &&
pcs->ctx_frame.StackOffset == StackFrame->StackOffset;
pair.requested = module_find_by_addr(pair.pcs, StackFrame->InstructionOffset, DMT_UNKNOWN); if (!SymSetScopeFromAddr(hProcess, StackFrame->InstructionOffset))
if (!module_get_debug(&pair)) return FALSE;
return FALSE; return FALSE;
if ((sym = symt_find_nearest(pair.effective, StackFrame->InstructionOffset)) == NULL) return FALSE;
if (sym->symt.tag != SymTagFunction) return FALSE;
pcs->localscope_pc = StackFrame->InstructionOffset;
pcs->localscope_symt = &sym->symt;
if (pcs->ctx_frame.ReturnOffset == StackFrame->ReturnOffset && pcs->ctx_frame = *StackFrame;
pcs->ctx_frame.FrameOffset == StackFrame->FrameOffset && if (same)
pcs->ctx_frame.StackOffset == StackFrame->StackOffset)
{ {
TRACE("Setting same frame {rtn=%I64x frm=%I64x stk=%I64x}\n", TRACE("Setting same frame {rtn=%I64x frm=%I64x stk=%I64x}\n",
pcs->ctx_frame.ReturnOffset, pcs->ctx_frame.ReturnOffset,
pcs->ctx_frame.FrameOffset, pcs->ctx_frame.FrameOffset,
pcs->ctx_frame.StackOffset); pcs->ctx_frame.StackOffset);
pcs->ctx_frame.InstructionOffset = StackFrame->InstructionOffset;
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
return FALSE; return FALSE;
} }
pcs->ctx_frame = *StackFrame;
/* Context is not (no longer?) used */ /* Context is not (no longer?) used */
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment