LldbDebugger: Detect if the external exe is wrongly set to gdb.

git-svn-id: trunk@60599 -
This commit is contained in:
martin 2019-03-06 17:41:05 +00:00
parent c81de7635a
commit 8b7014dbb0

View File

@ -94,8 +94,11 @@ type
{ TLldbDebuggerCommandInit } { TLldbDebuggerCommandInit }
TLldbDebuggerCommandInit = class(TLldbDebuggerCommand) TLldbDebuggerCommandInit = class(TLldbDebuggerCommand)
private
FGotLLDB: Boolean;
protected protected
procedure DoExecute; override; procedure DoExecute; override;
procedure DoLineDataReceived(var ALine: String); override;
end; end;
{ TLldbDebuggerCommandRun } { TLldbDebuggerCommandRun }
@ -265,11 +268,13 @@ type
TLldbDebuggerProperties = class(TDebuggerProperties) TLldbDebuggerProperties = class(TDebuggerProperties)
private private
FLaunchNewTerminal: Boolean; FLaunchNewTerminal: Boolean;
FSkipGDBDetection: Boolean;
public public
constructor Create; override; constructor Create; override;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
published published
property LaunchNewTerminal: Boolean read FLaunchNewTerminal write FLaunchNewTerminal default False; property LaunchNewTerminal: Boolean read FLaunchNewTerminal write FLaunchNewTerminal default False;
property SkipGDBDetection: Boolean read FSkipGDBDetection write FSkipGDBDetection default False;
end; end;
TLldbDebugger = class(TDebuggerIntf) TLldbDebugger = class(TDebuggerIntf)
@ -317,6 +322,7 @@ type
procedure QueueCommand(const ACommand: TLldbDebuggerCommand); procedure QueueCommand(const ACommand: TLldbDebuggerCommand);
//procedure DoState(const OldState: TDBGState); override; //procedure DoState(const OldState: TDBGState); override;
//procedure DoBeforeState(const OldState: TDBGState); override; //procedure DoBeforeState(const OldState: TDBGState); override;
procedure SetErrorState(const AMsg: String; const AInfo: String = '');
function DoExceptionHit(AExcClass, AExcMsg: String): Boolean; function DoExceptionHit(AExcClass, AExcMsg: String): Boolean;
function DoBreakpointHit(BrkId: Integer): Boolean; function DoBreakpointHit(BrkId: Integer): Boolean;
@ -525,12 +531,14 @@ constructor TLldbDebuggerProperties.Create;
begin begin
inherited Create; inherited Create;
FLaunchNewTerminal := False; FLaunchNewTerminal := False;
FSkipGDBDetection := False;
end; end;
procedure TLldbDebuggerProperties.Assign(Source: TPersistent); procedure TLldbDebuggerProperties.Assign(Source: TPersistent);
begin begin
inherited Assign(Source); inherited Assign(Source);
FLaunchNewTerminal := TLldbDebuggerProperties(Source).FLaunchNewTerminal; FLaunchNewTerminal := TLldbDebuggerProperties(Source).FLaunchNewTerminal;
FSkipGDBDetection := TLldbDebuggerProperties(Source).FSkipGDBDetection;
end; end;
{ TLldbDebuggerCommandRun } { TLldbDebuggerCommandRun }
@ -2216,6 +2224,21 @@ begin
Instr.ReleaseReference; Instr.ReleaseReference;
end; end;
procedure TLldbDebuggerCommandInit.DoLineDataReceived(var ALine: String);
begin
inherited DoLineDataReceived(ALine);
if FGotLLDB then
exit;
if TLldbDebuggerProperties(Debugger.GetProperties).SkipGDBDetection then
FGotLLDB := True
else
if StrContains(UpperCase(ALine), 'LLDB') then
FGotLLDB := True
else
if StrContains(UpperCase(ALine), '(GDB)') then
Debugger.SetErrorState('GDB detected', 'The external debugger identified itself as GDB. The IDE expected LLDB.');
end;
{ TLldbDebuggerCommandRunStep } { TLldbDebuggerCommandRunStep }
procedure TLldbDebuggerCommandRunStep.DoInitialExecute; procedure TLldbDebuggerCommandRunStep.DoInitialExecute;
@ -2735,6 +2758,11 @@ begin
FCommandQueue.QueueCommand(ACommand); FCommandQueue.QueueCommand(ACommand);
end; end;
procedure TLldbDebugger.SetErrorState(const AMsg: String; const AInfo: String);
begin
inherited SetErrorState(AMsg, AInfo);
end;
function TLldbDebugger.DoExceptionHit(AExcClass, AExcMsg: String): Boolean; function TLldbDebugger.DoExceptionHit(AExcClass, AExcMsg: String): Boolean;
begin begin
if Assigned(EventLogHandler) then if Assigned(EventLogHandler) then