Commit 10a20b2d authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Relax some failure conditions in SymSetContext and SymSetScopeFromAddr.

They shouldn't fail if passed address is inside a module, even if it doesn't point to a function. Signed-off-by: 's avatarEric Pouech <eric.pouech@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 25d2c954
...@@ -607,18 +607,14 @@ BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame, ...@@ -607,18 +607,14 @@ BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame,
PIMAGEHLP_CONTEXT Context) PIMAGEHLP_CONTEXT Context)
{ {
struct process* pcs; struct process* pcs;
BOOL same;
if (!(pcs = process_find_by_handle(hProcess))) return FALSE; TRACE("(%p %p %p)\n", hProcess, StackFrame, Context);
same = pcs->ctx_frame.ReturnOffset == StackFrame->ReturnOffset &&
pcs->ctx_frame.FrameOffset == StackFrame->FrameOffset &&
pcs->ctx_frame.StackOffset == StackFrame->StackOffset;
if (!SymSetScopeFromAddr(hProcess, StackFrame->InstructionOffset))
return FALSE;
pcs->ctx_frame = *StackFrame; if (!(pcs = process_find_by_handle(hProcess))) return FALSE;
if (same) if (pcs->ctx_frame.ReturnOffset == StackFrame->ReturnOffset &&
pcs->ctx_frame.FrameOffset == StackFrame->FrameOffset &&
pcs->ctx_frame.StackOffset == StackFrame->StackOffset &&
pcs->ctx_frame.InstructionOffset == StackFrame->InstructionOffset)
{ {
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,
...@@ -628,7 +624,11 @@ BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame, ...@@ -628,7 +624,11 @@ BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame,
return FALSE; return FALSE;
} }
if (!SymSetScopeFromAddr(hProcess, StackFrame->InstructionOffset))
return FALSE;
pcs->ctx_frame = *StackFrame;
/* Context is not (no longer?) used */ /* Context is not (no longer?) used */
return TRUE; return TRUE;
} }
...@@ -643,11 +643,11 @@ BOOL WINAPI SymSetScopeFromAddr(HANDLE hProcess, ULONG64 addr) ...@@ -643,11 +643,11 @@ BOOL WINAPI SymSetScopeFromAddr(HANDLE hProcess, ULONG64 addr)
TRACE("(%p %#I64x)\n", hProcess, addr); TRACE("(%p %#I64x)\n", hProcess, addr);
if (!module_init_pair(&pair, hProcess, addr)) return FALSE; 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_pc = addr;
pair.pcs->localscope_symt = &sym->symt; if ((sym = symt_find_nearest(pair.effective, addr)) != NULL && sym->symt.tag == SymTagFunction)
pair.pcs->localscope_symt = &sym->symt;
else
pair.pcs->localscope_symt = NULL;
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