From 7f4d5ecb13511fa75f5b2ae710800cbe2222ac0c Mon Sep 17 00:00:00 2001 From: martin Date: Sat, 23 Feb 2013 14:22:29 +0000 Subject: [PATCH] DBG: refactor TGDBMIDebuggerProperties to have a none publishing base class git-svn-id: trunk@40373 - --- debugger/gdbmidebugger.pp | 66 +++++++++++++++++++------------- debugger/gdbmiserverdebugger.pas | 13 ++++++- debugger/sshgdbmidebugger.pas | 13 ++++++- 3 files changed, 64 insertions(+), 28 deletions(-) diff --git a/debugger/gdbmidebugger.pp b/debugger/gdbmidebugger.pp index c6de5e0609..3198db5630 100644 --- a/debugger/gdbmidebugger.pp +++ b/debugger/gdbmidebugger.pp @@ -120,9 +120,9 @@ type gdsbDefault, gdsbEntry, gdsbMainAddr, gdsbMain, gdsbAddZero ); - { TGDBMIDebuggerProperties } + { TGDBMIDebuggerPropertiesBase } - TGDBMIDebuggerProperties = class(TDebuggerProperties) + TGDBMIDebuggerPropertiesBase = class(TDebuggerProperties) private FEncodeCurrentDirPath: TGDBMIDebuggerFilenameEncoding; FEncodeExeFileName: TGDBMIDebuggerFilenameEncoding; @@ -140,7 +140,7 @@ type public constructor Create; override; procedure Assign(Source: TPersistent); override; - published + public property Debugger_Startup_Options: String read FGDBOptions write FGDBOptions; {$IFDEF UNIX} property ConsoleTty: String read FConsoleTty write FConsoleTty; @@ -156,6 +156,20 @@ type read FInternalStartBreak write FInternalStartBreak default gdsbDefault; end; + TGDBMIDebuggerProperties = class(TGDBMIDebuggerPropertiesBase) + published + property Debugger_Startup_Options; + {$IFDEF UNIX} + property ConsoleTty; + {$ENDIF} + property MaxDisplayLengthForString; + property TimeoutForEval; + property WarnOnTimeOut; + property EncodeCurrentDirPath; + property EncodeExeFileName; + property InternalStartBreak; + end; + TGDBMIDebugger = class; { TGDBMIDebuggerCommand } @@ -207,7 +221,7 @@ type FLastExecCommand: String; FLastExecResult: TGDBMIExecResult; FLogWarnings, FFullCmdReply: String; - function GetDebuggerProperties: TGDBMIDebuggerProperties; + function GetDebuggerProperties: TGDBMIDebuggerPropertiesBase; function GetDebuggerState: TDBGState; function GetTargetInfo: PGDBMITargetInfo; protected @@ -216,7 +230,7 @@ type function ErrorStateMessage: String; virtual; function ErrorStateInfo: String; virtual; property DebuggerState: TDBGState read GetDebuggerState; - property DebuggerProperties: TGDBMIDebuggerProperties read GetDebuggerProperties; + property DebuggerProperties: TGDBMIDebuggerPropertiesBase read GetDebuggerProperties; property TargetInfo: PGDBMITargetInfo read GetTargetInfo; protected procedure SetCommandState(NewState: TGDBMIDebuggerCommandState); @@ -1859,7 +1873,7 @@ end; procedure TGDBMIDebuggerCommandStartBase.CommonInit; begin ExecuteCommand('set print elements %d', - [TGDBMIDebuggerProperties(FTheDebugger.GetProperties).MaxDisplayLengthForString], + [TGDBMIDebuggerPropertiesBase(FTheDebugger.GetProperties).MaxDisplayLengthForString], []); end; @@ -2135,7 +2149,7 @@ begin cgptNone: esc := gdfeNone; cgptCurDir: begin - esc := TGDBMIDebuggerProperties(GetProperties).FEncodeCurrentDirPath; + esc := TGDBMIDebuggerPropertiesBase(GetProperties).FEncodeCurrentDirPath; //TODO: check FGDBOS //Unix/Windows can use gdfeEscSpace, but work without too; if esc = gdfeDefault @@ -2146,7 +2160,7 @@ begin end; cgptExeName: begin - esc := TGDBMIDebuggerProperties(GetProperties).FEncodeExeFileName; + esc := TGDBMIDebuggerPropertiesBase(GetProperties).FEncodeExeFileName; if esc = gdfeDefault then esc := //Unix/Windows can use gdfeEscSpace, but work without too; @@ -6418,10 +6432,10 @@ end; { =========================================================================== } -{ TGDBMIDebuggerProperties } +{ TGDBMIDebuggerPropertiesBase } { =========================================================================== } -procedure TGDBMIDebuggerProperties.SetTimeoutForEval(const AValue: Integer); +procedure TGDBMIDebuggerPropertiesBase.SetTimeoutForEval(const AValue: Integer); begin if FTimeoutForEval = AValue then exit; FTimeoutForEval := AValue; @@ -6429,7 +6443,7 @@ begin then FTimeoutForEval := -1; end; -procedure TGDBMIDebuggerProperties.SetMaxDisplayLengthForString(AValue: Integer); +procedure TGDBMIDebuggerPropertiesBase.SetMaxDisplayLengthForString(AValue: Integer); begin if FMaxDisplayLengthForString = AValue then Exit; if AValue < 0 then @@ -6437,13 +6451,13 @@ begin FMaxDisplayLengthForString := AValue; end; -procedure TGDBMIDebuggerProperties.SetWarnOnTimeOut(const AValue: Boolean); +procedure TGDBMIDebuggerPropertiesBase.SetWarnOnTimeOut(const AValue: Boolean); begin if FWarnOnTimeOut = AValue then exit; FWarnOnTimeOut := AValue; end; -constructor TGDBMIDebuggerProperties.Create; +constructor TGDBMIDebuggerPropertiesBase.Create; begin {$IFDEF UNIX} FConsoleTty := ''; @@ -6461,19 +6475,19 @@ begin inherited; end; -procedure TGDBMIDebuggerProperties.Assign(Source: TPersistent); +procedure TGDBMIDebuggerPropertiesBase.Assign(Source: TPersistent); begin inherited Assign(Source); - FGDBOptions := TGDBMIDebuggerProperties(Source).FGDBOptions; + FGDBOptions := TGDBMIDebuggerPropertiesBase(Source).FGDBOptions; {$IFDEF UNIX} - FConsoleTty := TGDBMIDebuggerProperties(Source).FConsoleTty; + FConsoleTty := TGDBMIDebuggerPropertiesBase(Source).FConsoleTty; {$ENDIF} - FMaxDisplayLengthForString := TGDBMIDebuggerProperties(Source).FMaxDisplayLengthForString; - FTimeoutForEval := TGDBMIDebuggerProperties(Source).FTimeoutForEval; - FWarnOnTimeOut := TGDBMIDebuggerProperties(Source).FWarnOnTimeOut; - FEncodeCurrentDirPath := TGDBMIDebuggerProperties(Source).FEncodeCurrentDirPath; - FEncodeExeFileName := TGDBMIDebuggerProperties(Source).FEncodeExeFileName; - FInternalStartBreak := TGDBMIDebuggerProperties(Source).FInternalStartBreak; + FMaxDisplayLengthForString := TGDBMIDebuggerPropertiesBase(Source).FMaxDisplayLengthForString; + FTimeoutForEval := TGDBMIDebuggerPropertiesBase(Source).FTimeoutForEval; + FWarnOnTimeOut := TGDBMIDebuggerPropertiesBase(Source).FWarnOnTimeOut; + FEncodeCurrentDirPath := TGDBMIDebuggerPropertiesBase(Source).FEncodeCurrentDirPath; + FEncodeExeFileName := TGDBMIDebuggerPropertiesBase(Source).FEncodeExeFileName; + FInternalStartBreak := TGDBMIDebuggerPropertiesBase(Source).FInternalStartBreak; end; @@ -7678,8 +7692,8 @@ begin FNeedStateToIdle := False; Options := '-silent -i mi -nx'; - if Length(TGDBMIDebuggerProperties(GetProperties).Debugger_Startup_Options) > 0 - then Options := Options + ' ' + TGDBMIDebuggerProperties(GetProperties).Debugger_Startup_Options; + if Length(TGDBMIDebuggerPropertiesBase(GetProperties).Debugger_Startup_Options) > 0 + then Options := Options + ' ' + TGDBMIDebuggerPropertiesBase(GetProperties).Debugger_Startup_Options; if CreateDebugProcess(Options) then begin @@ -10225,9 +10239,9 @@ begin Result := FTheDebugger.State; end; -function TGDBMIDebuggerCommand.GetDebuggerProperties: TGDBMIDebuggerProperties; +function TGDBMIDebuggerCommand.GetDebuggerProperties: TGDBMIDebuggerPropertiesBase; begin - Result := TGDBMIDebuggerProperties(FTheDebugger.GetProperties); + Result := TGDBMIDebuggerPropertiesBase(FTheDebugger.GetProperties); end; function TGDBMIDebuggerCommand.GetTargetInfo: PGDBMITargetInfo; diff --git a/debugger/gdbmiserverdebugger.pas b/debugger/gdbmiserverdebugger.pas index 83304513c2..613a06441e 100644 --- a/debugger/gdbmiserverdebugger.pas +++ b/debugger/gdbmiserverdebugger.pas @@ -51,7 +51,7 @@ type { TGDBMIServerDebuggerProperties } - TGDBMIServerDebuggerProperties = class(TGDBMIDebuggerProperties) + TGDBMIServerDebuggerProperties = class(TGDBMIDebuggerPropertiesBase) private FDebugger_Remote_Hostname: string; FDebugger_Remote_Port: string; @@ -61,6 +61,17 @@ type published property Debugger_Remote_Hostname: String read FDebugger_Remote_Hostname write FDebugger_Remote_Hostname; property Debugger_Remote_Port: String read FDebugger_Remote_Port write FDebugger_Remote_Port; + published + property Debugger_Startup_Options; + {$IFDEF UNIX} + property ConsoleTty; + {$ENDIF} + property MaxDisplayLengthForString; + property TimeoutForEval; + property WarnOnTimeOut; + property EncodeCurrentDirPath; + property EncodeExeFileName; + property InternalStartBreak; end; implementation diff --git a/debugger/sshgdbmidebugger.pas b/debugger/sshgdbmidebugger.pas index bb647cd9a6..0dfbd311f3 100644 --- a/debugger/sshgdbmidebugger.pas +++ b/debugger/sshgdbmidebugger.pas @@ -59,7 +59,7 @@ type { TSSHGDBMIDebuggerProperties } - TSSHGDBMIDebuggerProperties = class(TGDBMIDebuggerProperties) + TSSHGDBMIDebuggerProperties = class(TGDBMIDebuggerPropertiesBase) private FAppendGDBtoSSHopt: Boolean; FNote: String; //dummy @@ -73,6 +73,17 @@ type property SSH_Startup_Options: String read FSSHStartupOptions write FSSHStartupOptions; property Remote_GDB_Exe: String read FRemoteGDBExe write FRemoteGDBExe; property Append_GDB_to_SSH_opt: Boolean read FAppendGDBtoSSHopt write FAppendGDBtoSSHopt; + published + property Debugger_Startup_Options; + {$IFDEF UNIX} + property ConsoleTty; + {$ENDIF} + property MaxDisplayLengthForString; + property TimeoutForEval; + property WarnOnTimeOut; + property EncodeCurrentDirPath; + property EncodeExeFileName; + property InternalStartBreak; end; implementation