mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-08 02:38:13 +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
|
if FThreadContextChanged then
|
||||||
begin
|
begin
|
||||||
Assert(FCurrentContext <> nil, 'TDbgWinThread.BeforeContinue: none existing context was changed');
|
Assert(FCurrentContext <> nil, 'TDbgWinThread.BeforeContinue: none existing context was changed');
|
||||||
if SetFpThreadContext(FCurrentContext) then
|
if not SetFpThreadContext(FCurrentContext) then
|
||||||
FThreadContextChanged:=false;
|
debugln(['Failed to SetFpThreadContext()']);
|
||||||
end;
|
end;
|
||||||
FThreadContextChanged := False;
|
FThreadContextChanged := False;
|
||||||
FCurrentContext := nil;
|
FCurrentContext := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDbgWinThread.ResetInstructionPointerAfterBreakpoint: boolean;
|
function TDbgWinThread.ResetInstructionPointerAfterBreakpoint: boolean;
|
||||||
var
|
|
||||||
_UC: TFpContext;
|
|
||||||
Context: PFpContext;
|
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
assert(MDebugEvent.Exception.ExceptionRecord.ExceptionCode <> EXCEPTION_SINGLE_STEP, 'dec(IP) EXCEPTION_SINGLE_STEP');
|
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;
|
exit;
|
||||||
|
|
||||||
if FCurrentContext = nil then
|
|
||||||
if not ReadThreadState then
|
|
||||||
exit;
|
|
||||||
|
|
||||||
{$ifdef cpui386}
|
{$ifdef cpui386}
|
||||||
Dec(Context^.def.Eip);
|
|
||||||
dec(FCurrentContext^.def.Eip);
|
dec(FCurrentContext^.def.Eip);
|
||||||
{$else}
|
{$else}
|
||||||
if (TDbgWinProcess(Process).FBitness = b32) then begin
|
if (TDbgWinProcess(Process).FBitness = b32) then begin
|
||||||
Dec(Context^.WOW.Eip);
|
|
||||||
dec(FCurrentContext^.WOW.Eip);
|
dec(FCurrentContext^.WOW.Eip);
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
Dec(Context^.def.Rip);
|
|
||||||
dec(FCurrentContext^.def.Rip);
|
dec(FCurrentContext^.def.Rip);
|
||||||
end;
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
if not SetFpThreadContext(Context, cfControl) then
|
FThreadContextChanged := True;
|
||||||
exit;
|
|
||||||
// TODO: only changed FCurrentContext, and write back in BeforeContinue;
|
|
||||||
FThreadContextChanged:=false;
|
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1710,6 +1697,10 @@ begin
|
|||||||
exit(False);
|
exit(False);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Result := True;
|
||||||
|
if FCurrentContext <> nil then
|
||||||
|
exit;
|
||||||
|
|
||||||
Result := GetFpThreadContext(_UnAligendContext, FCurrentContext, cfFull);
|
Result := GetFpThreadContext(_UnAligendContext, FCurrentContext, cfFull);
|
||||||
FRegisterValueListValid:=False;
|
FRegisterValueListValid:=False;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user