From 4d46bbfd23893e80a362a9cb5bd6b4b52d69af0c Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 22 Jun 2018 19:13:33 +0000 Subject: [PATCH] LLDB Debugger: improve ignoring common error msgs (unknown dwarf) git-svn-id: trunk@58381 - --- .../lazdebuggerlldb/lldbinstructions.pas | 46 ++++++++----------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/components/lazdebuggers/lazdebuggerlldb/lldbinstructions.pas b/components/lazdebuggers/lazdebuggerlldb/lldbinstructions.pas index 30a63f965a..223e40de5b 100644 --- a/components/lazdebuggers/lazdebuggerlldb/lldbinstructions.pas +++ b/components/lazdebuggers/lazdebuggerlldb/lldbinstructions.pas @@ -21,6 +21,7 @@ type TLldbInstructionQueue = class(TDBGInstructionQueue) private protected + function CheckForIgnoredError(const AData: String): Boolean; procedure DoBeforeHandleLineReceived(var ALine: String); override; function GetSelectFrameInstruction(AFrame: Integer): TDBGInstruction; override; @@ -37,7 +38,6 @@ type function GetQueue: TLldbInstructionQueue; protected function ProcessInputFromDbg(const AData: String): Boolean; override; - function CheckForIgnoredError(const AData: String): Boolean; procedure SetContentReceieved; reintroduce; property Queue: TLldbInstructionQueue read GetQueue; @@ -227,12 +227,30 @@ implementation { TLldbInstructionQueue } +function TLldbInstructionQueue.CheckForIgnoredError(const AData: String + ): Boolean; +begin + Result := True; + if StrStartsWith(AData, 'error: ') then begin // ignore dwarf warnings + if StrMatches(AData, ['error', 'unhandled type tag', 'DW_TAG_', '']) then // ignore dwarf warnings + exit; + if StrStartsWith(AData, 'error: need to add support for DW_TAG_') then // ignore dwarf warnings + exit; + end; + Result := False; +end; + procedure TLldbInstructionQueue.DoBeforeHandleLineReceived(var ALine: String); begin while LeftStr(ALine, 7) = '(lldb) ' do begin Delete(ALine, 1, 7); end; + if CheckForIgnoredError(ALine) then begin + ALine := ''; + exit; + end; + inherited DoBeforeHandleLineReceived(ALine); // TODO: detect the echo, and flag if data is for RunningInstruction; @@ -283,26 +301,12 @@ begin Result := False; if LeftStr(AData, 7) = 'error: ' then begin Result := True; - if CheckForIgnoredError(AData) then - exit; HandleError(ifeContentError); exit; end; end; -function TLldbInstruction.CheckForIgnoredError(const AData: String): Boolean; -begin - Result := True; - if StrStartsWith(AData, 'error: ') then begin // ignore dwarf warnings - if StrMatches(AData, ['error', 'unhandled type tag', 'DW_TAG_', '']) then // ignore dwarf warnings - exit; - if StrStartsWith(AData, 'error: need to add support for DW_TAG_') then // ignore dwarf warnings - exit; - end; - Result := False; -end; - procedure TLldbInstruction.SetContentReceieved; begin inherited; @@ -563,9 +567,6 @@ var begin Result := True; - if CheckForIgnoredError(AData) then - exit; - if FRes <> '' then begin FRes := FRes + AData; if ParseStruct(AData) then @@ -612,9 +613,6 @@ begin exit; Result := True; - if CheckForIgnoredError(AData) then - exit; - if StrMatches(AData, ['0x', ': ', ''], found) then begin @@ -681,8 +679,6 @@ begin exit; Result := True; - if CheckForIgnoredError(AData) then - exit; if StrStartsWith(AData, 'General Purpose Registers:') then exit; @@ -764,8 +760,6 @@ begin exit; Result := True; - if CheckForIgnoredError(AData) then - exit; if StrStartsWith(AData, 'Process ') then exit; @@ -821,8 +815,6 @@ begin exit; Result := True; - if CheckForIgnoredError(AData) then - exit; if StrStartsWith(AData, '* thread ') then exit;