[Lldb-commits] [PATCH] D39727: Make TestTopLevelExprs more robust in face of linker GC

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 7 04:36:01 PST 2017


I could, but I thought this would be more portable. For the Makefile
solution I'd need to do something like

LD_EXTRAS := -Wl,--no-as-needed,--whole-archive

Which is a bit of a hack, as I'm not even using these flags to affect
my own libraries, but the libraries that the compiler adds
automatically to the end of the linker line. And I'm not sure whether
the darwin linker (or lld when targetting windows) supports these
options.

On 7 November 2017 at 12:22, Zachary Turner <zturner at google.com> wrote:
> Can’t you just disable linker gc in the makefile?
> On Tue, Nov 7, 2017 at 4:18 AM Pavel Labath via Phabricator via lldb-commits
> <lldb-commits at lists.llvm.org> wrote:
>>
>> labath created this revision.
>> Herald added a subscriber: srhines.
>>
>> This test was failing in various configurations on linux in a fairly
>> unpredictible way. The success depended on whether the c++ abi library
>> was linked in statically or not and how well was the linker able to
>> strip parts of it. This introduces additional code to the "dummmy" test
>> executable, which ensures that all parts of the library needed to
>> evaluate the expressions are always present.
>>
>>
>> https://reviews.llvm.org/D39727
>>
>> Files:
>>
>> packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
>>   packages/Python/lldbsuite/test/expression_command/top-level/dummy.cpp
>>
>>
>> Index:
>> packages/Python/lldbsuite/test/expression_command/top-level/dummy.cpp
>> ===================================================================
>> --- packages/Python/lldbsuite/test/expression_command/top-level/dummy.cpp
>> +++ packages/Python/lldbsuite/test/expression_command/top-level/dummy.cpp
>> @@ -1,7 +1,15 @@
>>  #include <stdio.h>
>>
>> -int main()
>> -{
>> -    printf("This is a dummy\n"); // Set breakpoint here
>> -    return 0;
>> +// These are needed to make sure that the linker does not strip the parts
>> of the
>> +// C++ abi library that are necessary to execute the expressions in the
>> +// debugger. It would be great if we did not need to do this, but the
>> fact that
>> +// LLDB cannot conjure up the abi library on demand is not relevant for
>> testing
>> +// top level expressions.
>> +struct DummyA {};
>> +struct DummyB : public virtual DummyA {};
>> +
>> +int main() {
>> +  DummyB b;
>> +  printf("This is a dummy\n"); // Set breakpoint here
>> +  return 0;
>>  }
>> Index:
>> packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
>> ===================================================================
>> ---
>> packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
>> +++
>> packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
>> @@ -57,23 +57,6 @@
>>          self.runCmd("run", RUN_SUCCEEDED)
>>
>>      @add_test_categories(['pyapi'])
>> -    @expectedFailureAndroid(api_levels=list(range(22+1)),
>> bugnumber="llvm.org/pr27787")
>> -    @expectedFailureAll(
>> -        oslist=["linux"],
>> -        archs=[
>> -            "arm",
>> -            "aarch64"],
>> -        bugnumber="llvm.org/pr27787")
>> -    @expectedFailureAll(
>> -        bugnumber="llvm.org/pr28353",
>> -        oslist=["linux"],
>> -        archs=[
>> -            "i386",
>> -            "x86_64"],
>> -        compiler="gcc",
>> -        compiler_version=[
>> -            "<",
>> -            "4.9"])
>>      @skipIf(debug_info="gmodules")  # not relevant
>>      @skipIf(oslist=["windows"])  # Error in record layout on Windows
>>      def test_top_level_expressions(self):
>>
>>
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


More information about the lldb-commits mailing list