mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 17:19:19 +02:00
FpDebug: Do not crash on unrecognized binary-formats
This commit is contained in:
parent
1dbef448b0
commit
124083f794
@ -1323,6 +1323,7 @@ var
|
|||||||
imgReader: TDbgImageReader;
|
imgReader: TDbgImageReader;
|
||||||
ATargetInfo: TTargetDescriptor;
|
ATargetInfo: TTargetDescriptor;
|
||||||
begin
|
begin
|
||||||
|
ATargetInfo := hostDescriptor;
|
||||||
if (FExecutableFilename <> '') and FileExists(FExecutableFilename) then
|
if (FExecutableFilename <> '') and FileExists(FExecutableFilename) then
|
||||||
begin
|
begin
|
||||||
DebugLn(DBG_VERBOSE, 'TDbgController.CheckExecutableAndLoadClasses');
|
DebugLn(DBG_VERBOSE, 'TDbgController.CheckExecutableAndLoadClasses');
|
||||||
@ -1332,14 +1333,16 @@ begin
|
|||||||
source := TDbgFileLoader.Create(FExecutableFilename);
|
source := TDbgFileLoader.Create(FExecutableFilename);
|
||||||
imgReader := GetImageReader(source, nil, 0, false);
|
imgReader := GetImageReader(source, nil, 0, false);
|
||||||
|
|
||||||
ATargetInfo := imgReader.TargetInfo;
|
// If the file-format of the 'executable' is not recognized, imgReader is
|
||||||
|
// nil. It can be anything, executable (some script) or non-executable (
|
||||||
|
// a jpeg-image). So use the default host-descriptor and see what happens...
|
||||||
|
if Assigned(imgReader) then
|
||||||
|
ATargetInfo := imgReader.TargetInfo;
|
||||||
finally
|
finally
|
||||||
FreeAndNil(imgReader); // TODO: Store object reference, it will be needed again
|
FreeAndNil(imgReader); // TODO: Store object reference, it will be needed again
|
||||||
FreeAndNil(source);
|
FreeAndNil(source);
|
||||||
end;
|
end;
|
||||||
end
|
end;
|
||||||
else
|
|
||||||
ATargetInfo := hostDescriptor;
|
|
||||||
|
|
||||||
FOsDbgClasses := FpDbgClasses.GetDbgProcessClass(ATargetInfo);
|
FOsDbgClasses := FpDbgClasses.GetDbgProcessClass(ATargetInfo);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user