mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 01:39:25 +02:00
Debugger, GDBMI: add real RunTo
git-svn-id: trunk@63307 -
This commit is contained in:
parent
06b1a964b6
commit
e4d3c2df74
@ -390,6 +390,7 @@ type
|
|||||||
( ectNone,
|
( ectNone,
|
||||||
ectContinue, // -exec-continue
|
ectContinue, // -exec-continue
|
||||||
ectRun, // -exec-run
|
ectRun, // -exec-run
|
||||||
|
ectRunTo, // run to temup breakpoint [Source, Line]
|
||||||
ectStepTo, // -exec-until [Source, Line]
|
ectStepTo, // -exec-until [Source, Line]
|
||||||
ectStepOver, // -exec-next
|
ectStepOver, // -exec-next
|
||||||
ectStepOut, // -exec-finish
|
ectStepOut, // -exec-finish
|
||||||
@ -958,6 +959,7 @@ type
|
|||||||
function GDBStepOverInstr: Boolean;
|
function GDBStepOverInstr: Boolean;
|
||||||
function GDBStepIntoInstr: Boolean;
|
function GDBStepIntoInstr: Boolean;
|
||||||
function GDBStepOut: Boolean;
|
function GDBStepOut: Boolean;
|
||||||
|
function GDBStepTo(const ASource: String; const ALine: Integer): Boolean;
|
||||||
function GDBRunTo(const ASource: String; const ALine: Integer): Boolean;
|
function GDBRunTo(const ASource: String; const ALine: Integer): Boolean;
|
||||||
function GDBJumpTo(const {%H-}ASource: String; const {%H-}ALine: Integer): Boolean;
|
function GDBJumpTo(const {%H-}ASource: String; const {%H-}ALine: Integer): Boolean;
|
||||||
function GDBAttach(AProcessID: String): Boolean;
|
function GDBAttach(AProcessID: String): Boolean;
|
||||||
@ -1167,6 +1169,7 @@ const
|
|||||||
( '', // ectNone
|
( '', // ectNone
|
||||||
'-exec-continue', // ectContinue,
|
'-exec-continue', // ectContinue,
|
||||||
'-exec-run', // ectRun,
|
'-exec-run', // ectRun,
|
||||||
|
'-exec-continue', // ectRunTo,
|
||||||
'-exec-until', // ectStepTo, // [Source, Line]
|
'-exec-until', // ectStepTo, // [Source, Line]
|
||||||
'-exec-next', // ectStepOver,
|
'-exec-next', // ectStepOver,
|
||||||
'-exec-finish', // ectStepOut,
|
'-exec-finish', // ectStepOut,
|
||||||
@ -1179,6 +1182,7 @@ const
|
|||||||
( '', // ectNone
|
( '', // ectNone
|
||||||
'continue', // ectContinue,
|
'continue', // ectContinue,
|
||||||
'run', // ectRun,
|
'run', // ectRun,
|
||||||
|
'continue', // ectRunTo,
|
||||||
'until', // ectStepTo, // [Source, Line]
|
'until', // ectStepTo, // [Source, Line]
|
||||||
'next', // ectStepOver,
|
'next', // ectStepOver,
|
||||||
'finish', // ectStepOut,
|
'finish', // ectStepOut,
|
||||||
@ -7184,7 +7188,7 @@ var
|
|||||||
|
|
||||||
// should be srRaiseExcept;
|
// should be srRaiseExcept;
|
||||||
case FExecType of
|
case FExecType of
|
||||||
ectContinue, ectRun:
|
ectContinue, ectRun, ectRunTo:
|
||||||
begin
|
begin
|
||||||
FCurrentExecCmd := ectContinue;
|
FCurrentExecCmd := ectContinue;
|
||||||
FCurrentExecArg := '';
|
FCurrentExecArg := '';
|
||||||
@ -7390,6 +7394,7 @@ var
|
|||||||
ContinueExecution, ContinueStep: Boolean;
|
ContinueExecution, ContinueStep: Boolean;
|
||||||
NextExecCmdObj: TGDBMIDebuggerCommandExecute;
|
NextExecCmdObj: TGDBMIDebuggerCommandExecute;
|
||||||
R: TGDBMIExecResult;
|
R: TGDBMIExecResult;
|
||||||
|
ResultList: TGDBMINameValueList;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
FCanKillNow := False;
|
FCanKillNow := False;
|
||||||
@ -7405,6 +7410,34 @@ begin
|
|||||||
FStepBreakPoint := -1;
|
FStepBreakPoint := -1;
|
||||||
RunMode := rmNormal;
|
RunMode := rmNormal;
|
||||||
|
|
||||||
|
if FExecType = ectRunTo then begin
|
||||||
|
FContext.ThreadContext := ccUseGlobal;
|
||||||
|
FTheDebugger.QueueExecuteLock; // force queue
|
||||||
|
try
|
||||||
|
FTheDebugger.FInstructionQueue.InvalidateThredAndFrame;
|
||||||
|
if (not ExecuteCommand('-break-insert "\"%s\":%d"', [FRunToSrc, FRunToLine], R, [cfNoStackContext])) or
|
||||||
|
(R.State = dsError)
|
||||||
|
then
|
||||||
|
if (not ExecuteCommand('-break-insert "\"%s\":%d"', [FRunToSrc, FRunToLine], R, [cfNoStackContext])) or
|
||||||
|
(R.State = dsError)
|
||||||
|
then begin
|
||||||
|
Result := False;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
FTheDebugger.QueueExecuteUnlock;
|
||||||
|
end;
|
||||||
|
|
||||||
|
ResultList := TGDBMINameValueList.Create(R);
|
||||||
|
ResultList.SetPath('bkpt');
|
||||||
|
FStepBreakPoint := StrToIntDef(ResultList.Values['number'], -1);
|
||||||
|
ResultList.Free;
|
||||||
|
if FStepBreakPoint < 0 then begin
|
||||||
|
Result := False;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
if (FExecType in [ectStepOver, ectStepInto, ectStepOut]) and
|
if (FExecType in [ectStepOver, ectStepInto, ectStepOut]) and
|
||||||
(FTheDebugger.FStoppedReason = srRaiseExcept)
|
(FTheDebugger.FStoppedReason = srRaiseExcept)
|
||||||
then begin
|
then begin
|
||||||
@ -7540,15 +7573,16 @@ begin
|
|||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FQueueRunLevel := 0; // Execommands are only allowed at level 0
|
FQueueRunLevel := 0; // Execommands are only allowed at level 0
|
||||||
FCanKillNow := False;
|
FCanKillNow := False;
|
||||||
FDidKillNow := False;;
|
FDidKillNow := False;
|
||||||
FNextExecQueued := False;
|
FNextExecQueued := False;
|
||||||
FExecType := ExecType;
|
FExecType := ExecType;
|
||||||
FCurrentExecCmd := ExecType;
|
FCurrentExecCmd := ExecType;
|
||||||
FCurrentExecArg := '';
|
FCurrentExecArg := '';
|
||||||
if FCurrentExecCmd = ectStepTo then begin
|
if FCurrentExecCmd in [ectStepTo, ectRunTo] then begin
|
||||||
FRunToSrc := AnsiString(Args[0].VAnsiString);
|
FRunToSrc := AnsiString(Args[0].VAnsiString);
|
||||||
FRunToLine := Args[1].VInteger;
|
FRunToLine := Args[1].VInteger;
|
||||||
FCurrentExecArg := Format(' %s:%d', [FRunToSrc, FRunToLine]);
|
if FCurrentExecCmd = ectStepTo then
|
||||||
|
FCurrentExecArg := Format(' %s:%d', [FRunToSrc, FRunToLine]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -9467,7 +9501,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGDBMIDebuggerBase.GDBRunTo(const ASource: String;
|
function TGDBMIDebuggerBase.GDBStepTo(const ASource: String;
|
||||||
const ALine: Integer): Boolean;
|
const ALine: Integer): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
@ -9487,6 +9521,25 @@ begin
|
|||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TGDBMIDebuggerBase.GDBRunTo(const ASource: String; const ALine: Integer
|
||||||
|
): Boolean;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
case State of
|
||||||
|
dsStop: begin
|
||||||
|
Result := StartDebugging(TGDBMIDebuggerCommandExecute.Create(Self, ectRunTo, [ASource, ALine]));
|
||||||
|
end;
|
||||||
|
dsPause: begin
|
||||||
|
CancelBeforeRun;
|
||||||
|
QueueCommand(TGDBMIDebuggerCommandExecute.Create(Self, ectRunTo, [ASource, ALine]));
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
dsIdle: begin
|
||||||
|
DebugLn(DBG_WARNINGS, '[WARNING] Debugger: Unable to runto in idle state');
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TGDBMIDebuggerBase.GDBSourceAdress(const ASource: String; ALine, AColumn: Integer; out AAddr: TDbgPtr): Boolean;
|
function TGDBMIDebuggerBase.GDBSourceAdress(const ASource: String; ALine, AColumn: Integer; out AAddr: TDbgPtr): Boolean;
|
||||||
var
|
var
|
||||||
ID: packed record
|
ID: packed record
|
||||||
@ -9673,7 +9726,7 @@ end;
|
|||||||
function TGDBMIDebuggerBase.GetSupportedCommands: TDBGCommands;
|
function TGDBMIDebuggerBase.GetSupportedCommands: TDBGCommands;
|
||||||
begin
|
begin
|
||||||
Result := [dcRun, dcPause, dcStop, dcStepOver, dcStepInto, dcStepOut,
|
Result := [dcRun, dcPause, dcStop, dcStepOver, dcStepInto, dcStepOut,
|
||||||
dcStepOverInstr, dcStepIntoInstr, dcStepTo, dcAttach, dcDetach, dcJumpto,
|
dcStepOverInstr, dcStepIntoInstr, dcStepTo, dcRunTo, dcAttach, dcDetach, dcJumpto,
|
||||||
dcBreak, dcWatch, dcLocal, dcEvaluate, dcModify, dcEnvironment,
|
dcBreak, dcWatch, dcLocal, dcEvaluate, dcModify, dcEnvironment,
|
||||||
dcSetStackFrame, dcDisassemble
|
dcSetStackFrame, dcDisassemble
|
||||||
{$IFDEF DBG_ENABLE_TERMINAL}, dcSendConsoleInput{$ENDIF}
|
{$IFDEF DBG_ENABLE_TERMINAL}, dcSendConsoleInput{$ENDIF}
|
||||||
@ -9892,7 +9945,8 @@ begin
|
|||||||
dcStepOver: Result := GDBStepOver;
|
dcStepOver: Result := GDBStepOver;
|
||||||
dcStepInto: Result := GDBStepInto;
|
dcStepInto: Result := GDBStepInto;
|
||||||
dcStepOut: Result := GDBStepOut;
|
dcStepOut: Result := GDBStepOut;
|
||||||
dcStepTo: Result := GDBRunTo(String(AParams[0].VAnsiString), AParams[1].VInteger);
|
dcStepTo: Result := GDBStepTo(String(AParams[0].VAnsiString), AParams[1].VInteger);
|
||||||
|
dcRunTo: Result := GDBRunTo(String(AParams[0].VAnsiString), AParams[1].VInteger);
|
||||||
dcJumpto: Result := GDBJumpTo(String(AParams[0].VAnsiString), AParams[1].VInteger);
|
dcJumpto: Result := GDBJumpTo(String(AParams[0].VAnsiString), AParams[1].VInteger);
|
||||||
dcAttach: Result := GDBAttach(String(AParams[0].VAnsiString));
|
dcAttach: Result := GDBAttach(String(AParams[0].VAnsiString));
|
||||||
dcDetach: Result := GDBDetach;
|
dcDetach: Result := GDBDetach;
|
||||||
|
Loading…
Reference in New Issue
Block a user