diff --git a/debugger/debugoutputform.pp b/debugger/debugoutputform.pp index ec06a4d863..1c60bda31b 100644 --- a/debugger/debugoutputform.pp +++ b/debugger/debugoutputform.pp @@ -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; diff --git a/ide/basedebugmanager.pas b/ide/basedebugmanager.pas index d8fce777b5..70f87aa91d 100644 --- a/ide/basedebugmanager.pas +++ b/ide/basedebugmanager.pas @@ -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); diff --git a/ide/debugmanager.pas b/ide/debugmanager.pas index 7f70f01853..4dd4cae125 100644 --- a/ide/debugmanager.pas +++ b/ide/debugmanager.pas @@ -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;