slydiman wrote:

> `SBDebugger::CreateTarget` takes a `platform_name` argument which we're 
> already setting to "remote-linux".

Probably it works on buildbots because the host architecture is `Aarch64`. I'm 
trying to get it working on Windows `x86_64`.

`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;
}
```

I don't think we need to change this logic. So the fix of this test looks 
reasonable.

https://github.com/llvm/llvm-project/pull/90580
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to