Debugger: Revert recent upper/lowercase changes

git-svn-id: trunk@64570 -
This commit is contained in:
martin 2021-02-13 14:30:50 +00:00
parent f24ef4bcda
commit 8b81b7cfd3
10 changed files with 48 additions and 61 deletions

View File

@ -48,7 +48,7 @@ uses
// LCL // LCL
LCLProc, LCLProc,
// LazUtils // LazUtils
LazClasses, LazLoggerBase, LazFileUtils, LazStringUtils, Maps, LazMethodList, LazUTF8, LazClasses, LazLoggerBase, LazFileUtils, LazStringUtils, Maps, LazMethodList,
// DebuggerIntf // DebuggerIntf
DbgIntfBaseTypes, DbgIntfMiscClasses, DbgIntfPseudoTerminal, DbgIntfCommonStrings; DbgIntfBaseTypes, DbgIntfMiscClasses, DbgIntfPseudoTerminal, DbgIntfCommonStrings;
@ -6068,12 +6068,12 @@ procedure TDebuggerIntf.EnvironmentChanged(Sender: TObject);
var var
n, idx: integer; n, idx: integer;
S: String; S: String;
Env: TStringListUTF8Fast; Env: TStringList;
begin begin
// Createe local copy // Createe local copy
if FState <> dsNone then if FState <> dsNone then
begin begin
Env := TStringListUTF8Fast.Create; Env := TStringList.Create;
try try
Env.Assign(Environment); Env.Assign(Environment);
@ -6230,7 +6230,7 @@ var
idx: Integer; idx: Integer;
begin begin
if MDebuggerPropertiesList = nil if MDebuggerPropertiesList = nil
then MDebuggerPropertiesList := TStringListUTF8Fast.Create; then MDebuggerPropertiesList := TStringList.Create;
idx := MDebuggerPropertiesList.IndexOf(ClassName); idx := MDebuggerPropertiesList.IndexOf(ClassName);
if idx = -1 if idx = -1
then begin then begin
@ -6534,7 +6534,7 @@ constructor TBaseDebugManagerIntf.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
FValueFormatterList := TStringListUTF8Fast.Create; FValueFormatterList := TStringList.Create;
FValueFormatterList.Sorted := True; FValueFormatterList.Sorted := True;
FValueFormatterList.Duplicates := dupError; FValueFormatterList.Duplicates := dupError;
end; end;
@ -6629,7 +6629,7 @@ initialization
DBG_DATA_MONITORS := DebugLogger.FindOrRegisterLogGroup('DBG_DATA_MONITORS' {$IFDEF DBG_DATA_MONITORS} , True {$ENDIF} ); 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} ); DBG_DISASSEMBLER := DebugLogger.FindOrRegisterLogGroup('DBG_DISASSEMBLER' {$IFDEF DBG_DISASSEMBLER} , True {$ENDIF} );
MDebuggerClasses := TStringListUTF8Fast.Create; MDebuggerClasses := TStringList.Create;
MDebuggerClasses.Sorted := True; MDebuggerClasses.Sorted := True;
MDebuggerClasses.Duplicates := dupError; MDebuggerClasses.Duplicates := dupError;

View File

