FpDebug: find self in class procedure

This commit is contained in:
Martin 2023-03-25 08:45:20 +01:00
parent 9ee0ad85fa
commit 0deadb0dbb

View File

@ -6672,7 +6672,7 @@ begin
end; end;
var var
ThisNameInfo, SelfNameInfo: TNameSearchInfo; ThisNameInfo, SelfDollarNameInfo, SelfNameInfo: TNameSearchInfo;
function TFpSymbolDwarfDataProc.GetSelfParameter(AnAddress: TDbgPtr): TFpValueDwarf; function TFpSymbolDwarfDataProc.GetSelfParameter(AnAddress: TDbgPtr): TFpValueDwarf;
var var
InfoEntry: TDwarfInformationEntry; InfoEntry: TDwarfInformationEntry;
@ -6681,6 +6681,7 @@ var
begin begin
// special: search "self" // special: search "self"
// Todo nested procs // Todo nested procs
// TODO: move to FreePascal unit
Result := nil; Result := nil;
InfoEntry := InformationEntry.Clone; InfoEntry := InformationEntry.Clone;
//StartScopeIdx := InfoEntry.ScopeIndex; //StartScopeIdx := InfoEntry.ScopeIndex;
@ -6691,6 +6692,12 @@ begin
found := InfoEntry.GoNamedChildEx(ThisNameInfo); found := InfoEntry.GoNamedChildEx(ThisNameInfo);
if found then if found then
found := InfoEntry.IsArtificial; found := InfoEntry.IsArtificial;
if not found then begin
InfoEntry.ScopeIndex := InformationEntry.ScopeIndex;
found := InfoEntry.GoNamedChildEx(SelfDollarNameInfo);
if found then
found := InfoEntry.IsArtificial;
end;
if not found then begin if not found then begin
InfoEntry.ScopeIndex := InformationEntry.ScopeIndex; InfoEntry.ScopeIndex := InformationEntry.ScopeIndex;
found := InfoEntry.GoNamedChildEx(SelfNameInfo); found := InfoEntry.GoNamedChildEx(SelfNameInfo);
@ -6930,7 +6937,8 @@ initialization
FPDBG_DWARF_DATA_WARNINGS := DebugLogger.FindOrRegisterLogGroup('FPDBG_DWARF_DATA_WARNINGS' {$IFDEF FPDBG_DWARF_DATA_WARNINGS} , True {$ENDIF} ); FPDBG_DWARF_DATA_WARNINGS := DebugLogger.FindOrRegisterLogGroup('FPDBG_DWARF_DATA_WARNINGS' {$IFDEF FPDBG_DWARF_DATA_WARNINGS} , True {$ENDIF} );
ThisNameInfo := NameInfoForSearch('THIS'); ThisNameInfo := NameInfoForSearch('THIS');
SelfNameInfo := NameInfoForSearch('$SELF'); SelfNameInfo := NameInfoForSearch('SELF');
SelfDollarNameInfo := NameInfoForSearch('$SELF');
end. end.