[lldb-dev] When should ArchSpecs match?

Jim Ingham via lldb-dev lldb-dev at lists.llvm.org
Thu Dec 6 15:37:35 PST 2018


I agree with Davide.  Particularly if there’s code that is relying on the “IsExactMatch” not behaving like the function name makes clear it obviously should behave, we should straighten that out.  Otherwise reasoning about this will be too confusing.

Jim


> On Dec 6, 2018, at 3:26 PM, Davide Italiano via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> 
> On Thu, Dec 6, 2018 at 3:20 PM Adrian Prantl via lldb-dev
> <lldb-dev at lists.llvm.org <mailto:lldb-dev at lists.llvm.org>> wrote:
>> 
>> I was puzzled by the behavior of ArchSpec::IsExactMatch() and IsCompatibleMatch() yesterday, so I created a couple of unit tests to document the current behavior. Most of the tests make perfect sense, but a few edge cases really don't behave like I would have expected them to.
>> 
>>>  {
>>>    ArchSpec A("arm64-*-*");
>>>    ArchSpec B("arm64-apple-ios");
>>>    ASSERT_FALSE(A.IsExactMatch(B));
>>>    // FIXME: This looks unintuitive and we should investigate whether
>>>    // this is the desired behavior.
>>>    ASSERT_FALSE(A.IsCompatibleMatch(B));
>>>  }
>>>  {
>>>    ArchSpec A("x86_64-*-*");
>>>    ArchSpec B("x86_64-apple-ios-simulator");
>>>    ASSERT_FALSE(A.IsExactMatch(B));
>>>    // FIXME: See above, though the extra environment complicates things.
>>>    ASSERT_FALSE(A.IsCompatibleMatch(B));
>>>  }
>>>  {
>>>    ArchSpec A("x86_64");
>>>    ArchSpec B("x86_64-apple-macosx10.14");
>>>    // FIXME: The exact match also looks unintuitive.
>>>    ASSERT_TRUE(A.IsExactMatch(B));
>>>    ASSERT_TRUE(A.IsCompatibleMatch(B));
>>>  }
>>> 
>> 
>> Particularly, I believe that:
>> - ArchSpec("x86_64-*-*") and ArchSpec("x86_64") should behave the same.
> 
> Yes.
> 
>> - ArchSpec("x86_64").IsExactMatch("x86_64-apple-macosx10.14") should be false.
> 
> I'm at a loss trying to understand how this could not be false.
> It would mean that when we instantiate a Triple and we don't have an
> arch we believe it's a Mach-O binary.
> This sounds really wrong, and if there's code in lldb living under the
> assumption this is true, we might consider getting rid of it (or
> fixing it).
> 
>> - ArchSpec("x86_64-*-*").IsCompatibleMath("x86_64-apple-macosx") should be true.
>> 
> Yes.
> 
> --
> Davide
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org <mailto:lldb-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20181206/a0701cde/attachment-0001.html>


More information about the lldb-dev mailing list