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

View File

@ -56,12 +56,14 @@ type
private
FDebugger_Remote_Hostname: string;
FDebugger_Remote_Port: string;
FDebugger_Remote_DownloadExe: boolean;
public
constructor Create; override;
procedure Assign(Source: TPersistent); override;
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;
property Debugger_Remote_DownloadExe: boolean read FDebugger_Remote_DownloadExe write FDebugger_Remote_DownloadExe;
published
property Debugger_Startup_Options;
{$IFDEF UNIX}
@ -109,6 +111,7 @@ type
protected
function GdbRunCommand: String; override;
procedure DetectTargetPid(InAttach: Boolean = False); override;
function DoTargetDownload: boolean; override;
end;
{ TGDBMIServerDebuggerCommandStartDebugging }
@ -123,6 +126,18 @@ begin
// do nothing // prevent dsError in inherited
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 }
function TGDBMIServerDebuggerCommandInitDebugger.DoExecute: Boolean;
@ -154,6 +169,7 @@ begin
inherited Create;
FDebugger_Remote_Hostname:= '';
FDebugger_Remote_Port:= '2345';
FDebugger_Remote_DownloadExe := False;
UseAsyncCommandMode := True;
end;
@ -163,6 +179,7 @@ begin
if Source is TGDBMIServerDebuggerProperties then begin
FDebugger_Remote_Hostname := TGDBMIServerDebuggerProperties(Source).FDebugger_Remote_Hostname;
FDebugger_Remote_Port := TGDBMIServerDebuggerProperties(Source).FDebugger_Remote_Port;
FDebugger_Remote_DownloadExe := TGDBMIServerDebuggerProperties(Source).FDebugger_Remote_DownloadExe;
UseAsyncCommandMode := True;
end;
end;

View File

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