[Lldb-commits] [lldb] 8a0f0e2 - [lldb/test] Tweak libcxx string test on Apple+ARM devices

Davidino Italiano via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 21 16:05:16 PST 2020



> On Feb 21, 2020, at 3:54 PM, Vedant Kumar via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> 
> 
> Author: Vedant Kumar
> Date: 2020-02-21T15:54:38-08:00
> New Revision: 8a0f0e2656abf76b771037c6543caf9a31744120
> 
> URL: https://github.com/llvm/llvm-project/commit/8a0f0e2656abf76b771037c6543caf9a31744120
> DIFF: https://github.com/llvm/llvm-project/commit/8a0f0e2656abf76b771037c6543caf9a31744120.diff
> 
> LOG: [lldb/test] Tweak libcxx string test on Apple+ARM devices
> 
> On Apple platforms, is __arm__ isn't defined and we're not on Intel, we use an
> alternate std::string layout. I.e., the libcxx string test fails on phones
> because the hand-crafted "garbage" string structs are actually valid strings.
> 
> See:
> 
> ```
>  // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
>  // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
>  #if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) &&       \
>       (!defined(__arm__) || __ARM_ARCH_7K__ >= 2)) ||                           \
>      defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
>  #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
>  #endif
> ```
> 
> Disable inspection of the garbage structs on Apple+ARM devices.
> 
> Added: 
> 
> 
> Modified: 
>    lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
> 
> Removed: 
> 
> 

Thank you for the commit message. We (me in particular) historically have been bad at this but this is an example of something great for archeology.

> 
> ################################################################################
> diff  --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
> index 3753067113b1..c6f95d7e8593 100644
> --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
> +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
> @@ -116,7 +116,9 @@ def cleanup():
>                 '%s::allocator<unsigned char> >) uchar = "aaaaa"'%(ns,ns,ns),
>         ])
> 
> -        if is_64_bit:
> +        # The test assumes that std::string is in its cap-size-data layout.
> +        is_alternate_layout = ('arm' in self.getArchitecture()) and self.platformIsDarwin()
> +        if is_64_bit and not is_alternate_layout:
>             self.expect("frame variable garbage1", substrs=['garbage1 = Summary Unavailable'])
>             self.expect("frame variable garbage2", substrs=['garbage2 = Summary Unavailable'])
>             self.expect("frame variable garbage3", substrs=['garbage3 = Summary Unavailable'])
> 
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits



More information about the lldb-commits mailing list