@ -12,15 +12,12 @@ uses
{$IFdef WithWinMemReader} {$IFdef WithWinMemReader}
windows, windows,
{$ENDIF} {$ENDIF}
Classes, sysutils, math, Classes, sysutils, math, FpdMemoryTools, FpDbgInfo, FpDbgClasses,
Forms, GDBMIDebugger, DbgIntfBaseTypes, DbgIntfDebuggerBase, GDBMIMiscClasses,
LazUTF8, LazLoggerBase, LazClasses, GDBTypeInfo, LCLProc, Forms, FpDbgLoader, FpDbgDwarf, LazLoggerBase,
MenuIntf, LazLoggerProfiling, LazClasses, FpPascalParser, FpPascalBuilder,
DbgIntfBaseTypes, DbgIntfDebuggerBase, FpErrorMessages, FpDbgDwarfDataClasses, FpDbgDwarfFreePascal, FpDbgCommon,
GDBMIDebugger, GDBMIMiscClasses, GDBTypeInfo, MenuIntf;
// FpDebug
FpDbgInfo, FpDbgLoader, FpDbgDwarf, FpPascalParser, FpPascalBuilder,
FpdMemoryTools, FpErrorMessages, FpDbgDwarfDataClasses, FpDbgCommon;
type type
@ -200,7 +197,7 @@ type
TFpGDBMILineInfo = class(TDBGLineInfo) //class(TGDBMILineInfo) TFpGDBMILineInfo = class(TDBGLineInfo) //class(TGDBMILineInfo)
private private
FRequestedSources: TStringListUTF8Fast; FRequestedSources: TStringList;
protected protected
function FpDebugger: TFpGDBMIDebugger; function FpDebugger: TFpGDBMIDebugger;
procedure DoStateChange(const {%H-}AOldState: TDBGState); override; procedure DoStateChange(const {%H-}AOldState: TDBGState); override;
@ -526,7 +523,7 @@ begin
assert(AContext <> nil, 'TFpGDBMIDbgMemReader.ReadRegister: AContext <> nil'); assert(AContext <> nil, 'TFpGDBMIDbgMemReader.ReadRegister: AContext <> nil');
Reg := FDebugger.Registers.CurrentRegistersList[AContext.ThreadId, AContext.StackFrame]; Reg := FDebugger.Registers.CurrentRegistersList[AContext.ThreadId, AContext.StackFrame];
for i := 0 to Reg.Count - 1 do for i := 0 to Reg.Count - 1 do
if CompareText(Reg[i].Name, rname) = 0 then if UpperCase(Reg[i].Name) = rname then
begin begin
RegVObj := Reg[i].ValueObjFormat[rdDefault]; RegVObj := Reg[i].ValueObjFormat[rdDefault];
if RegVObj <> nil then if RegVObj <> nil then
@ -668,7 +665,7 @@ end;
constructor TFpGDBMILineInfo.Create(const ADebugger: TDebuggerIntf); constructor TFpGDBMILineInfo.Create(const ADebugger: TDebuggerIntf);
begin begin
FRequestedSources := TStringListUTF8Fast.Create; FRequestedSources := TStringList.Create;
inherited Create(ADebugger); inherited Create(ADebugger);
end; end;

View File

@ -25,15 +25,11 @@ uses
{$IFdef WithWinMemReader} {$IFdef WithWinMemReader}
windows, windows,
{$ENDIF} {$ENDIF}
Classes, sysutils, math, Classes, sysutils, math, FpdMemoryTools, FpDbgInfo, LldbDebugger,
Forms, LldbInstructions, LldbHelper, DbgIntfBaseTypes, DbgIntfDebuggerBase, LCLProc,
LazLoggerBase, LazUTF8, LazClasses, Forms, FpDbgLoader, FpDbgDwarf, LazLoggerBase, LazClasses, FpPascalParser,
// DebuggerIntf FpPascalBuilder, FpErrorMessages, FpDbgDwarfDataClasses, FpDbgDwarfFreePascal,
DbgIntfBaseTypes, DbgIntfDebuggerBase, FpDbgCommon;
// FpDebug
FpdMemoryTools, FpDbgInfo, FpPascalParser, FpDbgLoader, FpDbgDwarf,
FpPascalBuilder, FpErrorMessages, FpDbgDwarfDataClasses, FpDbgCommon,
LldbDebugger, LldbInstructions, LldbHelper;
type type
@ -255,7 +251,7 @@ type
TFpLldbLineInfo = class(TDBGLineInfo) TFpLldbLineInfo = class(TDBGLineInfo)
private private
FRequestedSources: TStringListUTF8Fast; FRequestedSources: TStringList;
protected protected
function FpDebugger: TFpLldbDebugger; function FpDebugger: TFpLldbDebugger;
procedure DoStateChange(const {%H-}AOldState: TDBGState); override; procedure DoStateChange(const {%H-}AOldState: TDBGState); override;
@ -714,7 +710,7 @@ begin
end; end;
for i := 0 to Reg.Count - 1 do for i := 0 to Reg.Count - 1 do
if CompareText(Reg[i].Name, rname) = 0 then if UpperCase(Reg[i].Name) = rname then
begin begin
RegVObj := Reg[i].ValueObjFormat[rdDefault]; RegVObj := Reg[i].ValueObjFormat[rdDefault];
if RegVObj <> nil then if RegVObj <> nil then
@ -895,7 +891,7 @@ end;
constructor TFpLldbLineInfo.Create(const ADebugger: TDebuggerIntf); constructor TFpLldbLineInfo.Create(const ADebugger: TDebuggerIntf);
begin begin
FRequestedSources := TStringListUTF8Fast.Create; FRequestedSources := TStringList.Create;
inherited Create(ADebugger); inherited Create(ADebugger);
end; end;

View File

