mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 21:10:42 +02:00
FpDebug: Windows, Fix addresses for non-Dwarf symbols. TFpSymbolInfo does not use the RelocationOffset, so addresses will be directly mapped to their loaded location.
This commit is contained in:
parent
dd95c55605
commit
220c850843
@ -170,7 +170,7 @@ var
|
|||||||
SectNumber, SectCount: Integer;
|
SectNumber, SectCount: Integer;
|
||||||
SectRVA: QWord;
|
SectRVA: QWord;
|
||||||
begin
|
begin
|
||||||
AfpSymbolInfo.SetAddressBounds(ImageBase, ImageBase+ImageSize);
|
AfpSymbolInfo.SetAddressBounds(LoadedTargetImageAddr, LoadedTargetImageAddr+ImageSize);
|
||||||
p := Section[_symbol];
|
p := Section[_symbol];
|
||||||
ps := Section[_symbolstrings];
|
ps := Section[_symbolstrings];
|
||||||
if assigned(p) and assigned(ps) then
|
if assigned(p) and assigned(ps) then
|
||||||
@ -203,7 +203,7 @@ begin
|
|||||||
SectRVA := PDbgImageSectionEx(FSections.Objects[SectNumber])^.Sect.VirtualAddress
|
SectRVA := PDbgImageSectionEx(FSections.Objects[SectNumber])^.Sect.VirtualAddress
|
||||||
else
|
else
|
||||||
SectRVA := 0;
|
SectRVA := 0;
|
||||||
AfpSymbolInfo.Add(SymbolName, TDBGPtr(SymbolArr^[i].Value+ImageBase+SectRVA));
|
AfpSymbolInfo.Add(SymbolName, TDBGPtr(SymbolArr^[i].Value+LoadedTargetImageAddr+SectRVA));
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
{$POP}
|
{$POP}
|
||||||
@ -229,7 +229,7 @@ var
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
{$ifdef windows}
|
{$ifdef windows}
|
||||||
if ImageBase = 0 then
|
if LoadedTargetImageAddr = 0 then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
FFileLoader.LoadMemory(0, 1, hBase); // size does not matter, only obtain address
|
FFileLoader.LoadMemory(0, 1, hBase); // size does not matter, only obtain address
|
||||||
@ -262,7 +262,7 @@ begin
|
|||||||
ExportSize := header32^.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size;
|
ExportSize := header32^.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size;
|
||||||
SetImageSize(header32^.OptionalHeader.SizeOfImage);
|
SetImageSize(header32^.OptionalHeader.SizeOfImage);
|
||||||
end;
|
end;
|
||||||
AfpSymbolInfo.SetAddressBounds(ImageBase, ImageBase+ImageSize);
|
AfpSymbolInfo.SetAddressBounds(LoadedTargetImageAddr, LoadedTargetImageAddr+ImageSize);
|
||||||
|
|
||||||
if (ExportSect = nil) or (ExportSect^.AddressOfNames = 0) or (ExportSize = 0) then
|
if (ExportSect = nil) or (ExportSect^.AddressOfNames = 0) or (ExportSize = 0) then
|
||||||
exit;
|
exit;
|
||||||
@ -292,7 +292,7 @@ begin
|
|||||||
if FuncAddr = 0 then
|
if FuncAddr = 0 then
|
||||||
Continue;
|
Continue;
|
||||||
|
|
||||||
AFpSymbolInfo.Add(FuncName, ImageBase + FuncAddr);
|
AFpSymbolInfo.Add(FuncName, LoadedTargetImageAddr + FuncAddr);
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user