The lldb/test/API/python_api/debugger/TestDebuggerAPI.py test failed in case of Windows or Linux x86_64 host and Linux Aarch64 target:
File "llvm-project\lldb\test\API\python_api\debugger\TestDebuggerAPI.py", line 108, in test_CreateTarget_platform
platform2.GetWorkingDirectory().endswith("bar"),
AttributeError: 'NoneType' object has no attribute 'endswith'
target1 = self.dbg.CreateTarget(exe, None, "remote-linux", False, error) calls TargetList::CreateTargetInternal() in llvm-project/lldb/source/Target/TargetList.cpp, line 76
platform_options contains remote-linux, triple_str is empty, user_exe_path is a path to ELF created from elf.yaml (x86_64).
platform_arch is updated to x86_64 in TargetList.cpp, line 169:
// Only one arch and none was specified.
prefer_platform_arch = true;
platform_arch = matching_module_spec.GetArchitecture();
and platform_sp is updated to host in TargetList.cpp, line 226:
// If "arch" isn't valid, yet "platform_arch" is, it means we have an
// executable file with a single architecture which should be used.
ArchSpec fixed_platform_arch;
if (!platform_sp->IsCompatibleArchitecture(platform_arch, {}, ArchSpec::CompatibleMatch, nullptr)) {
platform_sp = platform_list.GetOrCreate(platform_arch, {}, &fixed_platform_arch);
if (platform_sp)
platform_list.SetSelectedPlatform(platform_sp);
}
Next call target2 = self.dbg.CreateTarget(exe, None, "remote-linux", False, error) will create the platform remote-linux in TargetList.cpp, line 98:
// Create a new platform if a platform was specified in the platform options and doesn't match the selected platform.
if (platform_options && platform_options->PlatformWasSpecified() && !platform_options->PlatformMatches(platform_sp)) {
const bool select_platform = true;
platform_sp = platform_options->CreatePlatformWithOptions(debugger.GetCommandInterpreter(),
arch, select_platform, error, platform_arch);
if (!platform_sp)
return error;
}
If the user specifies an explicit platform in the CreateTarget function, that platform should really take precedence over anything else.
The `lldb/test/API/python_api/debugger/TestDebuggerAPI.py` test failed in case of Windows host (x86_64) and Linux target (Aarch64).
`target1 = self.dbg.CreateTarget(exe, None, "remote-linux", False, error)` calls TargetList::CreateTargetInternal() in llvm-project/lldb/source/Target/TargetList.cpp, line 76
platform_options contains `remote-linux`, `triple_str is empty`, user_exe_path is a path to ELF created from elf.yaml (x86_64).
`platform_arch` is updated to `x86_64` in TargetList.cpp, line 169:
```
// Only one arch and none was specified.
prefer_platform_arch = true;
platform_arch = matching_module_spec.GetArchitecture();
```
and platform_sp is updated to `host` in TargetList.cpp, line 226:
```
// If "arch" isn't valid, yet "platform_arch" is, it means we have an
// executable file with a single architecture which should be used.
ArchSpec fixed_platform_arch;
if (!platform_sp->IsCompatibleArchitecture(platform_arch, {}, ArchSpec::CompatibleMatch, nullptr)) {
platform_sp = platform_list.GetOrCreate(platform_arch, {}, &fixed_platform_arch);
if (platform_sp)
platform_list.SetSelectedPlatform(platform_sp);
}
```
Next call `target2 = self.dbg.CreateTarget(exe, None, "remote-linux", False, error)` will create the platform remote-linux in TargetList.cpp, line 98:
```
// Create a new platform if a platform was specified in the platform options and doesn't match the selected platform.
if (platform_options && platform_options->PlatformWasSpecified() && !platform_options->PlatformMatches(platform_sp)) {
const bool select_platform = true;
platform_sp = platform_options->CreatePlatformWithOptions(debugger.GetCommandInterpreter(),
arch, select_platform, error, platform_arch);
if (!platform_sp)
return error;
}
```
If the user specifies an explicit platform in the CreateTarget function, that platform should really take precedence over anything else.
The
lldb/test/API/python_api/debugger/TestDebuggerAPI.py
test failed in case of Windows or Linux x86_64 host and Linux Aarch64 target:target1 = self.dbg.CreateTarget(exe, None, "remote-linux", False, error)
calls TargetList::CreateTargetInternal() in llvm-project/lldb/source/Target/TargetList.cpp, line 76platform_options contains
remote-linux
,triple_str is empty
, user_exe_path is a path to ELF created from elf.yaml (x86_64).platform_arch
is updated tox86_64
in TargetList.cpp, line 169:and platform_sp is updated to
host
in TargetList.cpp, line 226:Next call
target2 = self.dbg.CreateTarget(exe, None, "remote-linux", False, error)
will create the platform remote-linux in TargetList.cpp, line 98:If the user specifies an explicit platform in the CreateTarget function, that platform should really take precedence over anything else.