mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 19:19:24 +02:00
FpDebug: better shortstring detection / pointer base-size for string/array types
git-svn-id: trunk@64399 -
This commit is contained in:
parent
ba1a82803a
commit
0027bd2412
@ -188,6 +188,7 @@ type
|
|||||||
|
|
||||||
TFpValueDwarfFreePascalArray = class(TFpValueDwarfArray)
|
TFpValueDwarfFreePascalArray = class(TFpValueDwarfArray)
|
||||||
protected
|
protected
|
||||||
|
function GetKind: TDbgSymbolKind; override;
|
||||||
function GetMemberCount: Integer; override;
|
function GetMemberCount: Integer; override;
|
||||||
function DoGetStride(out AStride: TFpDbgValueSize): Boolean; override;
|
function DoGetStride(out AStride: TFpDbgValueSize): Boolean; override;
|
||||||
function DoGetMainStride(out AStride: TFpDbgValueSize): Boolean; override;
|
function DoGetMainStride(out AStride: TFpDbgValueSize): Boolean; override;
|
||||||
@ -206,6 +207,7 @@ type
|
|||||||
function GetInternalStringType: TArrayOrStringType;
|
function GetInternalStringType: TArrayOrStringType;
|
||||||
protected
|
protected
|
||||||
procedure KindNeeded; override;
|
procedure KindNeeded; override;
|
||||||
|
function DoReadSize(const AValueObj: TFpValue; out ASize: TFpDbgValueSize): Boolean; override;
|
||||||
public
|
public
|
||||||
function GetTypedValueObject(ATypeCast: Boolean; AnOuterType: TFpSymbolDwarfType = nil): TFpValueDwarf; override;
|
function GetTypedValueObject(ATypeCast: Boolean; AnOuterType: TFpSymbolDwarfType = nil): TFpValueDwarf; override;
|
||||||
end;
|
end;
|
||||||
@ -1009,6 +1011,14 @@ end;
|
|||||||
|
|
||||||
{ TFpValueDwarfFreePascalArray }
|
{ TFpValueDwarfFreePascalArray }
|
||||||
|
|
||||||
|
function TFpValueDwarfFreePascalArray.GetKind: TDbgSymbolKind;
|
||||||
|
begin
|
||||||
|
if TypeInfo <> nil then
|
||||||
|
Result := TypeInfo.Kind
|
||||||
|
else
|
||||||
|
Result := inherited GetKind;
|
||||||
|
end;
|
||||||
|
|
||||||
function TFpValueDwarfFreePascalArray.GetMemberCount: Integer;
|
function TFpValueDwarfFreePascalArray.GetMemberCount: Integer;
|
||||||
var
|
var
|
||||||
t, t2: TFpSymbol;
|
t, t2: TFpSymbol;
|
||||||
@ -1135,6 +1145,7 @@ var
|
|||||||
t: Cardinal;
|
t: Cardinal;
|
||||||
t2: TFpSymbol;
|
t2: TFpSymbol;
|
||||||
CharSize: TFpDbgValueSize;
|
CharSize: TFpDbgValueSize;
|
||||||
|
LocData: array of byte;
|
||||||
begin
|
begin
|
||||||
Result := FArrayOrStringType;
|
Result := FArrayOrStringType;
|
||||||
if Result <> iasUnknown then
|
if Result <> iasUnknown then
|
||||||
@ -1161,22 +1172,32 @@ begin
|
|||||||
if Info.HasAttrib(DW_AT_byte_stride) or Info.HasAttrib(DW_AT_type) then
|
if Info.HasAttrib(DW_AT_byte_stride) or Info.HasAttrib(DW_AT_type) then
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// This is a string
|
|
||||||
// TODO: check the location parser, if it is a reference
|
// TODO: check the location parser, if it is a reference
|
||||||
//FIsShortString := iasShortString;
|
|
||||||
|
if InformationEntry.ReadValue(DW_AT_data_location, LocData) then begin
|
||||||
|
if (Length(LocData) = 3) and
|
||||||
|
(LocData[0] = $97) and
|
||||||
|
(LocData[1] = $31) and
|
||||||
|
(LocData[2] = $22)
|
||||||
|
then begin
|
||||||
|
FArrayOrStringType := iasShortString;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
if not t2.ReadSize(nil, CharSize) then
|
if not t2.ReadSize(nil, CharSize) then
|
||||||
CharSize := ZeroSize; // TODO: error
|
CharSize := ZeroSize; // TODO: error
|
||||||
if (CharSize.Size = 2) then
|
if (CharSize.Size = 2) then
|
||||||
FArrayOrStringType := iasUnicodeString
|
FArrayOrStringType := iasUnicodeString
|
||||||
else
|
else
|
||||||
FArrayOrStringType := iasAnsiString;
|
FArrayOrStringType := iasAnsiString;
|
||||||
Result := FArrayOrStringType;
|
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
Info.GoNext;
|
Info.GoNext;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Info.ReleaseReference;
|
Info.ReleaseReference;
|
||||||
|
Result := FArrayOrStringType;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFpSymbolDwarfV3FreePascalSymbolTypeArray.GetTypedValueObject(
|
function TFpSymbolDwarfV3FreePascalSymbolTypeArray.GetTypedValueObject(
|
||||||
@ -1184,7 +1205,7 @@ function TFpSymbolDwarfV3FreePascalSymbolTypeArray.GetTypedValueObject(
|
|||||||
begin
|
begin
|
||||||
if AnOuterType = nil then
|
if AnOuterType = nil then
|
||||||
AnOuterType := Self;
|
AnOuterType := Self;
|
||||||
if GetInternalStringType in [{iasShortString,} iasAnsiString, iasUnicodeString] then
|
if GetInternalStringType in [iasShortString, iasAnsiString, iasUnicodeString] then
|
||||||
Result := TFpValueDwarfV3FreePascalString.Create(AnOuterType)
|
Result := TFpValueDwarfV3FreePascalString.Create(AnOuterType)
|
||||||
else
|
else
|
||||||
Result := inherited GetTypedValueObject(ATypeCast, AnOuterType);
|
Result := inherited GetTypedValueObject(ATypeCast, AnOuterType);
|
||||||
@ -1196,7 +1217,7 @@ begin
|
|||||||
iasShortString:
|
iasShortString:
|
||||||
SetKind(skString);
|
SetKind(skString);
|
||||||
iasAnsiString:
|
iasAnsiString:
|
||||||
SetKind(skString); // TODO
|
SetKind(skString); // TODO skAnsiString
|
||||||
iasUnicodeString:
|
iasUnicodeString:
|
||||||
SetKind(skWideString);
|
SetKind(skWideString);
|
||||||
else
|
else
|
||||||
@ -1204,6 +1225,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TFpSymbolDwarfV3FreePascalSymbolTypeArray.DoReadSize(
|
||||||
|
const AValueObj: TFpValue; out ASize: TFpDbgValueSize): Boolean;
|
||||||
|
begin
|
||||||
|
if GetInternalStringType in [iasAnsiString, iasUnicodeString] then begin
|
||||||
|
ASize := ZeroSize;
|
||||||
|
ASize.Size := CompilationUnit.AddressSize;
|
||||||
|
Result := True;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
Result := inherited DoReadSize(AValueObj, ASize);
|
||||||
|
if (not Result) and (GetInternalStringType = iasArray) then begin
|
||||||
|
ASize := ZeroSize;
|
||||||
|
ASize.Size := CompilationUnit.AddressSize;
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TFpValueDwarfV3FreePascalString }
|
{ TFpValueDwarfV3FreePascalString }
|
||||||
|
|
||||||
function TFpValueDwarfV3FreePascalString.IsValidTypeCast: Boolean;
|
function TFpValueDwarfV3FreePascalString.IsValidTypeCast: Boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user