mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 17:50:19 +02:00
fixed debugger stop
git-svn-id: trunk@3106 -
This commit is contained in:
parent
e752c14286
commit
664c40ba63
@ -48,6 +48,11 @@ type
|
|||||||
SignalText: String; // Signal text if we hit one
|
SignalText: String; // Signal text if we hit one
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TGDBMIDebuggerState = (
|
||||||
|
gdbmisWaitingForKill
|
||||||
|
);
|
||||||
|
TGDBMIDebuggerStates = set of TGDBMIDebuggerState;
|
||||||
|
|
||||||
|
|
||||||
{ TGDBMIDebugger }
|
{ TGDBMIDebugger }
|
||||||
|
|
||||||
@ -59,6 +64,7 @@ type
|
|||||||
FTargetPID: Integer;
|
FTargetPID: Integer;
|
||||||
FBreakErrorBreakID: Integer;
|
FBreakErrorBreakID: Integer;
|
||||||
FExceptionBreakID: Integer;
|
FExceptionBreakID: Integer;
|
||||||
|
fGDBMIStates: TGDBMIDebuggerStates;
|
||||||
FVersion: String;
|
FVersion: String;
|
||||||
function FindBreakpoint(const ABreakpoint: Integer): TDBGBreakPoint;
|
function FindBreakpoint(const ABreakpoint: Integer): TDBGBreakPoint;
|
||||||
function GDBEvaluate(const AExpression: String; var AResult: String): Boolean;
|
function GDBEvaluate(const AExpression: String; var AResult: String): Boolean;
|
||||||
@ -91,6 +97,7 @@ type
|
|||||||
function CreateLocals: TDBGLocals; override;
|
function CreateLocals: TDBGLocals; override;
|
||||||
function CreateCallStack: TDBGCallStack; override;
|
function CreateCallStack: TDBGCallStack; override;
|
||||||
function CreateWatches: TDBGWatches; override;
|
function CreateWatches: TDBGWatches; override;
|
||||||
|
procedure DoState(const OldState: TDBGState); override;
|
||||||
function GetSupportedCommands: TDBGCommands; override;
|
function GetSupportedCommands: TDBGCommands; override;
|
||||||
function RequestCommand(const ACommand: TDBGCommand; const AParams: array of const): Boolean; override;
|
function RequestCommand(const ACommand: TDBGCommand; const AParams: array of const): Boolean; override;
|
||||||
public
|
public
|
||||||
@ -351,6 +358,23 @@ begin
|
|||||||
Result := TDBGWatches.Create(Self, TGDBMIWatch);
|
Result := TDBGWatches.Create(Self, TGDBMIWatch);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TGDBMIDebugger.DoState(const OldState: TDBGState);
|
||||||
|
begin
|
||||||
|
writeln('TGDBMIDebugger.DoState State=',DBGStateNames[State],' OldState=',DBGStateNames[OldState],' ',gdbmisWaitingForKill in fGDBMIStates);
|
||||||
|
// check if state change should sent a notification or is internal
|
||||||
|
if gdbmisWaitingForKill in fGDBMIStates then begin
|
||||||
|
// we are waiting for the debugger to kill the process
|
||||||
|
// -> hide the temporary dsPause state
|
||||||
|
if State=dsPause then begin
|
||||||
|
writeln('[TGDBMIDebugger.DoState] Hiding dsPause while waiting for kill');
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
Exclude(fGDBMIStates,gdbmisWaitingForKill);
|
||||||
|
end;
|
||||||
|
// send a notification
|
||||||
|
inherited DoState(OldState);
|
||||||
|
end;
|
||||||
|
|
||||||
destructor TGDBMIDebugger.Destroy;
|
destructor TGDBMIDebugger.Destroy;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
@ -416,7 +440,7 @@ function TGDBMIDebugger.ExecuteCommand(const ACommand: String;
|
|||||||
const ANoMICommand: Boolean): Boolean;
|
const ANoMICommand: Boolean): Boolean;
|
||||||
var
|
var
|
||||||
S: String;
|
S: String;
|
||||||
IsKill: Boolean;
|
//IsKill: Boolean;
|
||||||
begin
|
begin
|
||||||
AResultValues := '';
|
AResultValues := '';
|
||||||
AResultState := dsNone;
|
AResultState := dsNone;
|
||||||
@ -428,7 +452,7 @@ begin
|
|||||||
// Kill is a special case, since it requires additional
|
// Kill is a special case, since it requires additional
|
||||||
// processing after the command is executed. Until we have
|
// processing after the command is executed. Until we have
|
||||||
// added a callback meganism, we handle it here
|
// added a callback meganism, we handle it here
|
||||||
IsKill := S = 'kill';
|
//IsKill := S = 'kill';
|
||||||
|
|
||||||
SendCmdLn(S, AValues);
|
SendCmdLn(S, AValues);
|
||||||
Result := ProcessResult(AResultState, AResultValues,
|
Result := ProcessResult(AResultState, AResultValues,
|
||||||
@ -440,6 +464,8 @@ begin
|
|||||||
then SetState(AResultState);
|
then SetState(AResultState);
|
||||||
if AResultState = dsRun
|
if AResultState = dsRun
|
||||||
then Result := ProcessRunning;
|
then Result := ProcessRunning;
|
||||||
|
end else begin
|
||||||
|
writeln('WARNING: TGDBMIDebugger.ExecuteCommand Command="',ACommand,'" failed.');
|
||||||
end;
|
end;
|
||||||
FCommandQueue.Delete(0);
|
FCommandQueue.Delete(0);
|
||||||
if FStoppedParams <> ''
|
if FStoppedParams <> ''
|
||||||
@ -448,8 +474,8 @@ begin
|
|||||||
FStoppedParams := '';
|
FStoppedParams := '';
|
||||||
ProcessStopped(S);
|
ProcessStopped(S);
|
||||||
end;
|
end;
|
||||||
if IsKill
|
//if IsKill
|
||||||
then GDBStop2;
|
//then GDBStop2;
|
||||||
until not Result or (FCommandQueue.Count = 0);
|
until not Result or (FCommandQueue.Count = 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -577,6 +603,7 @@ var
|
|||||||
ResultList, BkptList: TStringList;
|
ResultList, BkptList: TStringList;
|
||||||
TargetPIDPart: String;
|
TargetPIDPart: String;
|
||||||
begin
|
begin
|
||||||
|
Exclude(FGDBMIStates,gdbmisWaitingForKill);
|
||||||
if State in [dsStop]
|
if State in [dsStop]
|
||||||
then begin
|
then begin
|
||||||
if FHasSymbols
|
if FHasSymbols
|
||||||
@ -692,6 +719,7 @@ end;
|
|||||||
function TGDBMIDebugger.GDBStop: Boolean;
|
function TGDBMIDebugger.GDBStop: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
Include(FGDBMIStates,gdbmisWaitingForKill);
|
||||||
|
|
||||||
if State = dsError
|
if State = dsError
|
||||||
then begin
|
then begin
|
||||||
@ -731,7 +759,8 @@ end;
|
|||||||
|
|
||||||
function TGDBMIDebugger.GetSupportedCommands: TDBGCommands;
|
function TGDBMIDebugger.GetSupportedCommands: TDBGCommands;
|
||||||
begin
|
begin
|
||||||
Result := [dcRun, dcPause, dcStop, dcStepOver, dcStepInto, dcRunTo, dcJumpto, dcBreak{, dcWatch}, dcLocal, dcEvaluate, dcModify]
|
Result := [dcRun, dcPause, dcStop, dcStepOver, dcStepInto, dcRunTo, dcJumpto,
|
||||||
|
dcBreak{, dcWatch}, dcLocal, dcEvaluate, dcModify]
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGDBMIDebugger.Init;
|
procedure TGDBMIDebugger.Init;
|
||||||
@ -850,6 +879,8 @@ begin
|
|||||||
WriteLN('[Debugger] Target output: ', S);
|
WriteLN('[Debugger] Target output: ', S);
|
||||||
end;
|
end;
|
||||||
'&': begin // log-stream-output
|
'&': begin // log-stream-output
|
||||||
|
if S='&"kill\n"' then
|
||||||
|
ANewState:=dsStop;
|
||||||
WriteLN('[Debugger] Log output: ', S);
|
WriteLN('[Debugger] Log output: ', S);
|
||||||
end;
|
end;
|
||||||
'*', '+', '=': begin
|
'*', '+', '=': begin
|
||||||
@ -1032,7 +1063,7 @@ begin
|
|||||||
List := CreateMIValueList(AParams);
|
List := CreateMIValueList(AParams);
|
||||||
try
|
try
|
||||||
Reason := List.Values['reason'];
|
Reason := List.Values['reason'];
|
||||||
if Reason = 'exited-normally'
|
if (Reason = 'exited-normally') or (gdbmisWaitingForKill in fGDBMIStates)
|
||||||
then begin
|
then begin
|
||||||
SetState(dsStop);
|
SetState(dsStop);
|
||||||
Exit;
|
Exit;
|
||||||
@ -1820,6 +1851,9 @@ end;
|
|||||||
end.
|
end.
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.22 2003/06/02 21:37:30 mattias
|
||||||
|
fixed debugger stop
|
||||||
|
|
||||||
Revision 1.21 2003/05/30 00:53:09 marc
|
Revision 1.21 2003/05/30 00:53:09 marc
|
||||||
MWE: * fixed debugger.stop
|
MWE: * fixed debugger.stop
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user