From 8b81b7cfd30567f4bf365250cd3f4c6f41bab3b8 Mon Sep 17 00:00:00 2001 From: martin Date: Sat, 13 Feb 2021 14:30:50 +0000 Subject: [PATCH] Debugger: Revert recent upper/lowercase changes git-svn-id: trunk@64570 - --- .../debuggerintf/dbgintfdebuggerbase.pp | 12 +++++------ .../lazdebuggerfpgdbmi/fpgdbmidebugger.pp | 21 ++++++++----------- .../lazdebuggerfplldb/fplldbdebugger.pas | 20 +++++++----------- .../lazdebuggerlldb/lldbdebugger.pas | 4 ++-- .../lazdebuggerlldb/lldbhelper.pas | 9 ++++---- .../lazdebuggerlldb/lldbinstructions.pas | 10 ++++----- .../lazdebugtestbase/testcommonsources.pas | 17 +++++++-------- .../testdbgcompilerprocess.pas | 3 ++- .../lazdebugtestbase/testdbgtestsuites.pas | 2 +- .../lazdebugtestbase/ttestwatchutilities.pas | 11 ++++------ 10 files changed, 48 insertions(+), 61 deletions(-) diff --git a/components/debuggerintf/dbgintfdebuggerbase.pp b/components/debuggerintf/dbgintfdebuggerbase.pp index 62be341037..064aa72292 100644 --- a/components/debuggerintf/dbgintfdebuggerbase.pp +++ b/components/debuggerintf/dbgintfdebuggerbase.pp @@ -48,7 +48,7 @@ uses // LCL LCLProc, // LazUtils - LazClasses, LazLoggerBase, LazFileUtils, LazStringUtils, Maps, LazMethodList, LazUTF8, + LazClasses, LazLoggerBase, LazFileUtils, LazStringUtils, Maps, LazMethodList, // DebuggerIntf DbgIntfBaseTypes, DbgIntfMiscClasses, DbgIntfPseudoTerminal, DbgIntfCommonStrings; @@ -6068,12 +6068,12 @@ procedure TDebuggerIntf.EnvironmentChanged(Sender: TObject); var n, idx: integer; S: String; - Env: TStringListUTF8Fast; + Env: TStringList; begin // Createe local copy if FState <> dsNone then begin - Env := TStringListUTF8Fast.Create; + Env := TStringList.Create; try Env.Assign(Environment); @@ -6230,7 +6230,7 @@ var idx: Integer; begin if MDebuggerPropertiesList = nil - then MDebuggerPropertiesList := TStringListUTF8Fast.Create; + then MDebuggerPropertiesList := TStringList.Create; idx := MDebuggerPropertiesList.IndexOf(ClassName); if idx = -1 then begin @@ -6534,7 +6534,7 @@ constructor TBaseDebugManagerIntf.Create(AOwner: TComponent); begin inherited Create(AOwner); - FValueFormatterList := TStringListUTF8Fast.Create; + FValueFormatterList := TStringList.Create; FValueFormatterList.Sorted := True; FValueFormatterList.Duplicates := dupError; end; @@ -6629,7 +6629,7 @@ initialization DBG_DATA_MONITORS := DebugLogger.FindOrRegisterLogGroup('DBG_DATA_MONITORS' {$IFDEF DBG_DATA_MONITORS} , True {$ENDIF} ); DBG_DISASSEMBLER := DebugLogger.FindOrRegisterLogGroup('DBG_DISASSEMBLER' {$IFDEF DBG_DISASSEMBLER} , True {$ENDIF} ); - MDebuggerClasses := TStringListUTF8Fast.Create; + MDebuggerClasses := TStringList.Create; MDebuggerClasses.Sorted := True; MDebuggerClasses.Duplicates := dupError; diff --git a/components/lazdebuggers/lazdebuggerfpgdbmi/fpgdbmidebugger.pp b/components/lazdebuggers/lazdebuggerfpgdbmi/fpgdbmidebugger.pp index 2d281fc7e2..a0a6f8c29f 100644 --- a/components/lazdebuggers/lazdebuggerfpgdbmi/fpgdbmidebugger.pp +++ b/components/lazdebuggers/lazdebuggerfpgdbmi/fpgdbmidebugger.pp @@ -12,15 +12,12 @@ uses {$IFdef WithWinMemReader} windows, {$ENDIF} - Classes, sysutils, math, - Forms, - LazUTF8, LazLoggerBase, LazClasses, - MenuIntf, - DbgIntfBaseTypes, DbgIntfDebuggerBase, - GDBMIDebugger, GDBMIMiscClasses, GDBTypeInfo, - // FpDebug - FpDbgInfo, FpDbgLoader, FpDbgDwarf, FpPascalParser, FpPascalBuilder, - FpdMemoryTools, FpErrorMessages, FpDbgDwarfDataClasses, FpDbgCommon; + Classes, sysutils, math, FpdMemoryTools, FpDbgInfo, FpDbgClasses, + GDBMIDebugger, DbgIntfBaseTypes, DbgIntfDebuggerBase, GDBMIMiscClasses, + GDBTypeInfo, LCLProc, Forms, FpDbgLoader, FpDbgDwarf, LazLoggerBase, + LazLoggerProfiling, LazClasses, FpPascalParser, FpPascalBuilder, + FpErrorMessages, FpDbgDwarfDataClasses, FpDbgDwarfFreePascal, FpDbgCommon, + MenuIntf; type @@ -200,7 +197,7 @@ type TFpGDBMILineInfo = class(TDBGLineInfo) //class(TGDBMILineInfo) private - FRequestedSources: TStringListUTF8Fast; + FRequestedSources: TStringList; protected function FpDebugger: TFpGDBMIDebugger; procedure DoStateChange(const {%H-}AOldState: TDBGState); override; @@ -526,7 +523,7 @@ begin assert(AContext <> nil, 'TFpGDBMIDbgMemReader.ReadRegister: AContext <> nil'); Reg := FDebugger.Registers.CurrentRegistersList[AContext.ThreadId, AContext.StackFrame]; for i := 0 to Reg.Count - 1 do - if CompareText(Reg[i].Name, rname) = 0 then + if UpperCase(Reg[i].Name) = rname then begin RegVObj := Reg[i].ValueObjFormat[rdDefault]; if RegVObj <> nil then @@ -668,7 +665,7 @@ end; constructor TFpGDBMILineInfo.Create(const ADebugger: TDebuggerIntf); begin - FRequestedSources := TStringListUTF8Fast.Create; + FRequestedSources := TStringList.Create; inherited Create(ADebugger); end; diff --git a/components/lazdebuggers/lazdebuggerfplldb/fplldbdebugger.pas b/components/lazdebuggers/lazdebuggerfplldb/fplldbdebugger.pas index 606367f0ea..c2b7f8b056 100644 --- a/components/lazdebuggers/lazdebuggerfplldb/fplldbdebugger.pas +++ b/components/lazdebuggers/lazdebuggerfplldb/fplldbdebugger.pas @@ -25,15 +25,11 @@ uses {$IFdef WithWinMemReader} windows, {$ENDIF} - Classes, sysutils, math, - Forms, - LazLoggerBase, LazUTF8, LazClasses, - // DebuggerIntf - DbgIntfBaseTypes, DbgIntfDebuggerBase, - // FpDebug - FpdMemoryTools, FpDbgInfo, FpPascalParser, FpDbgLoader, FpDbgDwarf, - FpPascalBuilder, FpErrorMessages, FpDbgDwarfDataClasses, FpDbgCommon, - LldbDebugger, LldbInstructions, LldbHelper; + Classes, sysutils, math, FpdMemoryTools, FpDbgInfo, LldbDebugger, + LldbInstructions, LldbHelper, DbgIntfBaseTypes, DbgIntfDebuggerBase, LCLProc, + Forms, FpDbgLoader, FpDbgDwarf, LazLoggerBase, LazClasses, FpPascalParser, + FpPascalBuilder, FpErrorMessages, FpDbgDwarfDataClasses, FpDbgDwarfFreePascal, + FpDbgCommon; type @@ -255,7 +251,7 @@ type TFpLldbLineInfo = class(TDBGLineInfo) private - FRequestedSources: TStringListUTF8Fast; + FRequestedSources: TStringList; protected function FpDebugger: TFpLldbDebugger; procedure DoStateChange(const {%H-}AOldState: TDBGState); override; @@ -714,7 +710,7 @@ begin end; for i := 0 to Reg.Count - 1 do - if CompareText(Reg[i].Name, rname) = 0 then + if UpperCase(Reg[i].Name) = rname then begin RegVObj := Reg[i].ValueObjFormat[rdDefault]; if RegVObj <> nil then @@ -895,7 +891,7 @@ end; constructor TFpLldbLineInfo.Create(const ADebugger: TDebuggerIntf); begin - FRequestedSources := TStringListUTF8Fast.Create; + FRequestedSources := TStringList.Create; inherited Create(ADebugger); end; diff --git a/components/lazdebuggers/lazdebuggerlldb/lldbdebugger.pas b/components/lazdebuggers/lazdebuggerlldb/lldbdebugger.pas index aa6785f32a..a991fabe61 100644 --- a/components/lazdebuggers/lazdebuggerlldb/lldbdebugger.pas +++ b/components/lazdebuggers/lazdebuggerlldb/lldbdebugger.pas @@ -2293,10 +2293,10 @@ begin if TLldbDebuggerProperties(Debugger.GetProperties).SkipGDBDetection then FGotLLDB := True else - if PosI('LLDB', ALine) > 0 then + if StrContains(UpperCase(ALine), 'LLDB') then FGotLLDB := True else - if PosI('(GDB)', ALine) > 0 then + if StrContains(UpperCase(ALine), '(GDB)') then Debugger.SetErrorState('GDB detected', 'The external debugger identified itself as GDB. The IDE expected LLDB.'); end; diff --git a/components/lazdebuggers/lazdebuggerlldb/lldbhelper.pas b/components/lazdebuggers/lazdebuggerlldb/lldbhelper.pas index 6aeeac15e7..1a780fc621 100644 --- a/components/lazdebuggers/lazdebuggerlldb/lldbhelper.pas +++ b/components/lazdebuggers/lazdebuggerlldb/lldbhelper.pas @@ -19,8 +19,6 @@ interface uses Classes, SysUtils, strutils, math, - // LazUtils - LazStringUtils, // DebuggerIntf DbgIntfBaseTypes; @@ -62,9 +60,10 @@ begin end; end; -function StrStartsWith(AString, AStart: string; ACheckStartNotEmpty: Boolean): Boolean; +function StrStartsWith(AString, AStart: string; ACheckStartNotEmpty: Boolean + ): Boolean; begin - Result := (not ACheckStartNotEmpty or (AStart <> '')) and StartsStr(AStart, AString); + Result := ( (not ACheckStartNotEmpty) or (AStart <> '') ) and (LeftStr(AString, Length(AStart)) = AStart); end; function StrContains(AString, AFind: string): Boolean; @@ -93,7 +92,7 @@ begin end; SetLength(AGapsContent, FindLen - 1); - Result := StartsStr(AFind[0], AString); + Result := StrStartsWith(AString, AFind[0]); if not Result then exit; Delete(AString, 1, Length(AFind[0])); diff --git a/components/lazdebuggers/lazdebuggerlldb/lldbinstructions.pas b/components/lazdebuggers/lazdebuggerlldb/lldbinstructions.pas index 567d59c354..d0ec28ffab 100644 --- a/components/lazdebuggers/lazdebuggerlldb/lldbinstructions.pas +++ b/components/lazdebuggers/lazdebuggerlldb/lldbinstructions.pas @@ -20,7 +20,7 @@ interface uses SysUtils, Classes, strutils, // LazUtils - LazLoggerBase, LazStringUtils, + LazLoggerBase, // DebuggerIntf DbgIntfDebuggerBase, DbgIntfBaseTypes, // CmdLineDebuggerBase @@ -453,7 +453,7 @@ begin end; FBreakId:= i; - if Pos('pending', found[1]) > 0 then + if StrContains(found[1], 'pending') then FState := vsPending else if StrMatches(found[1], ['', ' locations'], found2) then begin @@ -580,9 +580,9 @@ var s: String; begin Result := False; - if StartsStr('error: ', AData) then begin - s := MaskQuotedText(AData); - if (PosI('debug map time', s) > 0) and (PosI('file will be ignored', s) > 0) + if LeftStr(AData, 7) = 'error: ' then begin + s := MaskQuotedText(LowerCase(AData)); + if (StrContains(s, 'debug map time') and StrContains(s, 'file will be ignored')) then begin FDwarfLoadErrors := FDwarfLoadErrors + AData + LineEnding; exit; diff --git a/components/lazdebuggers/lazdebugtestbase/testcommonsources.pas b/components/lazdebuggers/lazdebugtestbase/testcommonsources.pas index d793b37398..ba80c2e399 100644 --- a/components/lazdebuggers/lazdebugtestbase/testcommonsources.pas +++ b/components/lazdebuggers/lazdebugtestbase/testcommonsources.pas @@ -5,10 +5,7 @@ unit TestCommonSources; interface uses - Classes, SysUtils, strutils, - LCLType, - LazFileUtils, LazUTF8, - TestOutputLogger; + Classes, SysUtils, LCLType, strutils, LazFileUtils, TestOutputLogger; {$R sources.rc} // change to .res if you do not have windres (or fpcres). Ensure you have the latest .res pre-compiled resource @@ -22,7 +19,7 @@ type FFileName: String; FFolder: String; FOtherSources: Array of TCommonSource; - FBreakPoints: TStringListUTF8Fast; + FBreakPoints: TStringList; function GetBreakPoints(AName: String): Integer; function GetFullFileName: String; function GetOtherBreakPoints(AUnitName, AName: String): Integer; @@ -46,14 +43,14 @@ function GetCommonSourceFor(AName: String): TCommonSource; implementation var - CommonSources: TStringListUTF8Fast; + CommonSources: TStringList; BlockRecurseName: String; function GetCommonSourceFor(AName: String): TCommonSource; var i: Integer; begin - if CompareText(AName, BlockRecurseName) = 0 then + if UpperCase(AName) = UpperCase(BlockRecurseName) then raise Exception.Create('BlockRecurseName'); i := CommonSources.IndexOf(AName); if i >= 0 then @@ -85,7 +82,7 @@ begin i := FBreakPoints.IndexOf(AName); if (i < 0) or (FBreakPoints.Objects[i] = nil) then raise Exception.Create('Break unknown '+AName); - Result := PtrInt(FBreakPoints.Objects[i]); + Result := Integer(PtrInt(FBreakPoints.Objects[i])); //TestLogger.DebugLn(['Break: ',AName, ' ',Result]); end; @@ -151,7 +148,7 @@ begin FData.LoadFromStream(r); r.Free; - FBreakPoints := TStringListUTF8Fast.Create; + FBreakPoints := TStringList.Create; if FData.Count < 1 then exit; // TEST_USES @@ -236,7 +233,7 @@ begin end; initialization - CommonSources := TStringListUTF8Fast.Create; + CommonSources := TStringList.Create; finalization; while CommonSources.Count > 0 do begin diff --git a/components/lazdebuggers/lazdebugtestbase/testdbgcompilerprocess.pas b/components/lazdebuggers/lazdebugtestbase/testdbgcompilerprocess.pas index c857beb608..ec1270c463 100644 --- a/components/lazdebuggers/lazdebugtestbase/testdbgcompilerprocess.pas +++ b/components/lazdebuggers/lazdebugtestbase/testdbgcompilerprocess.pas @@ -280,7 +280,8 @@ begin OutputStream.Free; end; -function TCompilerProcess.CallCompiler(const ACommand, ACurDir: String): Boolean; +function TCompilerProcess.CallCompiler(const ACommand, ACurDir: String + ): Boolean; var FpcBuild: TProcessUTF8; OutputLines: TStrings; diff --git a/components/lazdebuggers/lazdebugtestbase/testdbgtestsuites.pas b/components/lazdebuggers/lazdebugtestbase/testdbgtestsuites.pas index 7a98914bdc..386e174405 100644 --- a/components/lazdebuggers/lazdebugtestbase/testdbgtestsuites.pas +++ b/components/lazdebuggers/lazdebugtestbase/testdbgtestsuites.pas @@ -352,7 +352,7 @@ begin if ACaseSense then Result := Got = Expected else - Result := CompareText(Got, Expected) = 0; + Result := UpperCase(Got) = UpperCase(Expected); Name := Name + ': Expected "'+Expected+'", Got "'+Got+'"'; if Result then AddTestSuccess(Name, MinDbgVers, MinFpcVers, AIgnoreReason) diff --git a/components/lazdebuggers/lazdebugtestbase/ttestwatchutilities.pas b/components/lazdebuggers/lazdebugtestbase/ttestwatchutilities.pas index 0cafbe6cea..3fbbd00929 100644 --- a/components/lazdebuggers/lazdebugtestbase/ttestwatchutilities.pas +++ b/components/lazdebuggers/lazdebugtestbase/ttestwatchutilities.pas @@ -1453,13 +1453,13 @@ begin while i > 1 do begin s := copy(ExpTpName, 1, i-1); delete(ExpTpName, i, i); - if CompareText(s, WtchTpName) = 0 then begin + if UpperCase(s) = UpperCase(WtchTpName) then begin Result := TestEquals('TypeName'+n, s, WtchTpName, EqIgnoreCase, AContext, AnIgnoreRsn); exit; end; i := pos('|', ExpTpName); end; - if (ExpTpName <> '') and (CompareText(ExpTpName, WtchTpName) = 0) then begin + if (ExpTpName <> '') and (UpperCase(ExpTpName) = UpperCase(WtchTpName)) then begin Result := TestEquals('TypeName'+n, ExpTpName, WtchTpName, EqIgnoreCase, AContext, AnIgnoreRsn); exit; end; @@ -2103,13 +2103,10 @@ begin end; procedure TWatchExpectationList.AddTypeNameAlias(ATypeName, AnAliases: String); -var - S: String; begin ATypeName := UpperCase(ATypeName); - S := FTypeNameAliases.Values[ATypeName]; - if S <> '' then - AnAliases := S + '|' + S; + if FTypeNameAliases.Values[ATypeName] <> '' then + AnAliases := FTypeNameAliases.Values[ATypeName] + '|' + FTypeNameAliases.Values[ATypeName]; FTypeNameAliases.Values[ATypeName] := AnAliases; end;