GDBMI Debugger Server: add optional support for -target-download if supported by gdb. issue #0033868 Patch by Christo Crause

git-svn-id: trunk@58288 -
This commit is contained in:
martin 2018-06-16 12:35:09 +00:00
parent 99abd92c54
commit e0b05d3b6b
3 changed files with 30 additions and 0 deletions

View File

@ -576,6 +576,7 @@ type
protected protected
function DoExecute: Boolean; override; function DoExecute: Boolean; override;
function GdbRunCommand: String; virtual; function GdbRunCommand: String; virtual;
function DoTargetDownload: boolean; virtual;
public public
constructor Create(AOwner: TGDBMIDebugger; AContinueCommand: TGDBMIDebuggerCommand); constructor Create(AOwner: TGDBMIDebugger; AContinueCommand: TGDBMIDebuggerCommand);
destructor Destroy; override; destructor Destroy; override;
@ -5133,6 +5134,12 @@ begin
SetDebuggerErrorState(synfFailedToLoadApplicationExecutable, FErrorMsg); SetDebuggerErrorState(synfFailedToLoadApplicationExecutable, FErrorMsg);
exit; exit;
end; end;
if not DoTargetDownload then begin
SetDebuggerErrorState(synfFailedToDownloadApplicationExecutable, FErrorMsg);
exit;
end;
if not DoSetPascal then begin if not DoSetPascal then begin
SetDebuggerErrorState(synfFailedToInitializeTheDebuggerSetPascalFailed, SetDebuggerErrorState(synfFailedToInitializeTheDebuggerSetPascalFailed,
FLastExecResult.Values); FLastExecResult.Values);
@ -5317,6 +5324,11 @@ begin
Result := '-exec-run'; Result := '-exec-run';
end; end;
function TGDBMIDebuggerCommandStartDebugging.DoTargetDownload: boolean;
begin
result := true;
end;
constructor TGDBMIDebuggerCommandStartDebugging.Create(AOwner: TGDBMIDebugger; constructor TGDBMIDebuggerCommandStartDebugging.Create(AOwner: TGDBMIDebugger;
AContinueCommand: TGDBMIDebuggerCommand); AContinueCommand: TGDBMIDebuggerCommand);
begin begin

View File

@ -56,12 +56,14 @@ type
private private
FDebugger_Remote_Hostname: string; FDebugger_Remote_Hostname: string;
FDebugger_Remote_Port: string; FDebugger_Remote_Port: string;
FDebugger_Remote_DownloadExe: boolean;
public public
constructor Create; override; constructor Create; override;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
published published
property Debugger_Remote_Hostname: String read FDebugger_Remote_Hostname write FDebugger_Remote_Hostname; 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; property Debugger_Remote_Port: String read FDebugger_Remote_Port write FDebugger_Remote_Port;
property Debugger_Remote_DownloadExe: boolean read FDebugger_Remote_DownloadExe write FDebugger_Remote_DownloadExe;
published published
property Debugger_Startup_Options; property Debugger_Startup_Options;
{$IFDEF UNIX} {$IFDEF UNIX}
@ -109,6 +111,7 @@ type
protected protected
function GdbRunCommand: String; override; function GdbRunCommand: String; override;
procedure DetectTargetPid(InAttach: Boolean = False); override; procedure DetectTargetPid(InAttach: Boolean = False); override;
function DoTargetDownload: boolean; override;
end; end;
{ TGDBMIServerDebuggerCommandStartDebugging } { TGDBMIServerDebuggerCommandStartDebugging }
@ -123,6 +126,18 @@ begin
// do nothing // prevent dsError in inherited // do nothing // prevent dsError in inherited
end; end;
function TGDBMIServerDebuggerCommandStartDebugging.DoTargetDownload: boolean;
begin
Result := True;
if TGDBMIServerDebuggerProperties(DebuggerProperties).FDebugger_Remote_DownloadExe then
begin
// Called after -file-exec-and-symbols, so gdb knows what file to download
// If call sequence is different, then supply binary file name below as parameter
Result := ExecuteCommand('-target-download', [], [cfCheckError]);
Result := Result and (DebuggerState <> dsError);
end;
end;
{ TGDBMIServerDebuggerCommandInitDebugger } { TGDBMIServerDebuggerCommandInitDebugger }
function TGDBMIServerDebuggerCommandInitDebugger.DoExecute: Boolean; function TGDBMIServerDebuggerCommandInitDebugger.DoExecute: Boolean;
@ -154,6 +169,7 @@ begin
inherited Create; inherited Create;
FDebugger_Remote_Hostname:= ''; FDebugger_Remote_Hostname:= '';
FDebugger_Remote_Port:= '2345'; FDebugger_Remote_Port:= '2345';
FDebugger_Remote_DownloadExe := False;
UseAsyncCommandMode := True; UseAsyncCommandMode := True;
end; end;
@ -163,6 +179,7 @@ begin
if Source is TGDBMIServerDebuggerProperties then begin if Source is TGDBMIServerDebuggerProperties then begin
FDebugger_Remote_Hostname := TGDBMIServerDebuggerProperties(Source).FDebugger_Remote_Hostname; FDebugger_Remote_Hostname := TGDBMIServerDebuggerProperties(Source).FDebugger_Remote_Hostname;
FDebugger_Remote_Port := TGDBMIServerDebuggerProperties(Source).FDebugger_Remote_Port; FDebugger_Remote_Port := TGDBMIServerDebuggerProperties(Source).FDebugger_Remote_Port;
FDebugger_Remote_DownloadExe := TGDBMIServerDebuggerProperties(Source).FDebugger_Remote_DownloadExe;
UseAsyncCommandMode := True; UseAsyncCommandMode := True;
end; end;
end; end;

View File

@ -40,6 +40,7 @@ Chris Rorden
Christian Budde Christian Budde
Christian Iversen Christian Iversen
Christian Ulrich Christian Ulrich
Christo Crause
Christopher Kirkpatrick Christopher Kirkpatrick
Cliff Baeseman Cliff Baeseman
Colin Western Colin Western