mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-17 22:21:33 +02:00
LazDebuggerFp (pure): Implemented step-out
git-svn-id: trunk@44804 -
This commit is contained in:
parent
401f148e85
commit
36e6e3a257
@ -308,6 +308,18 @@ begin
|
||||
CallProcessLoop:=true;
|
||||
end;
|
||||
|
||||
procedure HandleStepOut(AParams: String; out CallProcessLoop: boolean);
|
||||
begin
|
||||
CallProcessLoop:=false;
|
||||
if not assigned(GController.MainProcess)
|
||||
then begin
|
||||
WriteLN('The process is not paused');
|
||||
Exit;
|
||||
end;
|
||||
GController.StepOut;
|
||||
CallProcessLoop:=true;
|
||||
end;
|
||||
|
||||
procedure HandleStepInst(AParams: String; out CallProcessLoop: boolean);
|
||||
begin
|
||||
CallProcessLoop:=false;
|
||||
@ -751,9 +763,10 @@ begin
|
||||
MCommands.AddCommand(['break', 'b'], @HandleBreak, 'break [-d] <adress>|<filename:line>: Set a breakpoint at <adress> or <filename:line>. -d removes');
|
||||
MCommands.AddCommand(['continue', 'cont', 'c'], @HandleContinue, 'continue: Continues execution');
|
||||
MCommands.AddCommand(['kill', 'k'], @HandleKill, 'kill: Stops execution of the debuggee');
|
||||
MCommands.AddCommand(['step-inst', 'si'], @HandleStepInst, 'step: Steps-into one instruction');
|
||||
MCommands.AddCommand(['next-inst', 'ni'], @HandleNextInst, 'next: Steps-over one instruction');
|
||||
MCommands.AddCommand(['step-inst', 'si'], @HandleStepInst, 'step-inst: Steps-into one instruction');
|
||||
MCommands.AddCommand(['next-inst', 'ni'], @HandleNextInst, 'next-inst: Steps-over one instruction');
|
||||
MCommands.AddCommand(['next', 'n'], @HandleNext, 'next: Steps one line');
|
||||
MCommands.AddCommand(['step-out', 'so'], @HandleStepOut, 'step-out: Steps out of current procedure');
|
||||
MCommands.AddCommand(['list', 'l'], @HandleList, 'list [<adress>|<location>]: Lists the source for <adress> or <location>');
|
||||
MCommands.AddCommand(['memory', 'mem', 'm'], @HandleMemory, 'memory [-<size>] [<adress> <count>|<location> <count>]: Dump <count> (default: 1) from memory <adress> or <location> (default: current) of <size> (default: 4) bytes, where size is 1,2,4,8 or 16.');
|
||||
MCommands.AddCommand(['writememory', 'w'], @HandleWriteMemory, 'writememory [<adress> <value>]: Write <value> (with a length of 4 bytes) into memory at address <adress>.');
|
||||
|
@ -114,22 +114,25 @@ type
|
||||
FStoreStepStackFrame: TDBGPtr;
|
||||
FStoreStepFuncAddr: TDBGPtr;
|
||||
FHiddenBreakpoint: TDbgBreakpoint;
|
||||
FStepOut: boolean;
|
||||
procedure StoreStepInfo;
|
||||
procedure LoadRegisterValues; virtual;
|
||||
public
|
||||
constructor Create(const AProcess: TDbgProcess; const AID: Integer; const AHandle: THandle); virtual;
|
||||
function ResetInstructionPointerAfterBreakpoint: boolean; virtual; abstract;
|
||||
procedure AfterHitBreak;
|
||||
procedure ClearHiddenBreakpoint;
|
||||
destructor Destroy; override;
|
||||
function SingleStep: Boolean; virtual;
|
||||
function StepOver: Boolean; virtual;
|
||||
function Next: Boolean; virtual;
|
||||
function StepOut: Boolean; virtual;
|
||||
function IntNext: Boolean; virtual;
|
||||
function CompareStepInfo: boolean;
|
||||
property ID: Integer read FID;
|
||||
property Handle: THandle read FHandle;
|
||||
property SingleStepping: boolean read FSingleStepping write FSingleStepping;
|
||||
property Stepping: boolean read FStepping write FStepping;
|
||||
property Stepping: boolean read FStepping;
|
||||
property RegisterValueList: TDbgRegisterValueList read GetRegisterValueList;
|
||||
property HiddenBreakpoint: TDbgBreakpoint read FHiddenBreakpoint;
|
||||
end;
|
||||
@ -811,7 +814,7 @@ begin
|
||||
sym := FProcess.FindSymbol(AnAddr);
|
||||
if assigned(sym) then
|
||||
begin
|
||||
result := (FStoreStepSrcFilename=sym.FileName) and (FStoreStepSrcLineNo=sym.Line) and
|
||||
result := (((FStoreStepSrcFilename=sym.FileName) and (FStoreStepSrcLineNo=sym.Line)) or FStepOut) and
|
||||
(FStoreStepFuncAddr=sym.Address.Address);
|
||||
if not result and (FStoreStepFuncAddr<>sym.Address.Address) then
|
||||
begin
|
||||
@ -868,6 +871,12 @@ begin
|
||||
inherited Create;
|
||||
end;
|
||||
|
||||
procedure TDbgThread.AfterHitBreak;
|
||||
begin
|
||||
FStepping:=false;
|
||||
FStepOut:=false;
|
||||
end;
|
||||
|
||||
procedure TDbgThread.ClearHiddenBreakpoint;
|
||||
begin
|
||||
FreeAndNil(FHiddenBreakpoint);
|
||||
@ -921,6 +930,12 @@ begin
|
||||
result := IntNext;
|
||||
end;
|
||||
|
||||
function TDbgThread.StepOut: Boolean;
|
||||
begin
|
||||
result := next;
|
||||
FStepOut := result;
|
||||
end;
|
||||
|
||||
{ TDbgBreak }
|
||||
|
||||
constructor TDbgBreakpoint.Create(const AProcess: TDbgProcess; const ALocation: TDbgPtr);
|
||||
|
@ -51,6 +51,7 @@ type
|
||||
procedure StepIntoInstr;
|
||||
procedure StepOverInstr;
|
||||
procedure Next;
|
||||
procedure StepOut;
|
||||
procedure Pause;
|
||||
procedure ProcessLoop;
|
||||
procedure SendEvents(out continue: boolean);
|
||||
@ -151,6 +152,11 @@ begin
|
||||
FCurrentThread.Next;
|
||||
end;
|
||||
|
||||
procedure TDbgController.StepOut;
|
||||
begin
|
||||
FCurrentThread.StepOut;
|
||||
end;
|
||||
|
||||
procedure TDbgController.Pause;
|
||||
begin
|
||||
FCurrentProcess.Pause;
|
||||
@ -198,7 +204,7 @@ begin
|
||||
begin
|
||||
FCurrentThread.SingleStepping:=false;
|
||||
if FPDEvent<>deInternalContinue then
|
||||
FCurrentThread.Stepping := False;
|
||||
FCurrentThread.AfterHitBreak;
|
||||
if assigned(FCurrentThread.HiddenBreakpoint) then
|
||||
FCurrentThread.ClearHiddenBreakpoint;
|
||||
end;
|
||||
|
@ -746,6 +746,13 @@ begin
|
||||
StartDebugLoop;
|
||||
result := true;
|
||||
end;
|
||||
dcStepOut:
|
||||
begin
|
||||
FDbgController.StepOut;
|
||||
SetState(dsRun);
|
||||
StartDebugLoop;
|
||||
result := true;
|
||||
end;
|
||||
end; {case}
|
||||
end;
|
||||
|
||||
@ -852,7 +859,7 @@ end;
|
||||
|
||||
function TFpDebugDebugger.GetSupportedCommands: TDBGCommands;
|
||||
begin
|
||||
Result:=[dcRun, dcStop, dcStepIntoInstr, dcStepOverInstr, dcStepOver, dcRunTo, dcPause];
|
||||
Result:=[dcRun, dcStop, dcStepIntoInstr, dcStepOverInstr, dcStepOver, dcRunTo, dcPause, dcStepOut];
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user