@ -2293,10 +2293,10 @@ begin
if TLldbDebuggerProperties(Debugger.GetProperties).SkipGDBDetection then if TLldbDebuggerProperties(Debugger.GetProperties).SkipGDBDetection then
FGotLLDB := True FGotLLDB := True
else else
if PosI('LLDB', ALine) > 0 then if StrContains(UpperCase(ALine), 'LLDB') then
FGotLLDB := True FGotLLDB := True
else 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.'); Debugger.SetErrorState('GDB detected', 'The external debugger identified itself as GDB. The IDE expected LLDB.');
end; end;

View File

@ -19,8 +19,6 @@ interface
uses uses
Classes, SysUtils, strutils, math, Classes, SysUtils, strutils, math,
// LazUtils
LazStringUtils,
// DebuggerIntf // DebuggerIntf
DbgIntfBaseTypes; DbgIntfBaseTypes;
@ -62,9 +60,10 @@ begin
end; end;
end; end;
function StrStartsWith(AString, AStart: string; ACheckStartNotEmpty: Boolean): Boolean; function StrStartsWith(AString, AStart: string; ACheckStartNotEmpty: Boolean
): Boolean;
begin begin
Result := (not ACheckStartNotEmpty or (AStart <> '')) and StartsStr(AStart, AString); Result := ( (not ACheckStartNotEmpty) or (AStart <> '') ) and (LeftStr(AString, Length(AStart)) = AStart);
end; end;
function StrContains(AString, AFind: string): Boolean; function StrContains(AString, AFind: string): Boolean;
@ -93,7 +92,7 @@ begin
end; end;
SetLength(AGapsContent, FindLen - 1); SetLength(AGapsContent, FindLen - 1);
Result := StartsStr(AFind[0], AString); Result := StrStartsWith(AString, AFind[0]);
if not Result then if not Result then
exit; exit;
Delete(AString, 1, Length(AFind[0])); Delete(AString, 1, Length(AFind[0]));

View File

@ -20,7 +20,7 @@ interface
uses uses
SysUtils, Classes, strutils, SysUtils, Classes, strutils,
// LazUtils // LazUtils
LazLoggerBase, LazStringUtils, LazLoggerBase,
// DebuggerIntf // DebuggerIntf
DbgIntfDebuggerBase, DbgIntfBaseTypes, DbgIntfDebuggerBase, DbgIntfBaseTypes,
// CmdLineDebuggerBase // CmdLineDebuggerBase
@ -453,7 +453,7 @@ begin
end; end;
FBreakId:= i; FBreakId:= i;
if Pos('pending', found[1]) > 0 then if StrContains(found[1], 'pending') then
FState := vsPending FState := vsPending
else else
if StrMatches(found[1], ['', ' locations'], found2) then begin if StrMatches(found[1], ['', ' locations'], found2) then begin
@ -580,9 +580,9 @@ var
s: String; s: String;
begin begin
Result := False; Result := False;
if StartsStr('error: ', AData) then begin if LeftStr(AData, 7) = 'error: ' then begin
s := MaskQuotedText(AData); s := MaskQuotedText(LowerCase(AData));
if (PosI('debug map time', s) > 0) and (PosI('file will be ignored', s) > 0) if (StrContains(s, 'debug map time') and StrContains(s, 'file will be ignored'))
then begin then begin
FDwarfLoadErrors := FDwarfLoadErrors + AData + LineEnding; FDwarfLoadErrors := FDwarfLoadErrors + AData + LineEnding;
exit; exit;

View File

