mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-27 18:33:50 +02:00
FpDebug: Win, Only read ThreadState once per thread.
git-svn-id: trunk@63775 -
This commit is contained in:
parent
ddd10328bd
commit
f2959d4c98
@ -1660,46 +1660,33 @@ begin
|
||||
if FThreadContextChanged then
|
||||
begin
|
||||
Assert(FCurrentContext <> nil, 'TDbgWinThread.BeforeContinue: none existing context was changed');
|
||||
if SetFpThreadContext(FCurrentContext) then
|
||||
FThreadContextChanged:=false;
|
||||
if not SetFpThreadContext(FCurrentContext) then
|
||||
debugln(['Failed to SetFpThreadContext()']);
|
||||
end;
|
||||
FThreadContextChanged := False;
|
||||
FCurrentContext := nil;
|
||||
end;
|
||||
|
||||
function TDbgWinThread.ResetInstructionPointerAfterBreakpoint: boolean;
|
||||
var
|
||||
_UC: TFpContext;
|
||||
Context: PFpContext;
|
||||
begin
|
||||
Result := False;
|
||||
assert(MDebugEvent.Exception.ExceptionRecord.ExceptionCode <> EXCEPTION_SINGLE_STEP, 'dec(IP) EXCEPTION_SINGLE_STEP');
|
||||
|
||||
if not GetFpThreadContext(_UC, Context, cfControl) then
|
||||
if not ReadThreadState then
|
||||
exit;
|
||||
|
||||
if FCurrentContext = nil then
|
||||
if not ReadThreadState then
|
||||
exit;
|
||||
|
||||
{$ifdef cpui386}
|
||||
Dec(Context^.def.Eip);
|
||||
dec(FCurrentContext^.def.Eip);
|
||||
{$else}
|
||||
if (TDbgWinProcess(Process).FBitness = b32) then begin
|
||||
Dec(Context^.WOW.Eip);
|
||||
dec(FCurrentContext^.WOW.Eip);
|
||||
end
|
||||
else begin
|
||||
Dec(Context^.def.Rip);
|
||||
dec(FCurrentContext^.def.Rip);
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
if not SetFpThreadContext(Context, cfControl) then
|
||||
exit;
|
||||
// TODO: only changed FCurrentContext, and write back in BeforeContinue;
|
||||
FThreadContextChanged:=false;
|
||||
FThreadContextChanged := True;
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
@ -1710,6 +1697,10 @@ begin
|
||||
exit(False);
|
||||
end;
|
||||
|
||||
Result := True;
|
||||
if FCurrentContext <> nil then
|
||||
exit;
|
||||
|
||||
Result := GetFpThreadContext(_UnAligendContext, FCurrentContext, cfFull);
|
||||
FRegisterValueListValid:=False;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user