mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 19:49:18 +02:00
LazDebuggerFp: Implemented/Corrected StepOverTo and RunTo
git-svn-id: trunk@63305 -
This commit is contained in:
parent
3aff869045
commit
4f5896d680
@ -202,6 +202,9 @@ type
|
|||||||
FWatchEvalList: TFPList; // Schedule
|
FWatchEvalList: TFPList; // Schedule
|
||||||
FWatchAsyncQueued: Boolean;
|
FWatchAsyncQueued: Boolean;
|
||||||
FPrettyPrinter: TFpPascalPrettyPrinter;
|
FPrettyPrinter: TFpPascalPrettyPrinter;
|
||||||
|
FStartupCommand: TDBGCommand;
|
||||||
|
FStartuRunToFile: string;
|
||||||
|
FStartuRunToLine: LongInt;
|
||||||
FDbgController: TDbgController;
|
FDbgController: TDbgController;
|
||||||
FFpDebugThread: TFpDebugThread;
|
FFpDebugThread: TFpDebugThread;
|
||||||
FQuickPause: boolean;
|
FQuickPause: boolean;
|
||||||
@ -274,6 +277,7 @@ type
|
|||||||
procedure DoOnIdle;
|
procedure DoOnIdle;
|
||||||
procedure DoState(const OldState: TDBGState); override;
|
procedure DoState(const OldState: TDBGState); override;
|
||||||
function GetIsIdle: Boolean; override;
|
function GetIsIdle: Boolean; override;
|
||||||
|
function GetCommands: TDBGCommands; override;
|
||||||
protected
|
protected
|
||||||
// Helper vars to run in debug-thread
|
// Helper vars to run in debug-thread
|
||||||
FCallStackEntryListThread: TDbgThread;
|
FCallStackEntryListThread: TDbgThread;
|
||||||
@ -2245,14 +2249,14 @@ begin
|
|||||||
bplReRaise,
|
bplReRaise,
|
||||||
bplRtlUnwind, bplStepOut]);
|
bplRtlUnwind, bplStepOut]);
|
||||||
|
|
||||||
if ACommand in [dcStepInto, dcStepOver, dcStepOut, dcStepTo, dcStepOverInstr{, dcStepIntoInstr}] then
|
if ACommand in [dcStepInto, dcStepOver, dcStepOut, dcStepTo, dcRunTo, dcStepOverInstr{, dcStepIntoInstr}] then
|
||||||
EnableBreaks([bplReRaise]);
|
EnableBreaks([bplReRaise]);
|
||||||
if ACommand in [dcStepOut] then
|
if ACommand in [dcStepOut] then
|
||||||
EnableBreaks([bplFpcSpecific]);
|
EnableBreaks([bplFpcSpecific]);
|
||||||
|
|
||||||
case st of
|
case st of
|
||||||
esStoppedAtRaise: begin
|
esStoppedAtRaise: begin
|
||||||
if ACommand in [dcStepInto, dcStepOver, dcStepOut, dcStepTo] then begin
|
if ACommand in [dcStepInto, dcStepOver, dcStepOut, dcStepTo, dcRunTo] then begin
|
||||||
FState := esStepToFinally;
|
FState := esStepToFinally;
|
||||||
ACommand := dcRun;
|
ACommand := dcRun;
|
||||||
EnableBreaks([bplPopExcept, bplCatches, bplFpcSpecific]);
|
EnableBreaks([bplPopExcept, bplCatches, bplFpcSpecific]);
|
||||||
@ -2784,6 +2788,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFpDebugDebugger.FDbgControllerCreateProcessEvent(var continue: boolean);
|
procedure TFpDebugDebugger.FDbgControllerCreateProcessEvent(var continue: boolean);
|
||||||
|
var
|
||||||
|
addr: TDBGPtrArray;
|
||||||
begin
|
begin
|
||||||
// This will trigger setting the breakpoints,
|
// This will trigger setting the breakpoints,
|
||||||
// may also trigger the evaluation of the callstack or disassembler.
|
// may also trigger the evaluation of the callstack or disassembler.
|
||||||
@ -2793,6 +2799,22 @@ begin
|
|||||||
|
|
||||||
if assigned(OnConsoleOutput) then
|
if assigned(OnConsoleOutput) then
|
||||||
FConsoleOutputThread := TFpWaitForConsoleOutputThread.Create(self);
|
FConsoleOutputThread := TFpWaitForConsoleOutputThread.Create(self);
|
||||||
|
|
||||||
|
case FStartupCommand of
|
||||||
|
dcRunTo: begin
|
||||||
|
&continue := False;
|
||||||
|
if FDbgController.CurrentProcess.DbgInfo.HasInfo then begin
|
||||||
|
addr:=nil;
|
||||||
|
if FDbgController.CurrentProcess.DbgInfo.GetLineAddresses(FStartuRunToFile, FStartuRunToLine, addr)
|
||||||
|
then begin
|
||||||
|
&continue := true;
|
||||||
|
FDbgController.InitializeCommand(TDbgControllerRunToCmd.Create(FDbgController, addr));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if not &continue then
|
||||||
|
EnterPause(GetLocation);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFpDebugDebugger.RequestCommand(const ACommand: TDBGCommand;
|
function TFpDebugDebugger.RequestCommand(const ACommand: TDBGCommand;
|
||||||
@ -2808,7 +2830,7 @@ begin
|
|||||||
if assigned(FDbgController) then
|
if assigned(FDbgController) then
|
||||||
FDbgController.NextOnlyStopOnStartLine := TFpDebugDebuggerProperties(GetProperties).NextOnlyStopOnStartLine;
|
FDbgController.NextOnlyStopOnStartLine := TFpDebugDebuggerProperties(GetProperties).NextOnlyStopOnStartLine;
|
||||||
|
|
||||||
if (ACommand in [dcRun, dcStepOver, dcStepInto, dcStepOut, dcStepTo, dcJumpto,
|
if (ACommand in [dcRun, dcStepOver, dcStepInto, dcStepOut, dcStepTo, dcRunTo, dcJumpto,
|
||||||
dcStepOverInstr, dcStepIntoInstr, dcAttach]) and
|
dcStepOverInstr, dcStepIntoInstr, dcAttach]) and
|
||||||
not assigned(FDbgController.MainProcess)
|
not assigned(FDbgController.MainProcess)
|
||||||
then
|
then
|
||||||
@ -2851,6 +2873,11 @@ begin
|
|||||||
SetState(dsInit);
|
SetState(dsInit);
|
||||||
// TODO: any step commond should run to "main" or "pascalmain"
|
// TODO: any step commond should run to "main" or "pascalmain"
|
||||||
// Currently disabled in TFpDebugDebugger.GetSupportedCommands
|
// Currently disabled in TFpDebugDebugger.GetSupportedCommands
|
||||||
|
FStartupCommand := ACommand;
|
||||||
|
if ACommand = dcRunTo then begin
|
||||||
|
FStartuRunToFile := AnsiString(AParams[0].VAnsiString);
|
||||||
|
FStartuRunToLine := AParams[1].VInteger;
|
||||||
|
end;
|
||||||
StartDebugLoop;
|
StartDebugLoop;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -2893,6 +2920,21 @@ begin
|
|||||||
Result := FDbgController.Pause;
|
Result := FDbgController.Pause;
|
||||||
end;
|
end;
|
||||||
dcStepTo:
|
dcStepTo:
|
||||||
|
begin
|
||||||
|
result := false;
|
||||||
|
if FDbgController.CurrentProcess.DbgInfo.HasInfo then
|
||||||
|
begin
|
||||||
|
addr:=nil;
|
||||||
|
if FDbgController.CurrentProcess.DbgInfo.GetLineAddresses(AnsiString(AParams[0].VAnsiString), AParams[1].VInteger, addr)
|
||||||
|
then begin
|
||||||
|
result := true;
|
||||||
|
FDbgController.InitializeCommand(TDbgControllerStepToCmd.Create(FDbgController, AnsiString(AParams[0].VAnsiString), AParams[1].VInteger));
|
||||||
|
SetState(dsRun);
|
||||||
|
StartDebugLoop;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
dcRunTo:
|
||||||
begin
|
begin
|
||||||
result := false;
|
result := false;
|
||||||
if FDbgController.CurrentProcess.DbgInfo.HasInfo then
|
if FDbgController.CurrentProcess.DbgInfo.HasInfo then
|
||||||
@ -3423,15 +3465,20 @@ begin
|
|||||||
Result := TFpDebugDebuggerProperties.Create;
|
Result := TFpDebugDebuggerProperties.Create;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TFpDebugDebugger.GetCommands: TDBGCommands;
|
||||||
|
begin
|
||||||
|
Result := inherited GetCommands;
|
||||||
|
if State = dsStop then
|
||||||
|
Result := Result - [dcStepInto, dcStepOver, dcStepOut, dcStepIntoInstr, dcStepOverInstr];
|
||||||
|
end;
|
||||||
|
|
||||||
function TFpDebugDebugger.GetSupportedCommands: TDBGCommands;
|
function TFpDebugDebugger.GetSupportedCommands: TDBGCommands;
|
||||||
begin
|
begin
|
||||||
Result:=[dcRun, dcStop, dcStepIntoInstr, dcStepOverInstr, dcStepOver,
|
Result:=[dcRun, dcStop, dcStepIntoInstr, dcStepOverInstr, dcStepOver,
|
||||||
dcStepTo, dcPause, dcStepOut, dcStepInto, dcEvaluate, dcSendConsoleInput
|
dcStepTo, dcRunTo, dcPause, dcStepOut, dcStepInto, dcEvaluate, dcSendConsoleInput
|
||||||
{$IFDEF windows} , dcAttach, dcDetach {$ENDIF}
|
{$IFDEF windows} , dcAttach, dcDetach {$ENDIF}
|
||||||
{$IFDEF linux} , dcAttach, dcDetach {$ENDIF}
|
{$IFDEF linux} , dcAttach, dcDetach {$ENDIF}
|
||||||
];
|
];
|
||||||
if State = dsStop then
|
|
||||||
Result := Result - [dcStepInto, dcStepOver, dcStepOut, dcStepIntoInstr, dcStepOverInstr];
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
Loading…
Reference in New Issue
Block a user