mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-31 11:20:17 +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;
|
||||
|
||||
(* 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}
|
||||
{$H+}
|
||||
|
||||
@ -35,7 +44,11 @@ interface
|
||||
|
||||
uses
|
||||
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
|
||||
|
||||
@ -51,9 +64,16 @@ type
|
||||
procedure popClearClick(Sender: TObject);
|
||||
procedure popCopyAllClick(Sender: TObject);
|
||||
private
|
||||
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||
Edit1: TEdit;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
{$ENDIF}
|
||||
protected
|
||||
procedure Loaded; override;
|
||||
public
|
||||
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
{$ENDIF}
|
||||
procedure AddText(const AText: String);
|
||||
procedure Clear;
|
||||
procedure SetLogText(Lines: TStrings);
|
||||
@ -87,12 +107,46 @@ begin
|
||||
Lines.Assign(txtOutput.Lines);
|
||||
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;
|
||||
var CloseAction: TCloseAction);
|
||||
begin
|
||||
CloseAction := caFree;
|
||||
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);
|
||||
begin
|
||||
txtOutput.Lines.Clear;
|
||||
|
@ -95,6 +95,9 @@ type
|
||||
function FindDebuggerClass(const Astring: String): TDebuggerClass;
|
||||
function GetState: TDBGState; virtual; abstract;
|
||||
function GetCommands: TDBGCommands; virtual; abstract;
|
||||
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||
function GetDebugger: TDebugger; virtual; abstract;
|
||||
{$ENDIF}
|
||||
public
|
||||
procedure Reset; virtual; abstract;
|
||||
|
||||
@ -170,6 +173,9 @@ type
|
||||
property Registers: TIDERegisters read FRegisters;
|
||||
property Signals: TIDESignals read FSignals; // A list of actions for signals we know of
|
||||
property Watches: TIDEWatches read FWatches;
|
||||
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||
property Debugger: TDebugger read GetDebugger;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure RegisterDebugger(const ADebuggerClass: TDebuggerClass);
|
||||
|
@ -137,6 +137,9 @@ type
|
||||
function GetState: TDBGState; override;
|
||||
function GetCommands: TDBGCommands; override;
|
||||
function GetDebuggerClass: TDebuggerClass;
|
||||
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||
function GetDebugger: TDebugger; override;
|
||||
{$ENDIF}
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -3034,6 +3037,13 @@ begin
|
||||
Result := TProcessDebugger;
|
||||
end;
|
||||
|
||||
{$IFDEF DBG_WITH_DEBUGGER_DEBUG}
|
||||
function TDebugManager.GetDebugger: TDebugger;
|
||||
begin
|
||||
Result := FDebugger;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function TDebugManager.ShowBreakPointProperties(const ABreakpoint: TIDEBreakPoint): TModalresult;
|
||||
begin
|
||||
Result := TBreakPropertyDlg.Create(Self, ABreakpoint).ShowModal;
|
||||
|
Loading…
Reference in New Issue
Block a user