Leave OS type and vendor as unspecified unknowns - so it can filled in by merging with target or host architecture.
Details
Diff Detail
Event Timeline
I don't really like the way we force some fix value into the triple on android. Do you know who is depending on this information to be filled in? I think it would be a better idea to change that function to accept unknown value both for OS and for Environment in case it isn't specified in the ELF file.
The problem that I stumbled upon is qProcessInfo - response field ostype is set to 'unknown' and eventually host side cannot find an appropriate dynamic loader for such process, no modules are loaded.
I checked your change again and I don't understand why it have any effect at all. The "process_info.GetArchitecture().MergeFrom(HostInfo::GetArchitecture());" call should fill in all of these details from the HostInfo even without your change assuming HostInfo::GetArchitecture() returns the correct value.
If it isn't filled by the MergeFrom call then we should fix that one instead of adding one more merge layer with hard coded values.
Presumably problem is in specified unknowns for os and environment set by ObjectFileELF::GetModuleSpecifications.
ArchSpec::MergeFrom updates os and environment only if corresponding item wasn't set in destination spec.
We may modify ObjectFileELF::GetModuleSpecifications to leave os and environment as unspecified unknowns if there is no explicit values for them.
I would prefer that solution especially as the merge was added to handle this type of problems. For the first look I don't see any place where GetModuleSpecifications set os/environment to specified unknown but I might miss something.
Leave OS type as unspecified unknown for ELF binaries - so it can be filled in by merging with target or host architecture.
Hard to say - there are might be some historical reasons...
Potentially, we may leave it as unspecified unknown as well.
We should prefer unspecified unknown for now for anything that isn't known. We really want this triple to be "<arch>-*-<ostype>" or "<arch>-*-*. We should, at some point, try to get a wildcard patch into the LLVM triple where we get AnyOS added to llvm::Triple::OSType and AnyVendor added to the and llvm::Triple::VendorType. This would then allow the triples to print nicely ( x86_64-*-* instead of "x86_64-unknown-unknown" and not being able to tell if the unknowns are specified or not.
According to Greg's comment removed setting os type and vendor type to unknown altogether - if this will cause problem on some architectures, we can narrow down the scope, let's say apply only to ELF.