DBG: added configurable tty for console app

git-svn-id: trunk@29002 -
This commit is contained in:
martin 2011-01-13 19:32:42 +00:00
parent 19eb382b75
commit b1e8f8b9e9

View File

@ -45,7 +45,7 @@ uses
Windows, Windows,
{$ENDIF} {$ENDIF}
{$IFDEF UNIX} {$IFDEF UNIX}
Unix,BaseUnix, Unix,BaseUnix,termio,
{$ENDIF} {$ENDIF}
BaseDebugManager; BaseDebugManager;
@ -115,6 +115,9 @@ type
TGDBMIDebuggerProperties = class(TDebuggerProperties) TGDBMIDebuggerProperties = class(TDebuggerProperties)
private private
{$IFDEF UNIX}
FConsoleTty: String;
{$ENDIF}
FGDBOptions: String; FGDBOptions: String;
FOverrideRTLCallingConvention: TGDBMIRTLCallingConvention; FOverrideRTLCallingConvention: TGDBMIRTLCallingConvention;
public public
@ -123,6 +126,9 @@ type
published published
property OverrideRTLCallingConvention: TGDBMIRTLCallingConvention read FOverrideRTLCallingConvention write FOverrideRTLCallingConvention; property OverrideRTLCallingConvention: TGDBMIRTLCallingConvention read FOverrideRTLCallingConvention write FOverrideRTLCallingConvention;
property Debugger_Startup_Options: String read FGDBOptions write FGDBOptions; property Debugger_Startup_Options: String read FGDBOptions write FGDBOptions;
{$IFDEF UNIX}
property ConsoleTty: String read FConsoleTty write FConsoleTty;
{$ENDIF}
end; end;
TGDBMIDebugger = class; TGDBMIDebugger = class;
@ -2926,11 +2932,15 @@ function TGDBMIDebuggerCommandStartDebugging.DoExecute: Boolean;
var var
R: TGDBMIExecResult; R: TGDBMIExecResult;
s: String;
FileType, EntryPoint: String; FileType, EntryPoint: String;
List: TGDBMINameValueList; List: TGDBMINameValueList;
TargetPIDPart: String; TargetPIDPart: String;
TempInstalled, CanContinue: Boolean; TempInstalled, CanContinue: Boolean;
CommandObj: TGDBMIDebuggerCommandExecute; CommandObj: TGDBMIDebuggerCommandExecute;
{$IFDEF UNIX}
h: THandle;
{$ENDIF}
begin begin
Result := True; Result := True;
FSuccess := False; FSuccess := False;
@ -2965,6 +2975,17 @@ begin
// set the output width to a great value to avoid unexpected // set the output width to a great value to avoid unexpected
// new lines like in large functions or procedures // new lines like in large functions or procedures
ExecuteCommand('set width 50000', []); ExecuteCommand('set width 50000', []);
{$IFDEF UNIX}
// Make sure consule output will ot be mixed with gbd output
s := TGDBMIDebuggerProperties(FTheDebugger.GetProperties).ConsoleTty;
if s = '' then s := '/dev/null';
h := fileopen(S, fmOpenWrite);
if (IsATTY(h) <> 1)
or (not ExecuteCommand('set inferior-tty %s', [s], R)) or (r.State = dsError)
then
ExecuteCommand('set inferior-tty /dev/null', []);
FileClose(h);
{$ENDIF}
if tfHasSymbols in TargetInfo^.TargetFlags if tfHasSymbols in TargetInfo^.TargetFlags
then begin then begin
@ -4459,6 +4480,9 @@ end;
constructor TGDBMIDebuggerProperties.Create; constructor TGDBMIDebuggerProperties.Create;
begin begin
FOverrideRTLCallingConvention := ccDefault; FOverrideRTLCallingConvention := ccDefault;
{$IFDEF UNIX}
FConsoleTty := '/dev/null';
{$ENDIF}
inherited; inherited;
end; end;
@ -4467,6 +4491,9 @@ begin
inherited Assign(Source); inherited Assign(Source);
FGDBOptions := TGDBMIDebuggerProperties(Source).FGDBOptions; FGDBOptions := TGDBMIDebuggerProperties(Source).FGDBOptions;
FOverrideRTLCallingConvention := TGDBMIDebuggerProperties(Source).FOverrideRTLCallingConvention; FOverrideRTLCallingConvention := TGDBMIDebuggerProperties(Source).FOverrideRTLCallingConvention;
{$IFDEF UNIX}
FConsoleTty := TGDBMIDebuggerProperties(Source).FConsoleTty;
{$ENDIF}
end; end;