@ -5,10 +5,7 @@ unit TestCommonSources;
interface interface
uses uses
Classes, SysUtils, strutils, Classes, SysUtils, LCLType, strutils, LazFileUtils, TestOutputLogger;
LCLType,
LazFileUtils, LazUTF8,
TestOutputLogger;
{$R sources.rc} // change to .res if you do not have windres (or fpcres). Ensure you have the latest .res pre-compiled resource {$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; FFileName: String;
FFolder: String; FFolder: String;
FOtherSources: Array of TCommonSource; FOtherSources: Array of TCommonSource;
FBreakPoints: TStringListUTF8Fast; FBreakPoints: TStringList;
function GetBreakPoints(AName: String): Integer; function GetBreakPoints(AName: String): Integer;
function GetFullFileName: String; function GetFullFileName: String;
function GetOtherBreakPoints(AUnitName, AName: String): Integer; function GetOtherBreakPoints(AUnitName, AName: String): Integer;
@ -46,14 +43,14 @@ function GetCommonSourceFor(AName: String): TCommonSource;
implementation implementation
var var
CommonSources: TStringListUTF8Fast; CommonSources: TStringList;
BlockRecurseName: String; BlockRecurseName: String;
function GetCommonSourceFor(AName: String): TCommonSource; function GetCommonSourceFor(AName: String): TCommonSource;
var var
i: Integer; i: Integer;
begin begin
if CompareText(AName, BlockRecurseName) = 0 then if UpperCase(AName) = UpperCase(BlockRecurseName) then
raise Exception.Create('BlockRecurseName'); raise Exception.Create('BlockRecurseName');
i := CommonSources.IndexOf(AName); i := CommonSources.IndexOf(AName);
if i >= 0 then if i >= 0 then
@ -85,7 +82,7 @@ begin
i := FBreakPoints.IndexOf(AName); i := FBreakPoints.IndexOf(AName);
if (i < 0) or (FBreakPoints.Objects[i] = nil) then if (i < 0) or (FBreakPoints.Objects[i] = nil) then
raise Exception.Create('Break unknown '+AName); raise Exception.Create('Break unknown '+AName);
Result := PtrInt(FBreakPoints.Objects[i]); Result := Integer(PtrInt(FBreakPoints.Objects[i]));
//TestLogger.DebugLn(['Break: ',AName, ' ',Result]); //TestLogger.DebugLn(['Break: ',AName, ' ',Result]);
end; end;
@ -151,7 +148,7 @@ begin
FData.LoadFromStream(r); FData.LoadFromStream(r);
r.Free; r.Free;
FBreakPoints := TStringListUTF8Fast.Create; FBreakPoints := TStringList.Create;
if FData.Count < 1 then exit; if FData.Count < 1 then exit;
// TEST_USES // TEST_USES
@ -236,7 +233,7 @@ begin
end; end;
initialization initialization
CommonSources := TStringListUTF8Fast.Create; CommonSources := TStringList.Create;
finalization; finalization;
while CommonSources.Count > 0 do begin while CommonSources.Count > 0 do begin

View File

@ -280,7 +280,8 @@ begin
OutputStream.Free; OutputStream.Free;
end; end;
function TCompilerProcess.CallCompiler(const ACommand, ACurDir: String): Boolean; function TCompilerProcess.CallCompiler(const ACommand, ACurDir: String
): Boolean;
var var
FpcBuild: TProcessUTF8; FpcBuild: TProcessUTF8;
OutputLines: TStrings; OutputLines: TStrings;

View File

@ -352,7 +352,7 @@ begin
if ACaseSense then if ACaseSense then
Result := Got = Expected Result := Got = Expected
else else
Result := CompareText(Got, Expected) = 0; Result := UpperCase(Got) = UpperCase(Expected);
Name := Name + ': Expected "'+Expected+'", Got "'+Got+'"'; Name := Name + ': Expected "'+Expected+'", Got "'+Got+'"';
if Result if Result
then AddTestSuccess(Name, MinDbgVers, MinFpcVers, AIgnoreReason) then AddTestSuccess(Name, MinDbgVers, MinFpcVers, AIgnoreReason)

View File

@ -1453,13 +1453,13 @@ begin
while i > 1 do begin while i > 1 do begin
s := copy(ExpTpName, 1, i-1); s := copy(ExpTpName, 1, i-1);
delete(ExpTpName, i, i); 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); Result := TestEquals('TypeName'+n, s, WtchTpName, EqIgnoreCase, AContext, AnIgnoreRsn);
exit; exit;
end; end;
i := pos('|', ExpTpName); i := pos('|', ExpTpName);
end; 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); Result := TestEquals('TypeName'+n, ExpTpName, WtchTpName, EqIgnoreCase, AContext, AnIgnoreRsn);
exit; exit;
end; end;
@ -2103,13 +2103,10 @@ begin
end; end;
procedure TWatchExpectationList.AddTypeNameAlias(ATypeName, AnAliases: String); procedure TWatchExpectationList.AddTypeNameAlias(ATypeName, AnAliases: String);
var
S: String;
begin begin
ATypeName := UpperCase(ATypeName); ATypeName := UpperCase(ATypeName);
S := FTypeNameAliases.Values[ATypeName]; if FTypeNameAliases.Values[ATypeName] <> '' then
if S <> '' then AnAliases := FTypeNameAliases.Values[ATypeName] + '|' + FTypeNameAliases.Values[ATypeName];
AnAliases := S + '|' + S;
FTypeNameAliases.Values[ATypeName] := AnAliases; FTypeNameAliases.Values[ATypeName] := AnAliases;
end; end;