mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-30 12:09:45 +02:00
Add a more detail to error message
This commit is contained in:
parent
f0f125ea19
commit
d8382b9c37
@ -27,6 +27,8 @@ type
|
||||
// Use when target information not yet loaded - assumes that debug target is the same as host
|
||||
function hostDescriptor: TTargetDescriptor;
|
||||
|
||||
function TargetFormatDescriptor(const aTargetDescriptor: TTargetDescriptor): String;
|
||||
|
||||
function dbgs(AMachineType: TMachineType): String; overload;
|
||||
function dbgs(ABitness: TBitness): String; overload;
|
||||
function dbgs(AByteOrder: TByteOrder): String; overload;
|
||||
@ -71,6 +73,24 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TargetFormatDescriptor(const aTargetDescriptor: TTargetDescriptor): String;
|
||||
const
|
||||
machineNames: array[TMachineType] of string = (
|
||||
'none', 'sparc', 'i386', 'm68K', 'ppc', 'ppc64', 'arm', 'aarch64',
|
||||
'old-alpha', 'ia_64', 'x86_64', 'avr', 'alpha',
|
||||
'mips', 'mipsel', 'loongarch64', 'xtensa', 'riscv');
|
||||
OSname: array[TOperatingSystem] of string = (
|
||||
'none', 'bsd', 'darwin', 'embedded', 'linux', 'unix', 'mac', 'win');
|
||||
begin
|
||||
Result := machineNames[aTargetDescriptor.machineType] + '-' +
|
||||
OSname[aTargetDescriptor.OS];
|
||||
if aTargetDescriptor.OS = osWindows then
|
||||
case aTargetDescriptor.bitness of
|
||||
b32: Result := Result + '32';
|
||||
b64: Result := Result + '64';
|
||||
end;
|
||||
end;
|
||||
|
||||
function dbgs(AMachineType: TMachineType): String;
|
||||
begin
|
||||
writestr(Result{%H-}, AMachineType);
|
||||
|
@ -16,7 +16,8 @@ uses
|
||||
{$ifdef windows} FpDbgWinClasses, {$endif}
|
||||
{$ifdef darwin} FpDbgDarwinClasses, {$endif}
|
||||
{$ifdef linux} FpDbgLinuxClasses, {$endif}
|
||||
FpDbgInfo, FpDbgDwarf, FpdMemoryTools, FpErrorMessages;
|
||||
FpDbgInfo, FpDbgDwarf, FpdMemoryTools, FpErrorMessages,
|
||||
FpDbgCommon;
|
||||
|
||||
type
|
||||
|
||||
@ -303,7 +304,7 @@ type
|
||||
procedure SetOnThreadDebugOutputEvent(AValue: TDebugOutputEvent);
|
||||
procedure SetParams(AValue: TStringList);
|
||||
|
||||
procedure CheckExecutableAndLoadClasses;
|
||||
procedure CheckExecutableAndLoadClasses(out ATargetInfo: TTargetDescriptor);
|
||||
protected
|
||||
FMainProcess: TDbgProcess;
|
||||
FCurrentProcess: TDbgProcess;
|
||||
@ -431,7 +432,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
FpImgReaderBase, FpDbgCommon;
|
||||
FpImgReaderBase;
|
||||
|
||||
var
|
||||
DBG_VERBOSE, DBG_WARNINGS, FPDBG_COMMANDS, FPDBG_FUNCCALL: PLazLoggerLogGroup;
|
||||
@ -1520,13 +1521,14 @@ begin
|
||||
FParams.Assign(AValue);
|
||||
end;
|
||||
|
||||
procedure TDbgController.CheckExecutableAndLoadClasses;
|
||||
procedure TDbgController.CheckExecutableAndLoadClasses(out
|
||||
ATargetInfo: TTargetDescriptor);
|
||||
var
|
||||
source: TDbgFileLoader;
|
||||
imgReader: TDbgImageReader;
|
||||
ATargetInfo: TTargetDescriptor;
|
||||
//ATargetInfo: TTargetDescriptor;
|
||||
begin
|
||||
ATargetInfo := hostDescriptor;
|
||||
ATargetInfo := Default(TTargetDescriptor);
|
||||
if (FExecutableFilename <> '') and FileExists(FExecutableFilename) then
|
||||
begin
|
||||
DebugLn(DBG_VERBOSE, 'TDbgController.CheckExecutableAndLoadClasses');
|
||||
@ -2151,6 +2153,8 @@ begin
|
||||
end;
|
||||
|
||||
function TDbgController.CreateDbgProcess: TDbgProcess;
|
||||
var
|
||||
TargetDescriptor: TTargetDescriptor;
|
||||
begin
|
||||
Result := nil;
|
||||
assert(FMainProcess = nil, 'TDbgController.CreateDbgProcess: FMainProcess = nil');
|
||||
@ -2167,10 +2171,11 @@ begin
|
||||
end;
|
||||
|
||||
// Get exe info, load classes
|
||||
CheckExecutableAndLoadClasses;
|
||||
CheckExecutableAndLoadClasses(TargetDescriptor);
|
||||
if not Assigned(OsDbgClasses) then begin
|
||||
DebugLn(DBG_WARNINGS, 'Error - No support registered for debug target');
|
||||
FLastError := CreateError(fpInternalErr, ['Unknown target for file: ' + FExecutableFilename]);
|
||||
FLastError := CreateError(fpInternalErr, ['Unsupported target for file: ' + FExecutableFilename+'.'#13#10 +
|
||||
'Target: ' + TargetFormatDescriptor(TargetDescriptor)]);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user