mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 11:01:20 +02:00
DBG: added internal debugger debug/experiment facility, with DBG_WITH_DEBUGGER_DEBUG
git-svn-id: trunk@28730 -
This commit is contained in:
parent
3f8614f849
commit
0308e84da6
@ -28,6 +28,15 @@
|
|||||||
}
|
}
|
||||||
unit DebugOutputForm;
|
unit DebugOutputForm;
|
||||||
|
|
||||||
|
(* DBG_WITH_DEBUGGER_DEBUG:
|
||||||
|
This enables direct access to the debugger.
|
||||||
|
WARNING:
|
||||||
|
- This bypasses some of the internals of the debugger.
|
||||||
|
- It does intentionally no check or validation
|
||||||
|
- Using this feature without full knowledge of all internals of the debugger,
|
||||||
|
can *HANG* or *CRASH* the debugger or the entire IDE.
|
||||||
|
*)
|
||||||
|
|
||||||
{$mode objfpc}
|
{$mode objfpc}
|
||||||
{$H+}
|
{$H+}
|
||||||
|
|
||||||
@ -35,7 +44,11 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, Graphics, Controls, Forms, Dialogs, Clipbrd,
|
Classes, Graphics, Controls, Forms, Dialogs, Clipbrd,
|
||||||
Buttons, StdCtrls, Menus, DebuggerDlg;
|
Buttons, StdCtrls, Menus, ExtCtrls, DebuggerDlg
|
||||||
|
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||||
|
, BaseDebugManager, GDBMIDebugger, CmdLineDebugger
|
||||||
|
{$ENDIF}
|
||||||
|
;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -51,9 +64,16 @@ type
|
|||||||
procedure popClearClick(Sender: TObject);
|
procedure popClearClick(Sender: TObject);
|
||||||
procedure popCopyAllClick(Sender: TObject);
|
procedure popCopyAllClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
|
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||||
|
Edit1: TEdit;
|
||||||
|
procedure Button1Click(Sender: TObject);
|
||||||
|
{$ENDIF}
|
||||||
protected
|
protected
|
||||||
procedure Loaded; override;
|
procedure Loaded; override;
|
||||||
public
|
public
|
||||||
|
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||||
|
constructor Create(TheOwner: TComponent); override;
|
||||||
|
{$ENDIF}
|
||||||
procedure AddText(const AText: String);
|
procedure AddText(const AText: String);
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
procedure SetLogText(Lines: TStrings);
|
procedure SetLogText(Lines: TStrings);
|
||||||
@ -87,12 +107,46 @@ begin
|
|||||||
Lines.Assign(txtOutput.Lines);
|
Lines.Assign(txtOutput.Lines);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||||
|
constructor TDbgOutputForm.Create(TheOwner: TComponent);
|
||||||
|
var
|
||||||
|
p: TPanel;
|
||||||
|
b: TButton;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
p := TPanel.Create(Self);
|
||||||
|
p.Parent := Self;
|
||||||
|
p.Align := alBottom;
|
||||||
|
p.AutoSize := True;
|
||||||
|
p.Caption := '';
|
||||||
|
Edit1 := TEdit.Create(Self);
|
||||||
|
Edit1.Parent := p;
|
||||||
|
Edit1.Align := alClient;
|
||||||
|
b := TButton.Create(Self);
|
||||||
|
b.Parent := p;
|
||||||
|
b.Align := alRight;
|
||||||
|
b.OnClick := @Button1Click;
|
||||||
|
b.Caption := 'Execute';
|
||||||
|
b.AutoSize := True;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
procedure TDbgOutputForm.FormClose(Sender: TObject;
|
procedure TDbgOutputForm.FormClose(Sender: TObject;
|
||||||
var CloseAction: TCloseAction);
|
var CloseAction: TCloseAction);
|
||||||
begin
|
begin
|
||||||
CloseAction := caFree;
|
CloseAction := caFree;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||||
|
procedure TDbgOutputForm.Button1Click(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if DebugBoss.Debugger is TCmdLineDebugger then begin
|
||||||
|
TCmdLineDebugger(DebugBoss.Debugger).TestCmd(Edit1.Text);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
procedure TDbgOutputForm.FormCreate(Sender: TObject);
|
procedure TDbgOutputForm.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
txtOutput.Lines.Clear;
|
txtOutput.Lines.Clear;
|
||||||
|
@ -95,6 +95,9 @@ type
|
|||||||
function FindDebuggerClass(const Astring: String): TDebuggerClass;
|
function FindDebuggerClass(const Astring: String): TDebuggerClass;
|
||||||
function GetState: TDBGState; virtual; abstract;
|
function GetState: TDBGState; virtual; abstract;
|
||||||
function GetCommands: TDBGCommands; virtual; abstract;
|
function GetCommands: TDBGCommands; virtual; abstract;
|
||||||
|
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||||
|
function GetDebugger: TDebugger; virtual; abstract;
|
||||||
|
{$ENDIF}
|
||||||
public
|
public
|
||||||
procedure Reset; virtual; abstract;
|
procedure Reset; virtual; abstract;
|
||||||
|
|
||||||
@ -170,6 +173,9 @@ type
|
|||||||
property Registers: TIDERegisters read FRegisters;
|
property Registers: TIDERegisters read FRegisters;
|
||||||
property Signals: TIDESignals read FSignals; // A list of actions for signals we know of
|
property Signals: TIDESignals read FSignals; // A list of actions for signals we know of
|
||||||
property Watches: TIDEWatches read FWatches;
|
property Watches: TIDEWatches read FWatches;
|
||||||
|
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||||
|
property Debugger: TDebugger read GetDebugger;
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure RegisterDebugger(const ADebuggerClass: TDebuggerClass);
|
procedure RegisterDebugger(const ADebuggerClass: TDebuggerClass);
|
||||||
|
@ -137,6 +137,9 @@ type
|
|||||||
function GetState: TDBGState; override;
|
function GetState: TDBGState; override;
|
||||||
function GetCommands: TDBGCommands; override;
|
function GetCommands: TDBGCommands; override;
|
||||||
function GetDebuggerClass: TDebuggerClass;
|
function GetDebuggerClass: TDebuggerClass;
|
||||||
|
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||||
|
function GetDebugger: TDebugger; override;
|
||||||
|
{$ENDIF}
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -3034,6 +3037,13 @@ begin
|
|||||||
Result := TProcessDebugger;
|
Result := TProcessDebugger;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||||
|
function TDebugManager.GetDebugger: TDebugger;
|
||||||
|
begin
|
||||||
|
Result := FDebugger;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
function TDebugManager.ShowBreakPointProperties(const ABreakpoint: TIDEBreakPoint): TModalresult;
|
function TDebugManager.ShowBreakPointProperties(const ABreakpoint: TIDEBreakPoint): TModalresult;
|
||||||
begin
|
begin
|
||||||
Result := TBreakPropertyDlg.Create(Self, ABreakpoint).ShowModal;
|
Result := TBreakPropertyDlg.Create(Self, ABreakpoint).ShowModal;
|
||||||
|
Loading…
Reference in New Issue
Block a user