FpDebug: allow starting debugger with Step-in/over

This commit is contained in:
Martin 2023-06-20 18:09:10 +02:00
parent a2d87ebd69
commit c5cddde52e

View File

@ -3876,6 +3876,23 @@ end;
procedure TFpDebugDebugger.FDbgControllerCreateProcessEvent(var continue: boolean); procedure TFpDebugDebugger.FDbgControllerCreateProcessEvent(var continue: boolean);
var var
addr: TDBGPtrArray; addr: TDBGPtrArray;
procedure CheckForSym(s: string);
var
Sym: TFpSymbol;
l: integer;
begin
Sym := FDbgController.CurrentProcess.SymbolTableInfo.FindProcSymbol(s);
if Sym <> nil then begin
l := Length(addr);
if IsTargetNotNil(Sym.Address) then begin
SetLength(addr, l+1);
addr[l] := Sym.Address.Address;
end;
Sym.ReleaseReference;
end;
end;
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.
@ -3902,6 +3919,23 @@ begin
if not &continue then if not &continue then
EnterPause(GetLocation); EnterPause(GetLocation);
end; end;
dcStepInto, dcStepOver: begin
&continue := False;
if FDbgController.CurrentProcess.SymbolTableInfo <> nil then begin
addr:=nil;
CheckForSym('PASCALMAIN');
CheckForSym('MAIN');
CheckForSym('$MAIN');
CheckForSym('_MAIN');
CheckForSym('MAIN_WRAPPER');
if Length(addr) > 0 then begin
&continue := true;
FDbgController.InitializeCommand(TDbgControllerRunToCmd.Create(FDbgController, addr));
end;
end;
if not &continue then
EnterPause(GetLocation);
end;
end; end;
end; end;
@ -4714,7 +4748,7 @@ function TFpDebugDebugger.GetCommands: TDBGCommands;
begin begin
Result := inherited GetCommands; Result := inherited GetCommands;
if State in [dsStop, dsIdle] then if State in [dsStop, dsIdle] then
Result := Result - [dcStepInto, dcStepOver, dcStepOut, dcStepIntoInstr, dcStepOverInstr]; Result := Result - [dcStepOut, dcStepIntoInstr, dcStepOverInstr];
end; end;
procedure TFpDebugDebugger.LockCommandProcessing; procedure TFpDebugDebugger.LockCommandProcessing;
@ -4744,7 +4778,7 @@ class function TFpDebugDebugger.SupportedCommandsFor(AState: TDBGState
begin begin
Result := inherited SupportedCommandsFor(AState); Result := inherited SupportedCommandsFor(AState);
if AState = dsStop then if AState = dsStop then
Result := Result - [dcStepInto, dcStepOver, dcStepOut, dcStepIntoInstr, dcStepOverInstr]; Result := Result - [dcStepOut, dcStepIntoInstr, dcStepOverInstr];
end; end;
class function TFpDebugDebugger.SupportedFeatures: TDBGFeatures; class function TFpDebugDebugger.SupportedFeatures: TDBGFeatures;