mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-31 09:40:28 +02:00
FpDebug: Add asserts
This commit is contained in:
parent
c8a6a985d0
commit
f47220cc47
@ -284,6 +284,7 @@ var
|
||||
aKernResult: kern_return_t;
|
||||
old_StateCnt: mach_msg_Type_number_t;
|
||||
begin
|
||||
{$IFDEF FPDEBUG_THREAD_CHECK}AssertFpDebugThreadId('TFpInternalBreakpoint.ResetBreak');{$ENDIF}
|
||||
if ID<0 then
|
||||
begin
|
||||
// The ID is set to -1 when the debugger does not have sufficient rights.
|
||||
|
@ -462,6 +462,7 @@ function TDbgLinuxThread.ReadThreadState: boolean;
|
||||
var
|
||||
io: iovec;
|
||||
begin
|
||||
{$IFDEF FPDEBUG_THREAD_CHECK}AssertFpDebugThreadId('TFpInternalBreakpoint.ResetBreak');{$ENDIF}
|
||||
assert(FIsPaused, 'TDbgLinuxThread.ReadThreadState: FIsPaused');
|
||||
result := true;
|
||||
if FHasThreadState then
|
||||
|
@ -812,6 +812,7 @@ if AThread<>nil then debugln(['## ath.iss ',AThread.NextIsSingleStep]);
|
||||
result := Windows.ContinueDebugEvent(MDebugEvent.dwProcessId, MDebugEvent.dwThreadId, DBG_CONTINUE);
|
||||
DebugLn(not Result, 'ContinueDebugEvent failed: %d', [Windows.GetLastError]);
|
||||
result := true;
|
||||
MDebugEvent.dwProcessId := 0; // Flag as running // for assert in ReadThreadState
|
||||
end;
|
||||
|
||||
function TDbgWinProcess.Detach(AProcess: TDbgProcess; AThread: TDbgThread
|
||||
@ -1730,6 +1731,8 @@ end;
|
||||
|
||||
function TDbgWinThread.ReadThreadState: boolean;
|
||||
begin
|
||||
{$IFDEF FPDEBUG_THREAD_CHECK}AssertFpDebugThreadId('TFpInternalBreakpoint.ResetBreak');{$ENDIF}
|
||||
assert(MDebugEvent.dwProcessId <> 0, 'TDbgWinThread.ReadThreadState: MDebugEvent.dwProcessId <> 0');
|
||||
if Process.ProcessID <> MDebugEvent.dwProcessId then begin
|
||||
DebugLn(DBG_WARNINGS, 'ERROR: attempt to read threadstate, for wrong process. Thread: %u Thread-Process: %u Event-Process %u', [Id, Process.ProcessID, MDebugEvent.dwProcessId]);
|
||||
exit(False);
|
||||
|
Loading…
Reference in New Issue
Block a user