various debugger state fixes

git-svn-id: trunk@8384 -
This commit is contained in:
micha 2005-12-29 16:21:06 +00:00
parent f563fffe41
commit 52d4e4d8c3
3 changed files with 34 additions and 32 deletions

View File

@ -361,7 +361,8 @@ begin
end;
end;
*)
until not DebugProcessRunning;
{$message warning condition should also check end-of-file reached for process output stream}
until not DebugProcessRunning and (Length(FOutputBuf) = 0);
FReading := False;
if FFlushAfterRead

View File

@ -1286,9 +1286,9 @@ end;
procedure TDebugger.Done;
begin
SetState(dsNone);
FEnvironment.Clear;
FCurEnvironment.Clear;
SetState(dsNone);
end;
procedure TDebugger.DoCurrent(const ALocation: TDBGLocationRec);
@ -1327,33 +1327,36 @@ var
Env: TStringList;
begin
// Createe local copy
Env := TStringList.Create;
try
Env.Assign(Environment);
if FState <> dsNone then
begin
Env := TStringList.Create;
try
Env.Assign(Environment);
// Check for nonexisting and unchanged vars
for n := 0 to FCurEnvironment.Count - 1 do
begin
S := FCurEnvironment[n];
idx := Env.IndexOfName(GetPart([], ['='], S, False, False));
if idx = -1
then ReqCmd(dcEnvironment, [S, False])
else begin
if Env[idx] = S
then Env.Delete(idx);
// Check for nonexisting and unchanged vars
for n := 0 to FCurEnvironment.Count - 1 do
begin
S := FCurEnvironment[n];
idx := Env.IndexOfName(GetPart([], ['='], S, False, False));
if idx = -1
then ReqCmd(dcEnvironment, [S, False])
else begin
if Env[idx] = S
then Env.Delete(idx);
end;
end;
// Set the remaining
for n := 0 to Env.Count - 1 do
begin
S := Env[n];
//Skip functions etc.
if Pos('=()', S) <> 0 then Continue;
ReqCmd(dcEnvironment, [S, True]);
end;
finally
Env.Free;
end;
// Set the remaining
for n := 0 to Env.Count - 1 do
begin
S := Env[n];
//Skip functions etc.
if Pos('=()', S) <> 0 then Continue;
ReqCmd(dcEnvironment, [S, True]);
end;
finally
Env.Free;
end;
FCurEnvironment.Assign(FEnvironment);
end;

View File

@ -1057,8 +1057,6 @@ end;
function TGDBMIDebugger.GDBStop: Boolean;
begin
Result := False;
if State = dsError
then begin
// We don't know the state of the debugger,
@ -1074,7 +1072,7 @@ begin
// not supported yet
// ExecuteCommand('-exec-abort');
ExecuteCommand('kill', [cfNoMiCommand], @GDBStopCallback, 0);
Result := ExecuteCommand('kill', [cfNoMiCommand], @GDBStopCallback, 0);
end;
procedure TGDBMIDebugger.GDBStopCallback(const AResult: TGDBMIExecResult; const ATag: Integer);
@ -1538,8 +1536,7 @@ begin
AResult.Values := '';
AResult.Flags := [];
AResult.State := dsNone;
while DebugProcessRunning do
begin
repeat
S := StripLN(ReadLine);
if S = '' then Continue;
if S = '(gdb) ' then Break;
@ -1555,7 +1552,8 @@ begin
else
DebugLn('[WARNING] Debugger: Unknown record: ', S);
end;
end;
{$message warning condition should also check end-of-file reached for process output stream}
until not DebugProcessRunning;
end;
function TGDBMIDebugger.ProcessRunning(var AStoppedParams: String): Boolean;