From 4e6ab4552f52860e02741fd1f7b64bddf4f034e2 Mon Sep 17 00:00:00 2001 From: martin Date: Sat, 21 Mar 2015 13:03:07 +0000 Subject: [PATCH] Merged revision(s) 48409 #9cefd73299, 48437 #ed83f63c99 from trunk: Debugger GDBMI: Fix checking for handle to gdb (unix) ........ Debugger GDBMI: Fix checking for handle to gdb (unix) ........ git-svn-id: branches/fixes_1_4@48448 - --- components/lazdebuggergdbmi/cmdlinedebugger.pp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/lazdebuggergdbmi/cmdlinedebugger.pp b/components/lazdebuggergdbmi/cmdlinedebugger.pp index 45b852d4d8..e2157f2514 100644 --- a/components/lazdebuggergdbmi/cmdlinedebugger.pp +++ b/components/lazdebuggergdbmi/cmdlinedebugger.pp @@ -137,9 +137,10 @@ begin // set bits for all waiting handles for n := 0 to Count do begin - if Max < AHandles[n] then Max := AHandles[n]; - if AHandles[n] <> 0 then - FpFD_Set(AHandles[n], FDS); + if AHandles[n] < 0 then + continue; + if Max < AHandles[n] + 1 then Max := AHandles[n] + 1; + FpFD_Set(AHandles[n], FDS); end; if Max=0 then begin // no valid handle, so no change possible @@ -158,7 +159,7 @@ begin // Select: // R = -1 on error, 0 on timeout, >0 on success and is number of handles // FDSWait is changed, and indicates what descriptors have changed - R := FpSelect(Max + 1, @FDSWait, nil, nil, TimeOut); + R := FpSelect(Max, @FDSWait, nil, nil, TimeOut); if CurCallStamp <> FReadLineCallStamp then exit; @@ -197,7 +198,7 @@ begin if R > 0 then begin for n := 0 to Count do - if (AHandles[n] <> 0) + if (AHandles[n] >= 0) and (FpFD_ISSET(AHandles[n],FDSWait)=1) then begin Result := Result or 1 shl n;