Difference between revisions of "TDebuggerIntf"
From Free Pascal wiki
Jump to navigationJump to searchLine 70: | Line 70: | ||
|- | |- | ||
|dcPause | |dcPause | ||
− | | | + | |no parameters |
|- | |- | ||
|dcStop | |dcStop | ||
Line 76: | Line 76: | ||
|- | |- | ||
|dcStepOver | |dcStepOver | ||
− | | | + | |no parameters |
|- | |- | ||
|dcStepInto | |dcStepInto | ||
− | | | + | |no parameters |
|- | |- | ||
|dcStepOut | |dcStepOut | ||
− | | | + | |no parameters |
|- | |- | ||
|dcRunTo | |dcRunTo | ||
− | | | + | |0 - AnsiString - file name of the source code to run to |
+ | |||
+ | 1 - INteger - Line number to run to | ||
|- | |- | ||
|dcJumpto | |dcJumpto |
Revision as of 21:43, 23 October 2017
TDebuggerIntf is the base class of implementing a debugger as Lazarus-IDE plugin package. The package must have DebuggerIntf package as it's requirements. Any debugger plug-in must implement the class and register via RegisterDebugger (called at Register of registering unit).
The class is designed to act as asynchronous object. Thus requested changes are not expected to take effect right after the end of the process (even though this is not forbidden). Any actual change taking place should be reported with an additional method call.
Minimal Implementation
The following methods must be implemented for TDebbugerIntf
- GetSupportedCommands (or GetCommands) - returns the set of formats that a debugger can perform
- RequestCommand - the method actually performing commands. Only commands returned by GetSupportedCommands would be passed to this method
- Caption - the method return user-friendly name of the debugger
type
TMiniDebugger = class(TDebuggerIntf)
protected
function RequestCommand(const ACommand: TDBGCommand; const AParams: array of const): Boolean; override;
function GetSupportedCommands: TDBGCommands; override;
public
class function Caption: String; override;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterDebugger(TMiniDebugger);
end;
class function TMiniDebugger.Caption: String;
begin
Result:='Initial Debugger Plug-in';
end;
function TMiniDebugger.GetSupportedCommands: TDBGCommands;
begin
Result := [dcRun, dcStop];
end;
function TMiniDebugger.RequestCommand(const ACommand: TDBGCommand;
const AParams: array of const): Boolean;
begin
case ACommand of
dcRun: begin // the debugger was requested to run
Result:=true; // typically it should set the state into dsIdle (to get more data from IDE)
SetState(dsRun); // the debugger replies as if it started immediately
end;
dcStop: begin // the debugger was requested to stop
Result:=true;
SetState(dsStop); // the debugger replied as if it stopped immediately
end;
else
Result:=false;
end;
end;
Methods
RequestCommand
The method should return false, if the command cannot be executed.
Debugger Commands
Command | Parameters |
---|---|
dcRun | no parameters |
dcPause | no parameters |
dcStop | no parameters |
dcStepOver | no parameters |
dcStepInto | no parameters |
dcStepOut | no parameters |
dcRunTo | 0 - AnsiString - file name of the source code to run to
1 - INteger - Line number to run to |
dcJumpto | |
dcAttach | |
dcDetach | |
dcBreak | |
dcWatch | |
dcLocal | |
dcEvaluate | |
dcModify | |
dcEnvironment | |
dcSetStackFrame | |
dcDisassemble | |
dcStepOverInstr | |
dcStepIntoInstr | |
dcSendConsoleInput |
Development Hints
- it might be helpful to recompile DebuggerIntf package, adding the following Custom Options to the compiler options of the package
- -dDBG_STATE
- -dDBG_EVENTS
- -dDBG_VERBOSE
- -dDBG_WARNINGS
- -dDBG_DATA_MONITORS
- -dDBG_DISASSEMBLER
- these defines provide more logging output of TDebuggerIntf
- it might be helpful to rebuild IDE adding the following defines into build Options:
- -dVerboseDebugger
- VerboseDebugger logs messages debugging calls from IDE itself