diff --git a/components/lazdebuggergdbmi/gdbmidebugger.pp b/components/lazdebuggergdbmi/gdbmidebugger.pp index 8f415e7307..6f6be4dfc4 100644 --- a/components/lazdebuggergdbmi/gdbmidebugger.pp +++ b/components/lazdebuggergdbmi/gdbmidebugger.pp @@ -532,7 +532,8 @@ type TGDBMIDebuggerChangeFilenameBase = class(TGDBMIDebuggerCommand) protected FErrorMsg: String; - function DoChangeFilename: Boolean; + procedure DoResetInternalBreaks; virtual; + function DoChangeFilename: Boolean; virtual; function DoSetPascal: Boolean; function DoSetCaseSensitivity: Boolean; function DoSetMaxValueMemLimit: Boolean; @@ -2008,13 +2009,8 @@ end; { TGDBMIDebuggerChangeFilenameBase } -function TGDBMIDebuggerChangeFilenameBase.DoChangeFilename: Boolean; -var - R: TGDBMIExecResult; - List: TGDBMINameValueList; - S, FileName: String; +procedure TGDBMIDebuggerChangeFilenameBase.DoResetInternalBreaks; begin - Result := False; FContext.ThreadContext := ccNotRequired; FContext.StackContext := ccNotRequired; @@ -2028,6 +2024,17 @@ begin FTheDebugger.FRtlUnwindExBreak.Clear(Self); FTheDebugger.FSehRaiseBreaks.ClearAll(Self); if DebuggerState = dsError then Exit; +end; + +function TGDBMIDebuggerChangeFilenameBase.DoChangeFilename: Boolean; +var + R: TGDBMIExecResult; + List: TGDBMINameValueList; + S, FileName: String; +begin + Result := False; + FContext.ThreadContext := ccNotRequired; + FContext.StackContext := ccNotRequired; FileName := FTheDebugger.FileName; S := FTheDebugger.ConvertToGDBPath(FileName, cgptExeName); @@ -3173,6 +3180,7 @@ end; function TGDBMIDebuggerCommandChangeFilename.DoExecute: Boolean; begin Result := True; + DoResetInternalBreaks; FSuccess := DoChangeFilename; end; @@ -5293,6 +5301,7 @@ begin Exit; end; + DoResetInternalBreaks; if not DoChangeFilename then begin SetDebuggerErrorState(synfFailedToLoadApplicationExecutable, FErrorMsg); exit; diff --git a/components/lazdebuggergdbmi/gdbmiserverdebugger.pas b/components/lazdebuggergdbmi/gdbmiserverdebugger.pas index fd513b8f84..5feab2ce82 100644 --- a/components/lazdebuggergdbmi/gdbmiserverdebugger.pas +++ b/components/lazdebuggergdbmi/gdbmiserverdebugger.pas @@ -63,6 +63,7 @@ type FDebugger_Remote_Port: string; FDebugger_Remote_DownloadExe: boolean; FRemoteTimeout: integer; + FSkipSettingLocalExeName: Boolean; public constructor Create; override; procedure Assign(Source: TPersistent); override; @@ -72,6 +73,7 @@ type property Debugger_Remote_DownloadExe: boolean read FDebugger_Remote_DownloadExe write FDebugger_Remote_DownloadExe; property RemoteTimeout: integer read FRemoteTimeout write FRemoteTimeout default -1; property Architecture: string read FArchitecture write FArchitecture; + property SkipSettingLocalExeName: Boolean read FSkipSettingLocalExeName write FSkipSettingLocalExeName default False; published property Debugger_Startup_Options; {$IFDEF UNIX} @@ -122,6 +124,7 @@ type function GdbRunCommand: String; override; procedure DetectTargetPid(InAttach: Boolean = False); override; function DoTargetDownload: boolean; override; + function DoChangeFilename: Boolean; override; end; { TGDBMIServerDebuggerCommandStartDebugging } @@ -148,6 +151,13 @@ begin end; end; +function TGDBMIServerDebuggerCommandStartDebugging.DoChangeFilename: Boolean; +begin + Result := True; + if not TGDBMIServerDebuggerProperties(DebuggerProperties).SkipSettingLocalExeName then + Result := inherited DoChangeFilename; +end; + { TGDBMIServerDebuggerCommandInitDebugger } function TGDBMIServerDebuggerCommandInitDebugger.DoExecute: Boolean; @@ -192,6 +202,7 @@ begin FDebugger_Remote_DownloadExe := False; FRemoteTimeout := -1; FArchitecture := ''; + FSkipSettingLocalExeName := False; UseAsyncCommandMode := True; end; @@ -204,6 +215,7 @@ begin FDebugger_Remote_DownloadExe := TGDBMIServerDebuggerProperties(Source).FDebugger_Remote_DownloadExe; FRemoteTimeout := TGDBMIServerDebuggerProperties(Source).FRemoteTimeout; FArchitecture := TGDBMIServerDebuggerProperties(Source).FArchitecture; + FSkipSettingLocalExeName := TGDBMIServerDebuggerProperties(Source).FSkipSettingLocalExeName; UseAsyncCommandMode := True; end; end;