mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-20 11:59:26 +02:00
FpDebug: Fix for handling libraries that do not provide a real file-handle.
This commit is contained in:
parent
a57cf215d3
commit
7750772722
@ -445,8 +445,22 @@ end;
|
||||
{ tDbgWinLibrary }
|
||||
|
||||
procedure tDbgWinLibrary.InitializeLoaders;
|
||||
var
|
||||
FileInformation: TByHandleFileInformation;
|
||||
begin
|
||||
TDbgImageLoaderLibrary.Create(FInfo.hFile, nil, TDBGPtr(FInfo.lpBaseOfDll)).AddToLoaderList(LoaderList);
|
||||
if GetFileInformationByHandle(FInfo.hFile, FileInformation) then
|
||||
TDbgImageLoaderLibrary.Create(FInfo.hFile, nil, TDBGPtr(FInfo.lpBaseOfDll)).AddToLoaderList(LoaderList)
|
||||
else if Name <> '' then
|
||||
begin
|
||||
// There are situations in which the provided handle is not a file-handle. In
|
||||
// those cases, use the filename as fallback.
|
||||
// (Happened in a Windows-docker (Azure, AKS) on the kernel32.dll. No idea
|
||||
// why, though)
|
||||
if FileExists(Name) then
|
||||
TDbgImageLoaderLibrary.Create(Name, nil, TDBGPtr(FInfo.lpBaseOfDll)).AddToLoaderList(LoaderList)
|
||||
else
|
||||
DebugLn(DBG_WARNINGS, 'File [%s] related to library does not exist', [Name]);
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor tDbgWinLibrary.Create(const AProcess: TDbgProcess;
|
||||
|
@ -323,7 +323,7 @@ begin
|
||||
FMapHandle := CreateFileMapping(FFileHandle, nil, PAGE_READONLY{ or SEC_IMAGE}, 0, 0, nil);
|
||||
if FMapHandle = 0
|
||||
then begin
|
||||
raise Exception.Create('Could not create module mapping');
|
||||
raise Exception.CreateFmt('Could not create module mapping, error %d', [GetLastError]);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user