The inheritance trick can be useful sometimes, but I don't think it's
a good way to write tests in general (and it should not be necessary
for this patch).

I assume you ran into this while working on a real-world bug. How were
the relevant ArchSpecs constructed there? The class is fairly simple,
so it should be easy to replicate the construction here (probably just
involves passing the correct triple string to the ArchSpec
constructor)...

Did you try that approach?

On 5 January 2018 at 02:54, Davide Italiano via lldb-commits
<lldb-commits@lists.llvm.org> wrote:
> @Pavel, is there an easy way of testing this? m_core is a protected
> member of ArchSpec so we can't set it willy-nilly, but still I'd like
> to have some regression testing for the change. I'll take a look early
> tomorrow, but throwing this here in case you have ideas.
>
> Thanks!
>
> --
> Davide
>
> On Thu, Jan 4, 2018 at 6:50 PM, Davide Italiano via lldb-commits
> <lldb-commits@lists.llvm.org> wrote:
>> Author: davide
>> Date: Thu Jan  4 18:50:24 2018
>> New Revision: 321856
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=321856&view=rev
>> Log:
>> [ArchSpec] Don't consider Unknown MachO64 as invalid.
>>
>> Even without a proper arch we can access line tables, etc..
>>
>> <rdar://problem/35778442>
>>
>> Modified:
>>     lldb/trunk/source/Utility/ArchSpec.cpp
>>
>> Modified: lldb/trunk/source/Utility/ArchSpec.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ArchSpec.cpp?rev=321856&r1=321855&r2=321856&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Utility/ArchSpec.cpp (original)
>> +++ lldb/trunk/source/Utility/ArchSpec.cpp Thu Jan  4 18:50:24 2018
>> @@ -890,7 +890,12 @@ void ArchSpec::MergeFrom(const ArchSpec
>>      GetTriple().setOS(other.GetTriple().getOS());
>>    if (GetTriple().getArch() == llvm::Triple::UnknownArch) {
>>      GetTriple().setArch(other.GetTriple().getArch());
>> -    UpdateCore();
>> +
>> +    // MachO unknown64 isn't really invalid as the debugger can
>> +    // still obtain information from the binary, e.g. line tables.
>> +    // As such, we don't update the core here.
>> +    if (other.GetCore() != eCore_uknownMach64)
>> +      UpdateCore();
>>    }
>>    if (GetTriple().getEnvironment() == llvm::Triple::UnknownEnvironment &&
>>        !TripleVendorWasSpecified()) {
>>
>>
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> _______________________________________________
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to