[debuginfo-tests] r318435 - Resubmit "Refactor debuginfo-tests"

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 16:32:34 PST 2017


Ok, I think this is the problem:

zturner at zturner-goobuntu:~/ssd/src/llvmbuild/ninja$ ninja -nv check-all |
grep debuginfo-tests
[388/389] cd /usr/local/google/home/zturner/ssd/src/llvmbuild/ninja &&
   /usr/bin/python2.7
/usr/local/google/home/zturner/ssd/src/llvmbuild/ninja/./bin/llvm-lit
   -sv

 /usr/local/google/home/zturner/ssd/src/llvmbuild/ninja/tools/clang/test/debuginfo-tests
   /usr/local/google/home/zturner/ssd/src/llvmbuild/ninja/tools/clang/test
   /usr/local/google/home/zturner/ssd/src/llvmbuild/ninja/utils/lit
   /usr/local/google/home/zturner/ssd/src/llvmbuild/ninja/test

Anyway, at least I have a general idea what's going on.  I'll revert for
now and try to fix tomorrow.

On Thu, Nov 16, 2017 at 4:09 PM Adrian Prantl <aprantl at apple.com> wrote:

>
> On Nov 16, 2017, at 4:05 PM, Zachary Turner <zturner at google.com> wrote:
>
> All I need to reproduce is running the test twice.
>
>
> I see. That should work!
>
> If I can repro that on Linux I can probably find the cause of that.
> Anyway, give me 10 minutes to try to repro the double test run on Linux.
> After that I'll revert if I can't repro or the fix is not trivial.
>
>
> Sure thing.
>
> -- adrian
>
>
> On Thu, Nov 16, 2017 at 4:04 PM Adrian Prantl <aprantl at apple.com> wrote:
>
>>
>> On Nov 16, 2017, at 3:58 PM, Zachary Turner <zturner at google.com> wrote:
>>
>> vla:
>>
>> // RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
>> // RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out
>> // RUN: %test_debuginfo %s %t.out
>>
>> foreach:
>> // RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
>> // RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out -framework
>> Foundation
>> // RUN: %test_debuginfo %s %t.out
>>
>>
>> Okay, then maybe it is the fact that those tests compiler slower, or that
>> lldb takes longer to load them.
>>
>>
>> I'm trying to reproduce on a linux box.
>>
>>
>> Most likely you can't reproduce this error on Linux, because the debug
>> info is being processed by the linker itself, and the linker has no way of
>> diagnosing this issue. On Darwin the linker records a pointer back to the
>> .o file (with a timestamp of the .o file) into the executable's symbol
>> table, and LLDB then diagnoses the mismatch. On Linux GDB only sees the
>> linked debug info in the executable, so it will never know that the .o file
>> was overwritten later.
>>
>>
>> I can revert, but I think at this point if this takes more than another
>> day or so I'm going to start exploring other avenues for testing CodeView
>> debug info that do not involve debuginfo-tests.  It would be a shame to
>> have a separate repo, but I don't have much more time to spend on this.
>>
>>
>> I can feel the pain :-(
>> but I kind of also want our bots to run.. :-)
>>
>>
>> On Thu, Nov 16, 2017 at 3:55 PM Adrian Prantl <aprantl at apple.com> wrote:
>>
>>> What do the RUN lines in the tests say?
>>>
>>>
>>> On Nov 16, 2017, at 3:53 PM, Zachary Turner <zturner at google.com> wrote:
>>>
>>> It's too bad it doesn't show the command output from the passed runs :-/
>>>
>>> Failure:
>>> http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/40578/testReport/debuginfo-tests/debuginfo-tests/vla_c/
>>> Pass:
>>> http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/40578/testReport/debuginfo-tests/debuginfo-tests/vla_c_2/
>>>
>>> On Thu, Nov 16, 2017 at 3:52 PM Adrian Prantl <aprantl at apple.com> wrote:
>>>
>>>> Alternatively, perhaps the other tests all use a single clang driver
>>>> invocation with the clang driver choosing a temporary object file and these
>>>> two manually specify a name for the .o file.
>>>>
>>>> -- adrian
>>>>
>>>>
>>>> On Nov 16, 2017, at 3:50 PM, Adrian Prantl via llvm-commits <
>>>> llvm-commits at lists.llvm.org> wrote:
>>>>
>>>> I think this makes sense: Last time they failed because they were the
>>>> only ones that needed an SDKROOT, and this time they failed because they
>>>> are the only ones that take longer to compile (because the #import some
>>>> huge system headers). All other tests are so short that they compile
>>>> instantaneously. These two include system frameworks so they take longer to
>>>> compile and thus are scheduled to run twice at the same time.
>>>>
>>>> -- adrian
>>>>
>>>> On Nov 16, 2017, at 3:47 PM, Zachary Turner <zturner at google.com> wrote:
>>>>
>>>> Are you sure that's actually the problem?  Because it's mighty
>>>> suspicious that it's the exact same two tests that failed with the previous
>>>> version of the patch.
>>>>
>>>> On Thu, Nov 16, 2017 at 3:42 PM Adrian Prantl <aprantl at apple.com>
>>>> wrote:
>>>>
>>>>> No, because it won't fix the issue. All debuginfo-tests tests are
>>>>> running twice, and whichever test happens to be scheduled to execute
>>>>> simultaneously will fail, but it's nothing special about these two tests,
>>>>> they just compile slow enough for the problem to manifest.
>>>>>
>>>>> -- adrian
>>>>>
>>>>>
>>>>> On Nov 16, 2017, at 3:37 PM, Zachary Turner <zturner at google.com>
>>>>> wrote:
>>>>>
>>>>> Can we disable these two tests for now until we can look into this?
>>>>> I'd like to fix it, but this isn't something that I have the ability to
>>>>> diagnose on my end and I'm going to be blocked again if we end up having to
>>>>> revert.  :-/
>>>>>
>>>>> On Thu, Nov 16, 2017 at 3:34 PM Zachary Turner <zturner at google.com>
>>>>> wrote:
>>>>>
>>>>>> We can try a clobber.  Another possibility is that in an effort to
>>>>>> make it so you can run it using both workflows, it now ends up running it
>>>>>> twice.  Once the old way (by descending into it from the clang tree) and
>>>>>> once the new way (.
>>>>>>
>>>>>> Does this not reproduce for you locally when running ninja
>>>>>> check-clang?
>>>>>>
>>>>>> I don't think the directory mismatch is a problem.  In
>>>>>> debuginfo-tests/lit.cfg.py I explicitly set the output directory to
>>>>>> that location.  I don't think it should matter that it's Output instead of
>>>>>> Output/tests
>>>>>>
>>>>>> On Thu, Nov 16, 2017 at 3:29 PM Adrian Prantl <aprantl at apple.com>
>>>>>> wrote:
>>>>>>
>>>>>>> It looks like it is actually running the test twice:
>>>>>>> FAIL: debuginfo-tests :: foreach.m (34967 of 40843)
>>>>>>> ...
>>>>>>> PASS: debuginfo-tests :: foreach.m (34972 of 40843)
>>>>>>>
>>>>>>> does that help to narrow it down?
>>>>>>>
>>>>>>> On Nov 16, 2017, at 3:21 PM, Adrian Prantl via llvm-commits <
>>>>>>> llvm-commits at lists.llvm.org> wrote:
>>>>>>>
>>>>>>> Debugger output was: imported lldb from:
>>>>>>> "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/Python"
>>>>>>> error: vla.c.tmp.out debug map object file
>>>>>>> '/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/clang-build/tools/clang/test/debuginfo-tests/Output/vla.c.tmp.o'
>>>>>>> has changed (actual time is 0x5a0de4bc, debug map time is 0x5a0de4bb) since
>>>>>>> this executable was linked, file will be ignored
>>>>>>>
>>>>>>>
>>>>>>> These are different errors than last time. Could it be that there is
>>>>>>> a directory mismatch? You moved the tests to tests/ but this path is in
>>>>>>> Output/ instead of Output/tests?
>>>>>>>
>>>>>>> It looks like it is finding a file from the build before the big
>>>>>>> rename. But this is just speculation.
>>>>>>>
>>>>>>> -- adrian
>>>>>>>
>>>>>>> On Nov 16, 2017, at 3:13 PM, Zachary Turner <zturner at google.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>> Uhh, well that's weird.  a because I didn't get an email (or maybe
>>>>>>> it got filtered somehow), and b) because I made the fix that we thought was
>>>>>>> going to work.
>>>>>>>
>>>>>>> Can you think of a way to diagnose this?
>>>>>>>
>>>>>>> (One option is disabling these two tests until we figure it out.
>>>>>>> It's not ideal but the code churn from repeated reverts and resubmits is
>>>>>>> pretty unfortunate)
>>>>>>>
>>>>>>> On Thu, Nov 16, 2017 at 3:01 PM Adrian Prantl <aprantl at apple.com>
>>>>>>> wrote:
>>>>>>> Looks like this broke the Darwin bots again:
>>>>>>>
>>>>>>> http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/40578/
>>>>>>>
>>>>>>> -- adrian
>>>>>>>
>>>>>>>
>>>>>>> On Nov 16, 2017, at 10:26 AM, Zachary Turner via llvm-commits <
>>>>>>> llvm-commits at lists.llvm.org> wrote:
>>>>>>>
>>>>>>> Author: zturner
>>>>>>> Date: Thu Nov 16 10:26:20 2017
>>>>>>> New Revision: 318435
>>>>>>>
>>>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=318435&view=rev
>>>>>>> Log:
>>>>>>> Resubmit "Refactor debuginfo-tests"
>>>>>>>
>>>>>>> This was reverted due to some failures on specific darwin buildbots,
>>>>>>> the issue being that the new lit configuration was not setting the
>>>>>>> SDKROOT environment variable.  We've tested a fix locally and
>>>>>>> confirmed
>>>>>>> that it works, so this patch resubmits everything with the fix
>>>>>>> applied.
>>>>>>>
>>>>>>> Added:
>>>>>>>   debuginfo-tests/trunk/CMakeLists.txt
>>>>>>>   debuginfo-tests/trunk/lit.cfg.py
>>>>>>>   debuginfo-tests/trunk/lit.site.cfg.py.in
>>>>>>>   debuginfo-tests/trunk/tests/
>>>>>>>   debuginfo-tests/trunk/tests/aggregate-indirect-arg.cpp
>>>>>>>   debuginfo-tests/trunk/tests/asan-blocks.c
>>>>>>>   debuginfo-tests/trunk/tests/asan.c
>>>>>>>   debuginfo-tests/trunk/tests/block_var.m
>>>>>>>   debuginfo-tests/trunk/tests/blocks.m
>>>>>>>   debuginfo-tests/trunk/tests/ctor.cpp
>>>>>>>   debuginfo-tests/trunk/tests/dbg-arg.c
>>>>>>>   debuginfo-tests/trunk/tests/foreach.m
>>>>>>>   debuginfo-tests/trunk/tests/forward-declare-class.cpp
>>>>>>>   debuginfo-tests/trunk/tests/lit.local.cfg
>>>>>>>   debuginfo-tests/trunk/tests/llgdb.py
>>>>>>>   debuginfo-tests/trunk/tests/nested-struct.cpp
>>>>>>>   debuginfo-tests/trunk/tests/nrvo-string.cpp
>>>>>>>   debuginfo-tests/trunk/tests/safestack.c
>>>>>>>   debuginfo-tests/trunk/tests/sret.cpp
>>>>>>>   debuginfo-tests/trunk/tests/stack-var.c
>>>>>>>   debuginfo-tests/trunk/tests/static-member-2.cpp
>>>>>>>   debuginfo-tests/trunk/tests/static-member.cpp
>>>>>>>   debuginfo-tests/trunk/tests/vla.c
>>>>>>> Removed:
>>>>>>>   debuginfo-tests/trunk/aggregate-indirect-arg.cpp
>>>>>>>   debuginfo-tests/trunk/asan-blocks.c
>>>>>>>   debuginfo-tests/trunk/asan.c
>>>>>>>   debuginfo-tests/trunk/block_var.m
>>>>>>>   debuginfo-tests/trunk/blocks.m
>>>>>>>   debuginfo-tests/trunk/ctor.cpp
>>>>>>>   debuginfo-tests/trunk/dbg-arg.c
>>>>>>>   debuginfo-tests/trunk/foreach.m
>>>>>>>   debuginfo-tests/trunk/forward-declare-class.cpp
>>>>>>>   debuginfo-tests/trunk/lit.local.cfg
>>>>>>>   debuginfo-tests/trunk/llgdb.py
>>>>>>>   debuginfo-tests/trunk/nested-struct.cpp
>>>>>>>   debuginfo-tests/trunk/nrvo-string.cpp
>>>>>>>   debuginfo-tests/trunk/safestack.c
>>>>>>>   debuginfo-tests/trunk/sret.cpp
>>>>>>>   debuginfo-tests/trunk/stack-var.c
>>>>>>>   debuginfo-tests/trunk/static-member-2.cpp
>>>>>>>   debuginfo-tests/trunk/static-member.cpp
>>>>>>>   debuginfo-tests/trunk/vla.c
>>>>>>>
>>>>>>> Added: debuginfo-tests/trunk/CMakeLists.txt
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/CMakeLists.txt?rev=318435&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/CMakeLists.txt (added)
>>>>>>> +++ debuginfo-tests/trunk/CMakeLists.txt Thu Nov 16 10:26:20 2017
>>>>>>> @@ -0,0 +1,36 @@
>>>>>>> +# Debug Info tests.  These tests invoke clang to generate programs
>>>>>>> with
>>>>>>> +# various types of debug info, and then run those programs under a
>>>>>>> debugger
>>>>>>> +# such as GDB or LLDB to verify the results.
>>>>>>> +
>>>>>>> +set(DEBUGINFO_TESTS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
>>>>>>> +set(DEBUGINFO_TESTS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
>>>>>>> +
>>>>>>> +set(DEBUGINFO_TEST_DEPS
>>>>>>> +  clang
>>>>>>> +  llvm-config
>>>>>>> +  FileCheck
>>>>>>> +  count
>>>>>>> +  not
>>>>>>> +  )
>>>>>>> +
>>>>>>> +get_target_property(CLANG_SOURCE_DIR clang SOURCE_DIR)
>>>>>>> +
>>>>>>> +if (TARGET lld)
>>>>>>> +  set(DEBUGINFO_TESTS_HAS_LLD 1)
>>>>>>> +  list(APPEND DEBUGINFO_TEST_DEPS lld)
>>>>>>> +  get_target_property(LLD_SOURCE_DIR lld SOURCE_DIR)
>>>>>>> +endif()
>>>>>>> +
>>>>>>> +configure_lit_site_cfg(
>>>>>>> +  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
>>>>>>> +  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
>>>>>>> +  MAIN_CONFIG
>>>>>>> +  ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
>>>>>>> +  )
>>>>>>> +
>>>>>>> +add_lit_testsuite(check-debuginfo "Running debug info integration
>>>>>>> tests"
>>>>>>> +  ${CMAKE_CURRENT_BINARY_DIR}
>>>>>>> +  DEPENDS ${DEBUGINFO_TEST_DEPS}
>>>>>>> +  )
>>>>>>> +
>>>>>>> +set_target_properties(check-debuginfo PROPERTIES FOLDER "Debug info
>>>>>>> tests")
>>>>>>> \ No newline at end of file
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/aggregate-indirect-arg.cpp
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/aggregate-indirect-arg.cpp?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/aggregate-indirect-arg.cpp (original)
>>>>>>> +++ debuginfo-tests/trunk/aggregate-indirect-arg.cpp (removed)
>>>>>>> @@ -1,32 +0,0 @@
>>>>>>> -// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o
>>>>>>> %t.o
>>>>>>> -// RUN: %clangxx %target_itanium_abi_host_triple %t.o -o %t.out
>>>>>>> -// RUN: %test_debuginfo %s %t.out
>>>>>>> -// Radar 8945514
>>>>>>> -// DEBUGGER: break 22
>>>>>>> -// DEBUGGER: r
>>>>>>> -// DEBUGGER: p v
>>>>>>> -// CHECK: ${{[0-9]+}} =
>>>>>>> -// CHECK:  Data ={{.*}} 0x0{{(0*)}}
>>>>>>> -// CHECK:  Kind = 2142
>>>>>>> -
>>>>>>> -class SVal {
>>>>>>> -public:
>>>>>>> -  ~SVal() {}
>>>>>>> -  const void* Data;
>>>>>>> -  unsigned Kind;
>>>>>>> -};
>>>>>>> -
>>>>>>> -void bar(SVal &v) {}
>>>>>>> -class A {
>>>>>>> -public:
>>>>>>> -  void foo(SVal v) { bar(v); }
>>>>>>> -};
>>>>>>> -
>>>>>>> -int main() {
>>>>>>> -  SVal v;
>>>>>>> -  v.Data = 0;
>>>>>>> -  v.Kind = 2142;
>>>>>>> -  A a;
>>>>>>> -  a.foo(v);
>>>>>>> -  return 0;
>>>>>>> -}
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/asan-blocks.c
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/asan-blocks.c?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/asan-blocks.c (original)
>>>>>>> +++ debuginfo-tests/trunk/asan-blocks.c (removed)
>>>>>>> @@ -1,41 +0,0 @@
>>>>>>> -// RUN: %clang -fblocks %target_itanium_abi_host_triple -arch
>>>>>>> x86_64 %s -o %t.out -g -fsanitize=address
>>>>>>> -// RUN: %test_debuginfo %s %t.out
>>>>>>> -// FIXME: Remove system-darwin when we build BlocksRuntime
>>>>>>> everywhere.
>>>>>>> -// REQUIRES: not_asan, system-darwin
>>>>>>> -//           Zorg configures the ASAN stage2 bots to not build the
>>>>>>> asan
>>>>>>> -//           compiler-rt. Only run this test on non-asanified
>>>>>>> configurations.
>>>>>>> -void b();
>>>>>>> -struct S {
>>>>>>> -  int a[8];
>>>>>>> -};
>>>>>>> -
>>>>>>> -int f(struct S s, unsigned i) {
>>>>>>> -  // DEBUGGER: break 17
>>>>>>> -  // DEBUGGER: r
>>>>>>> -  // DEBUGGER: p s
>>>>>>> -  // CHECK: a = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] =
>>>>>>> 5, [6] = 6, [7] = 7)
>>>>>>> -  return s.a[i];
>>>>>>> -}
>>>>>>> -
>>>>>>> -int main(int argc, const char **argv) {
>>>>>>> -  struct S s = {{0, 1, 2, 3, 4, 5, 6, 7}};
>>>>>>> -  if (f(s, 4) == 4) {
>>>>>>> -    // DEBUGGER: break 27
>>>>>>> -    // DEBUGGER: c
>>>>>>> -    // DEBUGGER: p s
>>>>>>> -    // CHECK: a = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5]
>>>>>>> = 5, [6] = 6, [7] = 7)
>>>>>>> -    b();
>>>>>>> -  }
>>>>>>> -  return 0;
>>>>>>> -}
>>>>>>> -
>>>>>>> -void c() {}
>>>>>>> -
>>>>>>> -void b() {
>>>>>>> -  // DEBUGGER: break 40
>>>>>>> -  // DEBUGGER: c
>>>>>>> -  // DEBUGGER: p x
>>>>>>> -  // CHECK: 42
>>>>>>> -  __block int x = 42;
>>>>>>> -  c();
>>>>>>> -}
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/asan.c
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/asan.c?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/asan.c (original)
>>>>>>> +++ debuginfo-tests/trunk/asan.c (removed)
>>>>>>> @@ -1,31 +0,0 @@
>>>>>>> -// RUN: %clang -fblocks %target_itanium_abi_host_triple -arch
>>>>>>> x86_64 %s -o %t.out -g -fsanitize=address
>>>>>>> -// RUN: %test_debuginfo %s %t.out
>>>>>>> -// REQUIRES: not_asan
>>>>>>> -//           Zorg configures the ASAN stage2 bots to not build the
>>>>>>> asan
>>>>>>> -//           compiler-rt. Only run this test on non-asanified
>>>>>>> configurations.
>>>>>>> -//
>>>>>>> -
>>>>>>> -struct S {
>>>>>>> -  int a[8];
>>>>>>> -};
>>>>>>> -
>>>>>>> -int f(struct S s, unsigned i) {
>>>>>>> -  // DEBUGGER: break 14
>>>>>>> -  return s.a[i];
>>>>>>> -}
>>>>>>> -
>>>>>>> -int main(int argc, const char **argv) {
>>>>>>> -  struct S s = {{0, 1, 2, 3, 4, 5, 6, 7}};
>>>>>>> -  if (f(s, 4) == 4)
>>>>>>> -    return f(s, 0);
>>>>>>> -  return 0;
>>>>>>> -}
>>>>>>> -
>>>>>>> -// DEBUGGER: r
>>>>>>> -// DEBUGGER: p s
>>>>>>> -// CHECK: a =
>>>>>>> -// DEBUGGER: p s.a[0]
>>>>>>> -// CHECK: = 0
>>>>>>> -// DEBUGGER: p s.a[1]
>>>>>>> -// CHECK: = 1
>>>>>>> -// DEBUGGER: p s.a[7]
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/block_var.m
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/block_var.m?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/block_var.m (original)
>>>>>>> +++ debuginfo-tests/trunk/block_var.m (removed)
>>>>>>> @@ -1,32 +0,0 @@
>>>>>>> -// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
>>>>>>> -// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out
>>>>>>> -framework Foundation
>>>>>>> -// RUN: %test_debuginfo %s %t.out
>>>>>>> -
>>>>>>> -// REQUIRES: system-darwin
>>>>>>> -
>>>>>>> -// DEBUGGER: break 24
>>>>>>> -// DEBUGGER: r
>>>>>>> -// DEBUGGER: p result
>>>>>>> -// CHECK: ${{[0-9]}} = 42
>>>>>>> -
>>>>>>> -void doBlock(void (^block)(void))
>>>>>>> -{
>>>>>>> -    block();
>>>>>>> -}
>>>>>>> -
>>>>>>> -int I(int n)
>>>>>>> -{
>>>>>>> -    __block int result;
>>>>>>> -    int i = 2;
>>>>>>> -    doBlock(^{
>>>>>>> -        result = n;
>>>>>>> -    });
>>>>>>> -    return result + i; /* Check value of 'result' */
>>>>>>> -}
>>>>>>> -
>>>>>>> -
>>>>>>> -int main (int argc, const char * argv[]) {
>>>>>>> -  return I(42);
>>>>>>> -}
>>>>>>> -
>>>>>>> -
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/blocks.m
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/blocks.m?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/blocks.m (original)
>>>>>>> +++ debuginfo-tests/trunk/blocks.m (removed)
>>>>>>> @@ -1,43 +0,0 @@
>>>>>>> -// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
>>>>>>> -// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out
>>>>>>> -framework Foundation
>>>>>>> -// RUN: %test_debuginfo %s %t.out
>>>>>>> -
>>>>>>> -// REQUIRES: system-darwin
>>>>>>> -// Radar 9279956
>>>>>>> -
>>>>>>> -// DEBUGGER: break 31
>>>>>>> -// DEBUGGER: r
>>>>>>> -// DEBUGGER: p m2
>>>>>>> -// CHECK: ${{[0-9]}} = 1
>>>>>>> -// DEBUGGER: p dbTransaction
>>>>>>> -// CHECK: ${{[0-9]}} = 0
>>>>>>> -// DEBUGGER: p master
>>>>>>> -// CHECK: ${{[0-9]}} = 0
>>>>>>> -
>>>>>>> -#include <Cocoa/Cocoa.h>
>>>>>>> -
>>>>>>> -extern void foo(void(^)(void));
>>>>>>> -
>>>>>>> - at interface A:NSObject @end
>>>>>>> - at implementation A
>>>>>>> -- (void) helper {
>>>>>>> - int master = 0;
>>>>>>> - __block int m2 = 0;
>>>>>>> - __block int dbTransaction = 0;
>>>>>>> - int (^x)(void) = ^(void) { (void) self;
>>>>>>> - (void) master;
>>>>>>> - (void) dbTransaction;
>>>>>>> - m2++;
>>>>>>> - return m2;
>>>>>>> - };
>>>>>>> -  master = x();
>>>>>>> -}
>>>>>>> - at end
>>>>>>> -
>>>>>>> -void foo(void(^x)(void)) {}
>>>>>>> -
>>>>>>> -int main() {
>>>>>>> - A *a = [A alloc];
>>>>>>> - [a helper];
>>>>>>> - return 0;
>>>>>>> -}
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/ctor.cpp
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/ctor.cpp?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/ctor.cpp (original)
>>>>>>> +++ debuginfo-tests/trunk/ctor.cpp (removed)
>>>>>>> @@ -1,25 +0,0 @@
>>>>>>> -// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o
>>>>>>> %t.o
>>>>>>> -// RUN: %clangxx %target_itanium_abi_host_triple %t.o -o %t.out
>>>>>>> -// RUN: %test_debuginfo %s %t.out
>>>>>>> -
>>>>>>> -
>>>>>>> -// DEBUGGER: break 14
>>>>>>> -// DEBUGGER: r
>>>>>>> -// DEBUGGER: p *this
>>>>>>> -// CHECK-NEXT-NOT: Cannot access memory at address
>>>>>>> -
>>>>>>> -class A {
>>>>>>> -public:
>>>>>>> - A() : zero(0), data(42)
>>>>>>> - {
>>>>>>> - }
>>>>>>> -private:
>>>>>>> - int zero;
>>>>>>> - int data;
>>>>>>> -};
>>>>>>> -
>>>>>>> -int main() {
>>>>>>> - A a;
>>>>>>> - return 0;
>>>>>>> -}
>>>>>>> -
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/dbg-arg.c
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/dbg-arg.c?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/dbg-arg.c (original)
>>>>>>> +++ debuginfo-tests/trunk/dbg-arg.c (removed)
>>>>>>> @@ -1,46 +0,0 @@
>>>>>>> -// This test case checks debug info during register moves for an
>>>>>>> argument.
>>>>>>> -// RUN: %clang %target_itanium_abi_host_triple -m64 -mllvm
>>>>>>> -fast-isel=false  %s -c -o %t.o -g
>>>>>>> -// RUN: %clang %target_itanium_abi_host_triple -m64 %t.o -o %t.out
>>>>>>> -// RUN: %test_debuginfo %s %t.out
>>>>>>> -//
>>>>>>> -// DEBUGGER: break 26
>>>>>>> -// DEBUGGER: r
>>>>>>> -// DEBUGGER: print mutex
>>>>>>> -// CHECK:  ={{.* 0x[0-9A-Fa-f]+}}
>>>>>>> -//
>>>>>>> -// Radar 8412415
>>>>>>> -
>>>>>>> -struct _mtx
>>>>>>> -{
>>>>>>> -  long unsigned int ptr;
>>>>>>> -  int waiters;
>>>>>>> -  struct {
>>>>>>> -    int tag;
>>>>>>> -    int pad;
>>>>>>> -  } mtxi;
>>>>>>> -};
>>>>>>> -
>>>>>>> -
>>>>>>> -int foobar(struct _mtx *mutex) {
>>>>>>> -  int r = 1;
>>>>>>> -  int l = 0;
>>>>>>> -  int j = 0;
>>>>>>> -  do {
>>>>>>> -    if (mutex->waiters) {
>>>>>>> -      r = 2;
>>>>>>> -    }
>>>>>>> -    j = bar(r, l);
>>>>>>> -    ++l;
>>>>>>> -  } while (l < j);
>>>>>>> -  return r + j;
>>>>>>> -}
>>>>>>> -
>>>>>>> -int bar(int i, int j) {
>>>>>>> -  return i + j;
>>>>>>> -}
>>>>>>> -
>>>>>>> -int main() {
>>>>>>> -  struct _mtx m;
>>>>>>> -  m.waiters = 0;
>>>>>>> -  return foobar(&m);
>>>>>>> -}
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/foreach.m
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/foreach.m?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/foreach.m (original)
>>>>>>> +++ debuginfo-tests/trunk/foreach.m (removed)
>>>>>>> @@ -1,31 +0,0 @@
>>>>>>> -// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
>>>>>>> -// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out
>>>>>>> -framework Foundation
>>>>>>> -// RUN: %test_debuginfo %s %t.out
>>>>>>> -//
>>>>>>> -// REQUIRES: system-darwin
>>>>>>> -// Radar 8757124
>>>>>>> -
>>>>>>> -// DEBUGGER: break 25
>>>>>>> -// DEBUGGER: r
>>>>>>> -// DEBUGGER: po thing
>>>>>>> -// CHECK: aaa
>>>>>>> -
>>>>>>> -#import <Foundation/Foundation.h>
>>>>>>> -
>>>>>>> -int main (int argc, const char * argv[]) {
>>>>>>> -
>>>>>>> -    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>>>>>>> -    NSArray *things = [NSArray arrayWithObjects:@"one", @"two",
>>>>>>> @"three" , nil];
>>>>>>> -    for (NSString *thing in things) {
>>>>>>> -        NSLog (@"%@", thing);
>>>>>>> -    }
>>>>>>> -
>>>>>>> -    things = [NSArray arrayWithObjects:@"aaa", @"bbb", @"ccc" ,
>>>>>>> nil];
>>>>>>> -    for (NSString *thing in things) {
>>>>>>> -        NSLog (@"%@", thing);
>>>>>>> -    }
>>>>>>> -    [pool release];
>>>>>>> -    return 0;
>>>>>>> -}
>>>>>>> -
>>>>>>> -
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/forward-declare-class.cpp
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/forward-declare-class.cpp?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/forward-declare-class.cpp (original)
>>>>>>> +++ debuginfo-tests/trunk/forward-declare-class.cpp (removed)
>>>>>>> @@ -1,27 +0,0 @@
>>>>>>> -// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o
>>>>>>> %t.o
>>>>>>> -// RUN: %test_debuginfo %s %t.o
>>>>>>> -// Radar 9168773
>>>>>>> -
>>>>>>> -// DEBUGGER: ptype A
>>>>>>> -// Work around a gdb bug where it believes that a class is a
>>>>>>> -// struct if there aren't any methods - even though it's tagged
>>>>>>> -// as a class.
>>>>>>> -// CHECK: type = {{struct|class}} A {
>>>>>>> -// CHECK-NEXT: {{(public:){0,1}}}
>>>>>>> -// CHECK-NEXT: int MyData;
>>>>>>> -// CHECK-NEXT: }
>>>>>>> -class A;
>>>>>>> -class B {
>>>>>>> -public:
>>>>>>> -  void foo(const A *p);
>>>>>>> -};
>>>>>>> -
>>>>>>> -B iEntry;
>>>>>>> -
>>>>>>> -class A {
>>>>>>> -public:
>>>>>>> -  int MyData;
>>>>>>> -};
>>>>>>> -
>>>>>>> -A irp;
>>>>>>> -
>>>>>>>
>>>>>>> Added: debuginfo-tests/trunk/lit.cfg.py
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/lit.cfg.py?rev=318435&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/lit.cfg.py (added)
>>>>>>> +++ debuginfo-tests/trunk/lit.cfg.py Thu Nov 16 10:26:20 2017
>>>>>>> @@ -0,0 +1,59 @@
>>>>>>> +# -*- Python -*-
>>>>>>> +
>>>>>>> +import os
>>>>>>> +import platform
>>>>>>> +import re
>>>>>>> +import subprocess
>>>>>>> +import tempfile
>>>>>>> +
>>>>>>> +import lit.formats
>>>>>>> +import lit.util
>>>>>>> +
>>>>>>> +from lit.llvm import llvm_config
>>>>>>> +from lit.llvm.subst import ToolSubst
>>>>>>> +from lit.llvm.subst import FindTool
>>>>>>> +
>>>>>>> +# Configuration file for the 'lit' test runner.
>>>>>>> +
>>>>>>> +# name: The name of this test suite.
>>>>>>> +config.name = 'debuginfo-tests'
>>>>>>> +
>>>>>>> +# testFormat: The test format to use to interpret tests.
>>>>>>> +#
>>>>>>> +# For now we require '&&' between commands, until they get globally
>>>>>>> killed and
>>>>>>> +# the test runner updated.
>>>>>>> +config.test_format = lit.formats.ShTest(not
>>>>>>> llvm_config.use_lit_shell)
>>>>>>> +
>>>>>>> +# suffixes: A list of file extensions to treat as test files.
>>>>>>> +config.suffixes = ['.c', '.cpp', '.m']
>>>>>>> +
>>>>>>> +# excludes: A list of directories to exclude from the testsuite.
>>>>>>> The 'Inputs'
>>>>>>> +# subdirectories contain auxiliary inputs for various tests in
>>>>>>> their parent
>>>>>>> +# directories.
>>>>>>> +config.excludes = ['Inputs']
>>>>>>> +
>>>>>>> +# test_source_root: The root path where tests are located.
>>>>>>> +config.test_source_root =
>>>>>>> os.path.join(config.debuginfo_tests_src_root, 'tests')
>>>>>>> +
>>>>>>> +# test_exec_root: The root path where tests should be run.
>>>>>>> +config.test_exec_root = config.debuginfo_tests_obj_root
>>>>>>> +
>>>>>>> +llvm_config.use_default_substitutions()
>>>>>>> +
>>>>>>> +llvm_config.use_clang()
>>>>>>> +
>>>>>>> +if config.llvm_use_sanitizer:
>>>>>>> +    # Propagate path to symbolizer for ASan/MSan.
>>>>>>> +    llvm_config.with_system_environment(
>>>>>>> +        ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'])
>>>>>>> +
>>>>>>> +tool_dirs = [config.llvm_tools_dir]
>>>>>>> +
>>>>>>> +tools = [
>>>>>>> +    ToolSubst('%test_debuginfo', command=os.path.join(
>>>>>>> +        config.llvm_src_root, 'utils', 'test_debuginfo.pl')),
>>>>>>> +]
>>>>>>> +
>>>>>>> +llvm_config.add_tool_substitutions(tools, tool_dirs)
>>>>>>> +
>>>>>>> +lit.util.usePlatformSdkOnDarwin(config, lit_config)
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/lit.local.cfg
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/lit.local.cfg?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/lit.local.cfg (original)
>>>>>>> +++ debuginfo-tests/trunk/lit.local.cfg (removed)
>>>>>>> @@ -1,3 +0,0 @@
>>>>>>> -# debuginfo-tests are not expected to pass in a cross-compilation
>>>>>>> setup.
>>>>>>> -if 'native' not in config.available_features:
>>>>>>> -    config.unsupported = True
>>>>>>>
>>>>>>> Added: debuginfo-tests/trunk/lit.site.cfg.py.in
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/lit.site.cfg.py.in?rev=318435&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/lit.site.cfg.py.in (added)
>>>>>>> +++ debuginfo-tests/trunk/lit.site.cfg.py.in Thu Nov 16 10:26:20
>>>>>>> 2017
>>>>>>> @@ -0,0 +1,25 @@
>>>>>>> + at LIT_SITE_CFG_IN_HEADER@
>>>>>>> +
>>>>>>> +import lit.util
>>>>>>> +
>>>>>>> +config.test_exec_root = "@CMAKE_BINARY_DIR@"
>>>>>>> +
>>>>>>> +config.llvm_src_root = "@LLVM_SOURCE_DIR@"
>>>>>>> +config.llvm_obj_root = "@LLVM_BINARY_DIR@"
>>>>>>> +config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
>>>>>>> +config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
>>>>>>> +config.llvm_shlib_dir = "@SHLIBDIR@"
>>>>>>> +config.llvm_plugin_ext = "@LLVM_PLUGIN_EXT@"
>>>>>>> +config.debuginfo_tests_obj_root = "@DEBUGINFO_TESTS_BINARY_DIR@"
>>>>>>> +config.debuginfo_tests_src_root = "@DEBUGINFO_TESTS_SOURCE_DIR@"
>>>>>>> +config.has_lld = lit.util.pythonize_bool("@DEBUGINFO_TESTS_HAS_LLD@
>>>>>>> ")
>>>>>>> +config.host_triple = "@LLVM_HOST_TRIPLE@"
>>>>>>> +config.target_triple = "@TARGET_TRIPLE@"
>>>>>>> +config.host_arch = "@HOST_ARCH@"
>>>>>>> +
>>>>>>> +config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
>>>>>>> +
>>>>>>> + at LIT_SITE_CFG_IN_FOOTER@
>>>>>>> +
>>>>>>> +# Let the main config do the real work.
>>>>>>> +lit_config.load_config(config, "@DEBUGINFO_TESTS_SOURCE_DIR@/
>>>>>>> lit.cfg.py")
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/llgdb.py
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/llgdb.py?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/llgdb.py (original)
>>>>>>> +++ debuginfo-tests/trunk/llgdb.py (removed)
>>>>>>> @@ -1,157 +0,0 @@
>>>>>>> -#!/bin/env python
>>>>>>> -"""
>>>>>>> -A gdb-compatible frontend for lldb that implements just enough
>>>>>>> -commands to run the tests in the debuginfo-tests repository with
>>>>>>> lldb.
>>>>>>> -"""
>>>>>>> -
>>>>>>> -#
>>>>>>> ----------------------------------------------------------------------
>>>>>>> -# Auto-detect lldb python module.
>>>>>>> -import commands, platform, os,  sys
>>>>>>> -try:
>>>>>>> -    # Just try for LLDB in case PYTHONPATH is already correctly
>>>>>>> setup.
>>>>>>> -    import lldb
>>>>>>> -except ImportError:
>>>>>>> -    lldb_python_dirs = list()
>>>>>>> -    # lldb is not in the PYTHONPATH, try some defaults for the
>>>>>>> current platform.
>>>>>>> -    platform_system = platform.system()
>>>>>>> -    if platform_system == 'Darwin':
>>>>>>> -        # On Darwin, try the currently selected Xcode directory
>>>>>>> -        xcode_dir = commands.getoutput("xcode-select --print-path")
>>>>>>> -        if xcode_dir:
>>>>>>> -            lldb_python_dirs.append(os.path.realpath(xcode_dir +
>>>>>>> -'/../SharedFrameworks/LLDB.framework/Resources/Python'))
>>>>>>> -            lldb_python_dirs.append(xcode_dir +
>>>>>>> -'/Library/PrivateFrameworks/LLDB.framework/Resources/Python')
>>>>>>> -        lldb_python_dirs.append(
>>>>>>> -'/System/Library/PrivateFrameworks/LLDB.framework/Resources/Python')
>>>>>>> -    success = False
>>>>>>> -    for lldb_python_dir in lldb_python_dirs:
>>>>>>> -        if os.path.exists(lldb_python_dir):
>>>>>>> -            if not (sys.path.__contains__(lldb_python_dir)):
>>>>>>> -                sys.path.append(lldb_python_dir)
>>>>>>> -                try:
>>>>>>> -                    import lldb
>>>>>>> -                except ImportError:
>>>>>>> -                    pass
>>>>>>> -                else:
>>>>>>> -                    print 'imported lldb from: "%s"' %
>>>>>>> (lldb_python_dir)
>>>>>>> -                    success = True
>>>>>>> -                    break
>>>>>>> -    if not success:
>>>>>>> -        print "error: couldn't locate the 'lldb' module, please set
>>>>>>> PYTHONPATH correctly"
>>>>>>> -        sys.exit(1)
>>>>>>> -#
>>>>>>> ----------------------------------------------------------------------
>>>>>>> -
>>>>>>> -# Command line option handling.
>>>>>>> -import argparse
>>>>>>> -parser = argparse.ArgumentParser(description=__doc__)
>>>>>>> -parser.add_argument('--quiet', '-q', action="store_true",
>>>>>>> help='ignored')
>>>>>>> -parser.add_argument('-batch', action="store_true",
>>>>>>> -                    help='exit after processing comand line')
>>>>>>> -parser.add_argument('-n', action="store_true", help='ignore .lldb
>>>>>>> file')
>>>>>>> -parser.add_argument('-x', dest='script', type=file, help='execute
>>>>>>> commands from file')
>>>>>>> -parser.add_argument("target", help="the program to debug")
>>>>>>> -args = parser.parse_args()
>>>>>>> -
>>>>>>> -
>>>>>>> -# Create a new debugger instance.
>>>>>>> -debugger = lldb.SBDebugger.Create()
>>>>>>> -debugger.SkipLLDBInitFiles(args.n)
>>>>>>> -
>>>>>>> -# Don't return from lldb function calls until the process stops.
>>>>>>> -debugger.SetAsync(False)
>>>>>>> -
>>>>>>> -# Create a target from a file and arch.
>>>>>>> -arch = os.popen("file "+args.target).read().split()[-1]
>>>>>>> -target = debugger.CreateTargetWithFileAndArch(args.target, arch)
>>>>>>> -
>>>>>>> -if not target:
>>>>>>> -    print "Could not create target", args.target
>>>>>>> -    sys.exit(1)
>>>>>>> -
>>>>>>> -if not args.script:
>>>>>>> -    print "Interactive mode is not implemented."
>>>>>>> -    sys.exit(1)
>>>>>>> -
>>>>>>> -import re
>>>>>>> -for command in args.script:
>>>>>>> -    # Strip newline and whitespaces and split into words.
>>>>>>> -    cmd = command[:-1].strip().split()
>>>>>>> -    if not cmd:
>>>>>>> -        continue
>>>>>>> -
>>>>>>> -    print '> %s'% command[:-1]
>>>>>>> -
>>>>>>> -    try:
>>>>>>> -        if re.match('^r|(run)$', cmd[0]):
>>>>>>> -            error = lldb.SBError()
>>>>>>> -            launchinfo = lldb.SBLaunchInfo([])
>>>>>>> -            launchinfo.SetWorkingDirectory(os.getcwd())
>>>>>>> -            process = target.Launch(launchinfo, error)
>>>>>>> -            print error
>>>>>>> -            if not process or error.fail:
>>>>>>> -                state = process.GetState()
>>>>>>> -                print "State = %d" % state
>>>>>>> -                print """
>>>>>>> -ERROR: Could not launch process.
>>>>>>> -NOTE: There are several reasons why this may happen:
>>>>>>> -  * Root needs to run "DevToolsSecurity --enable".
>>>>>>> -  * Older versions of lldb cannot launch more than one process
>>>>>>> simultaneously.
>>>>>>> -"""
>>>>>>> -                sys.exit(1)
>>>>>>> -
>>>>>>> -        elif re.match('^b|(break)$', cmd[0]) and len(cmd) == 2:
>>>>>>> -            if re.match('[0-9]+', cmd[1]):
>>>>>>> -                # b line
>>>>>>> -                mainfile =
>>>>>>> target.FindFunctions('main')[0].compile_unit.file
>>>>>>> -                print target.BreakpointCreateByLocation(mainfile,
>>>>>>> int(cmd[1]))
>>>>>>> -            else:
>>>>>>> -                # b file:line
>>>>>>> -                file, line = cmd[1].split(':')
>>>>>>> -                print target.BreakpointCreateByLocation(file,
>>>>>>> int(line))
>>>>>>> -
>>>>>>> -        elif re.match('^ptype$', cmd[0]) and len(cmd) == 2:
>>>>>>> -            # GDB's ptype has multiple incarnations depending on its
>>>>>>> -            # argument (global variable, function, type).  The
>>>>>>> definition
>>>>>>> -            # here is for looking up the signature of a function
>>>>>>> and only
>>>>>>> -            # if that fails it looks for a type with that name.
>>>>>>> -            # Type lookup in LLDB would be "image lookup --type".
>>>>>>> -            for elem in target.FindFunctions(cmd[1]):
>>>>>>> -                print elem.function.type
>>>>>>> -                continue
>>>>>>> -            print target.FindFirstType(cmd[1])
>>>>>>> -
>>>>>>> -        elif re.match('^po$', cmd[0]) and len(cmd) > 1:
>>>>>>> -            try:
>>>>>>> -                opts = lldb.SBExpressionOptions()
>>>>>>> -                opts.SetFetchDynamicValue(True)
>>>>>>> -                opts.SetCoerceResultToId(True)
>>>>>>> -                print target.EvaluateExpression(' '.join(cmd[1:]),
>>>>>>> opts)
>>>>>>> -            except:
>>>>>>> -                # FIXME: This is a fallback path for the
>>>>>>> lab.llvm.org
>>>>>>> -                # buildbot running OS X 10.7; it should be removed.
>>>>>>> -                thread = process.GetThreadAtIndex(0)
>>>>>>> -                frame = thread.GetFrameAtIndex(0)
>>>>>>> -                print frame.EvaluateExpression(' '.join(cmd[1:]))
>>>>>>> -
>>>>>>> -        elif re.match('^p|(print)$', cmd[0]) and len(cmd) > 1:
>>>>>>> -            thread = process.GetThreadAtIndex(0)
>>>>>>> -            frame = thread.GetFrameAtIndex(0)
>>>>>>> -            print frame.EvaluateExpression(' '.join(cmd[1:]))
>>>>>>> -
>>>>>>> -        elif re.match('^n|(next)$', cmd[0]):
>>>>>>> -            thread = process.GetThreadAtIndex(0)
>>>>>>> -            thread.StepOver()
>>>>>>> -
>>>>>>> -        elif re.match('^q|(quit)$', cmd[0]):
>>>>>>> -            sys.exit(0)
>>>>>>> -
>>>>>>> -        else:
>>>>>>> -            print debugger.HandleCommand(' '.join(cmd))
>>>>>>> -
>>>>>>> -    except SystemExit:
>>>>>>> -        lldb.SBDebugger_Terminate()
>>>>>>> -        raise
>>>>>>> -    except:
>>>>>>> -        print 'Could not handle the command "%s"' % ' '.join(cmd)
>>>>>>> -
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/nested-struct.cpp
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/nested-struct.cpp?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/nested-struct.cpp (original)
>>>>>>> +++ debuginfo-tests/trunk/nested-struct.cpp (removed)
>>>>>>> @@ -1,21 +0,0 @@
>>>>>>> -// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o
>>>>>>> %t.o
>>>>>>> -// RUN: %test_debuginfo %s %t.o
>>>>>>> -// Radar 9440721
>>>>>>> -// If debug info for my_number() is emitted outside function foo's
>>>>>>> scope
>>>>>>> -// then a debugger may not be able to handle it. At least one
>>>>>>> version of
>>>>>>> -// gdb crashes in such cases.
>>>>>>> -
>>>>>>> -// DEBUGGER: ptype foo
>>>>>>> -// CHECK: int (void)
>>>>>>> -
>>>>>>> -int foo() {
>>>>>>> -  struct Local {
>>>>>>> -    static int my_number() {
>>>>>>> -      return 42;
>>>>>>> -    }
>>>>>>> -  };
>>>>>>> -
>>>>>>> -  int i = 0;
>>>>>>> -  i = Local::my_number();
>>>>>>> -  return i + 1;
>>>>>>> -}
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/nrvo-string.cpp
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/nrvo-string.cpp?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/nrvo-string.cpp (original)
>>>>>>> +++ debuginfo-tests/trunk/nrvo-string.cpp (removed)
>>>>>>> @@ -1,27 +0,0 @@
>>>>>>> -// This ensures that DW_OP_deref is inserted when necessary, such
>>>>>>> as when NRVO
>>>>>>> -// of a string object occurs in C++.
>>>>>>> -//
>>>>>>> -// RUN: %clangxx -O0 -fno-exceptions
>>>>>>> %target_itanium_abi_host_triple %s -o %t.out -g
>>>>>>> -// RUN: %test_debuginfo %s %t.out
>>>>>>> -// RUN: %clangxx -O1 -fno-exceptions
>>>>>>> %target_itanium_abi_host_triple %s -o %t.out -g
>>>>>>> -// RUN: %test_debuginfo %s %t.out
>>>>>>> -//
>>>>>>> -// PR34513
>>>>>>> -
>>>>>>> -struct string {
>>>>>>> -  string() {}
>>>>>>> -  string(int i) : i(i) {}
>>>>>>> -  ~string() {}
>>>>>>> -  int i = 0;
>>>>>>> -};
>>>>>>> -string get_string() {
>>>>>>> -  string unused;
>>>>>>> -  string result = 3;
>>>>>>> -// DEBUGGER: break 21
>>>>>>> -  return result;
>>>>>>> -}
>>>>>>> -int main() { get_string(); }
>>>>>>> -
>>>>>>> -// DEBUGGER: r
>>>>>>> -// DEBUGGER: print result.i
>>>>>>> -// CHECK:  = 3
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/safestack.c
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/safestack.c?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/safestack.c (original)
>>>>>>> +++ debuginfo-tests/trunk/safestack.c (removed)
>>>>>>> @@ -1,51 +0,0 @@
>>>>>>> -// RUN: %clang %target_itanium_abi_host_triple -arch x86_64 %s -o
>>>>>>> %t.out -g -fsanitize=safe-stack
>>>>>>> -// RUN: %test_debuginfo %s %t.out
>>>>>>> -// REQUIRES: not_asan
>>>>>>> -//           Zorg configures the ASAN stage2 bots to not build the
>>>>>>> -//           safestack compiler-rt.  Only run this test on
>>>>>>> -//           non-asanified configurations.
>>>>>>> -
>>>>>>> -struct S {
>>>>>>> -  int a[8];
>>>>>>> -};
>>>>>>> -
>>>>>>> -int f(struct S s, unsigned i);
>>>>>>> -
>>>>>>> -int main(int argc, const char **argv) {
>>>>>>> -  struct S s = {{0, 1, 2, 3, 4, 5, 6, 7}};
>>>>>>> -  // DEBUGGER: break 17
>>>>>>> -  f(s, 4);
>>>>>>> -  // DEBUGGER: break 19
>>>>>>> -  return 0;
>>>>>>> -}
>>>>>>> -
>>>>>>> -int f(struct S s, unsigned i) {
>>>>>>> -  // DEBUGGER: break 24
>>>>>>> -  return s.a[i];
>>>>>>> -}
>>>>>>> -
>>>>>>> -// DEBUGGER: r
>>>>>>> -// DEBUGGER: p s
>>>>>>> -// CHECK: a =
>>>>>>> -// DEBUGGER: p s.a[0]
>>>>>>> -// CHECK: = 0
>>>>>>> -// DEBUGGER: p s.a[1]
>>>>>>> -// CHECK: = 1
>>>>>>> -// DEBUGGER: p s.a[7]
>>>>>>> -// CHECK: = 7
>>>>>>> -// DEBUGGER: c
>>>>>>> -// DEBUGGER: p s
>>>>>>> -// CHECK: a =
>>>>>>> -// DEBUGGER: p s.a[0]
>>>>>>> -// CHECK: = 0
>>>>>>> -// DEBUGGER: p s.a[1]
>>>>>>> -// CHECK: = 1
>>>>>>> -// DEBUGGER: p s.a[7]
>>>>>>> -// DEBUGGER: c
>>>>>>> -// DEBUGGER: p s
>>>>>>> -// CHECK: a =
>>>>>>> -// DEBUGGER: p s.a[0]
>>>>>>> -// CHECK: = 0
>>>>>>> -// DEBUGGER: p s.a[1]
>>>>>>> -// CHECK: = 1
>>>>>>> -// DEBUGGER: p s.a[7]
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/sret.cpp
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/sret.cpp?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/sret.cpp (original)
>>>>>>> +++ debuginfo-tests/trunk/sret.cpp (removed)
>>>>>>> @@ -1,71 +0,0 @@
>>>>>>> -// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o
>>>>>>> %t.o
>>>>>>> -// RUN: %clangxx %target_itanium_abi_host_triple %t.o -o %t.out
>>>>>>> -// RUN: %test_debuginfo %s %t.out
>>>>>>> -// Radar 8775834
>>>>>>> -// DEBUGGER: break 62
>>>>>>> -// DEBUGGER: r
>>>>>>> -// DEBUGGER: p a
>>>>>>> -// CHECK: ${{[0-9]+}} =
>>>>>>> -// LLDB does not print artificial members.
>>>>>>> -// CHECK:  {{(_vptr\$A =)?.*}}m_int = 12
>>>>>>> -
>>>>>>> -class A
>>>>>>> -{
>>>>>>> -public:
>>>>>>> -    A (int i=0);
>>>>>>> -    A (const A& rhs);
>>>>>>> -    const A&
>>>>>>> -    operator= (const A& rhs);
>>>>>>> -    virtual ~A() {}
>>>>>>> -
>>>>>>> -    int get_int();
>>>>>>> -
>>>>>>> -protected:
>>>>>>> -    int m_int;
>>>>>>> -};
>>>>>>> -
>>>>>>> -A::A (int i) :
>>>>>>> -    m_int(i)
>>>>>>> -{
>>>>>>> -}
>>>>>>> -
>>>>>>> -A::A (const A& rhs) :
>>>>>>> -    m_int (rhs.m_int)
>>>>>>> -{
>>>>>>> -}
>>>>>>> -
>>>>>>> -const A &
>>>>>>> -A::operator =(const A& rhs)
>>>>>>> -{
>>>>>>> -    m_int = rhs.m_int;
>>>>>>> -    return *this;
>>>>>>> -}
>>>>>>> -
>>>>>>> -int A::get_int()
>>>>>>> -{
>>>>>>> -    return m_int;
>>>>>>> -}
>>>>>>> -
>>>>>>> -class B
>>>>>>> -{
>>>>>>> -public:
>>>>>>> -    B () {}
>>>>>>> -
>>>>>>> -    A AInstance();
>>>>>>> -};
>>>>>>> -
>>>>>>> -A
>>>>>>> -B::AInstance()
>>>>>>> -{
>>>>>>> -    A a(12);
>>>>>>> -    return a;
>>>>>>> -}
>>>>>>> -
>>>>>>> -int main (int argc, char const *argv[])
>>>>>>> -{
>>>>>>> -    B b;
>>>>>>> -    int return_val = b.AInstance().get_int();
>>>>>>> -
>>>>>>> -    A a(b.AInstance());
>>>>>>> -    return return_val;
>>>>>>> -}
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/stack-var.c
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/stack-var.c?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/stack-var.c (original)
>>>>>>> +++ debuginfo-tests/trunk/stack-var.c (removed)
>>>>>>> @@ -1,18 +0,0 @@
>>>>>>> -// RUN: %clang %target_itanium_abi_host_triple %s -O -o %t.out -g
>>>>>>> -// RUN: %test_debuginfo %s %t.out
>>>>>>> -
>>>>>>> -void __attribute__((noinline, optnone)) bar(int *test) {}
>>>>>>> -int main() {
>>>>>>> -  int test;
>>>>>>> -  test = 23;
>>>>>>> -  // DEBUGGER: break 12
>>>>>>> -  // DEBUGGER: r
>>>>>>> -  // DEBUGGER: p test
>>>>>>> -  // CHECK: = 23
>>>>>>> -  bar(&test);
>>>>>>> -  // DEBUGGER: break 17
>>>>>>> -  // DEBUGGER: c
>>>>>>> -  // DEBUGGER: p test
>>>>>>> -  // CHECK: = 23
>>>>>>> -  return test;
>>>>>>> -}
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/static-member-2.cpp
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/static-member-2.cpp?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/static-member-2.cpp (original)
>>>>>>> +++ debuginfo-tests/trunk/static-member-2.cpp (removed)
>>>>>>> @@ -1,39 +0,0 @@
>>>>>>> -// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -o %t -c
>>>>>>> -// RUN: %clangxx %target_itanium_abi_host_triple %t -o %t.out
>>>>>>> -// RUN: %test_debuginfo %s %t.out
>>>>>>> -
>>>>>>> -// FIXME: LLDB finds the wrong symbol for "C".
>>>>>>> rdar://problem/14933867
>>>>>>> -// XFAIL: darwin
>>>>>>> -
>>>>>>> -// DEBUGGER: delete breakpoints
>>>>>>> -// DEBUGGER: break static-member.cpp:33
>>>>>>> -// DEBUGGER: r
>>>>>>> -// DEBUGGER: ptype C
>>>>>>> -// CHECK:      {{struct|class}} C {
>>>>>>> -// CHECK:      static const int a;
>>>>>>> -// CHECK-NEXT: static int b;
>>>>>>> -// CHECK-NEXT: static int c;
>>>>>>> -// CHECK-NEXT: int d;
>>>>>>> -// CHECK-NEXT: }
>>>>>>> -// DEBUGGER: p C::a
>>>>>>> -// CHECK: ${{[0-9]}} = 4
>>>>>>> -// DEBUGGER: p C::c
>>>>>>> -// CHECK: ${{[0-9]}} = 15
>>>>>>> -
>>>>>>> -// PR14471, PR14734
>>>>>>> -
>>>>>>> -class C {
>>>>>>> -public:
>>>>>>> -  const static int a = 4;
>>>>>>> -  static int b;
>>>>>>> -  static int c;
>>>>>>> -  int d;
>>>>>>> -};
>>>>>>> -
>>>>>>> -int C::c = 15;
>>>>>>> -const int C::a;
>>>>>>> -
>>>>>>> -int main() {
>>>>>>> -    C instance_C;
>>>>>>> -    return C::a;
>>>>>>> -}
>>>>>>>
>>>>>>> Removed: debuginfo-tests/trunk/static-member.cpp
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/static-member.cpp?rev=318434&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/static-member.cpp (original)
>>>>>>> +++ debuginfo-tests/trunk/static-member.cpp (removed)
>>>>>>> @@ -1,36 +0,0 @@
>>>>>>> -// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -o %t -c
>>>>>>> -// RUN: %clangxx %target_itanium_abi_host_triple %t -o %t.out
>>>>>>> -// RUN: %test_debuginfo %s %t.out
>>>>>>> -
>>>>>>> -// DEBUGGER: delete breakpoints
>>>>>>> -// DEBUGGER: break static-member.cpp:33
>>>>>>> -// DEBUGGER: r
>>>>>>> -// DEBUGGER: ptype MyClass
>>>>>>> -// CHECK:      {{struct|class}} MyClass {
>>>>>>> -// CHECK:      static const int a;
>>>>>>> -// CHECK-NEXT: static int b;
>>>>>>> -// CHECK-NEXT: static int c;
>>>>>>> -// CHECK-NEXT: int d;
>>>>>>> -// CHECK-NEXT: }
>>>>>>> -// DEBUGGER: p MyClass::a
>>>>>>> -// CHECK: ${{[0-9]}} = 4
>>>>>>> -// DEBUGGER: p MyClass::c
>>>>>>> -// CHECK: ${{[0-9]}} = 15
>>>>>>> -
>>>>>>> -// PR14471, PR14734
>>>>>>> -
>>>>>>> -class MyClass {
>>>>>>> -public:
>>>>>>> -  const static int a = 4;
>>>>>>> -  static int b;
>>>>>>> -  static int c;
>>>>>>> -  int d;
>>>>>>> -};
>>>>>>> -
>>>>>>> -int MyClass::c = 15;
>>>>>>> -const int MyClass::a;
>>>>>>> -
>>>>>>> -int main() {
>>>>>>> -    MyClass instance_MyClass;
>>>>>>> -    return MyClass::a;
>>>>>>> -}
>>>>>>>
>>>>>>> Added: debuginfo-tests/trunk/tests/aggregate-indirect-arg.cpp
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/aggregate-indirect-arg.cpp?rev=318435&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/tests/aggregate-indirect-arg.cpp (added)
>>>>>>> +++ debuginfo-tests/trunk/tests/aggregate-indirect-arg.cpp Thu Nov
>>>>>>> 16 10:26:20 2017
>>>>>>> @@ -0,0 +1,32 @@
>>>>>>> +// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o
>>>>>>> %t.o
>>>>>>> +// RUN: %clangxx %target_itanium_abi_host_triple %t.o -o %t.out
>>>>>>> +// RUN: %test_debuginfo %s %t.out
>>>>>>> +// Radar 8945514
>>>>>>> +// DEBUGGER: break 22
>>>>>>> +// DEBUGGER: r
>>>>>>> +// DEBUGGER: p v
>>>>>>> +// CHECK: ${{[0-9]+}} =
>>>>>>> +// CHECK:  Data ={{.*}} 0x0{{(0*)}}
>>>>>>> +// CHECK:  Kind = 2142
>>>>>>> +
>>>>>>> +class SVal {
>>>>>>> +public:
>>>>>>> +  ~SVal() {}
>>>>>>> +  const void* Data;
>>>>>>> +  unsigned Kind;
>>>>>>> +};
>>>>>>> +
>>>>>>> +void bar(SVal &v) {}
>>>>>>> +class A {
>>>>>>> +public:
>>>>>>> +  void foo(SVal v) { bar(v); }
>>>>>>> +};
>>>>>>> +
>>>>>>> +int main() {
>>>>>>> +  SVal v;
>>>>>>> +  v.Data = 0;
>>>>>>> +  v.Kind = 2142;
>>>>>>> +  A a;
>>>>>>> +  a.foo(v);
>>>>>>> +  return 0;
>>>>>>> +}
>>>>>>>
>>>>>>> Added: debuginfo-tests/trunk/tests/asan-blocks.c
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/asan-blocks.c?rev=318435&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/tests/asan-blocks.c (added)
>>>>>>> +++ debuginfo-tests/trunk/tests/asan-blocks.c Thu Nov 16 10:26:20
>>>>>>> 2017
>>>>>>> @@ -0,0 +1,41 @@
>>>>>>> +// RUN: %clang -fblocks %target_itanium_abi_host_triple -arch
>>>>>>> x86_64 %s -o %t.out -g -fsanitize=address
>>>>>>> +// RUN: %test_debuginfo %s %t.out
>>>>>>> +// FIXME: Remove system-darwin when we build BlocksRuntime
>>>>>>> everywhere.
>>>>>>> +// REQUIRES: not_asan, system-darwin
>>>>>>> +//           Zorg configures the ASAN stage2 bots to not build the
>>>>>>> asan
>>>>>>> +//           compiler-rt. Only run this test on non-asanified
>>>>>>> configurations.
>>>>>>> +void b();
>>>>>>> +struct S {
>>>>>>> +  int a[8];
>>>>>>> +};
>>>>>>> +
>>>>>>> +int f(struct S s, unsigned i) {
>>>>>>> +  // DEBUGGER: break 17
>>>>>>> +  // DEBUGGER: r
>>>>>>> +  // DEBUGGER: p s
>>>>>>> +  // CHECK: a = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] =
>>>>>>> 5, [6] = 6, [7] = 7)
>>>>>>> +  return s.a[i];
>>>>>>> +}
>>>>>>> +
>>>>>>> +int main(int argc, const char **argv) {
>>>>>>> +  struct S s = {{0, 1, 2, 3, 4, 5, 6, 7}};
>>>>>>> +  if (f(s, 4) == 4) {
>>>>>>> +    // DEBUGGER: break 27
>>>>>>> +    // DEBUGGER: c
>>>>>>> +    // DEBUGGER: p s
>>>>>>> +    // CHECK: a = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5]
>>>>>>> = 5, [6] = 6, [7] = 7)
>>>>>>> +    b();
>>>>>>> +  }
>>>>>>> +  return 0;
>>>>>>> +}
>>>>>>> +
>>>>>>> +void c() {}
>>>>>>> +
>>>>>>> +void b() {
>>>>>>> +  // DEBUGGER: break 40
>>>>>>> +  // DEBUGGER: c
>>>>>>> +  // DEBUGGER: p x
>>>>>>> +  // CHECK: 42
>>>>>>> +  __block int x = 42;
>>>>>>> +  c();
>>>>>>> +}
>>>>>>>
>>>>>>> Added: debuginfo-tests/trunk/tests/asan.c
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/asan.c?rev=318435&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/tests/asan.c (added)
>>>>>>> +++ debuginfo-tests/trunk/tests/asan.c Thu Nov 16 10:26:20 2017
>>>>>>> @@ -0,0 +1,31 @@
>>>>>>> +// RUN: %clang -fblocks %target_itanium_abi_host_triple -arch
>>>>>>> x86_64 %s -o %t.out -g -fsanitize=address
>>>>>>> +// RUN: %test_debuginfo %s %t.out
>>>>>>> +// REQUIRES: not_asan
>>>>>>> +//           Zorg configures the ASAN stage2 bots to not build the
>>>>>>> asan
>>>>>>> +//           compiler-rt. Only run this test on non-asanified
>>>>>>> configurations.
>>>>>>> +//
>>>>>>> +
>>>>>>> +struct S {
>>>>>>> +  int a[8];
>>>>>>> +};
>>>>>>> +
>>>>>>> +int f(struct S s, unsigned i) {
>>>>>>> +  // DEBUGGER: break 14
>>>>>>> +  return s.a[i];
>>>>>>> +}
>>>>>>> +
>>>>>>> +int main(int argc, const char **argv) {
>>>>>>> +  struct S s = {{0, 1, 2, 3, 4, 5, 6, 7}};
>>>>>>> +  if (f(s, 4) == 4)
>>>>>>> +    return f(s, 0);
>>>>>>> +  return 0;
>>>>>>> +}
>>>>>>> +
>>>>>>> +// DEBUGGER: r
>>>>>>> +// DEBUGGER: p s
>>>>>>> +// CHECK: a =
>>>>>>> +// DEBUGGER: p s.a[0]
>>>>>>> +// CHECK: = 0
>>>>>>> +// DEBUGGER: p s.a[1]
>>>>>>> +// CHECK: = 1
>>>>>>> +// DEBUGGER: p s.a[7]
>>>>>>>
>>>>>>> Added: debuginfo-tests/trunk/tests/block_var.m
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/block_var.m?rev=318435&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/tests/block_var.m (added)
>>>>>>> +++ debuginfo-tests/trunk/tests/block_var.m Thu Nov 16 10:26:20 2017
>>>>>>> @@ -0,0 +1,32 @@
>>>>>>> +// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
>>>>>>> +// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out
>>>>>>> -framework Foundation
>>>>>>> +// RUN: %test_debuginfo %s %t.out
>>>>>>> +
>>>>>>> +// REQUIRES: system-darwin
>>>>>>> +
>>>>>>> +// DEBUGGER: break 24
>>>>>>> +// DEBUGGER: r
>>>>>>> +// DEBUGGER: p result
>>>>>>> +// CHECK: ${{[0-9]}} = 42
>>>>>>> +
>>>>>>> +void doBlock(void (^block)(void))
>>>>>>> +{
>>>>>>> +    block();
>>>>>>> +}
>>>>>>> +
>>>>>>> +int I(int n)
>>>>>>> +{
>>>>>>> +    __block int result;
>>>>>>> +    int i = 2;
>>>>>>> +    doBlock(^{
>>>>>>> +        result = n;
>>>>>>> +    });
>>>>>>> +    return result + i; /* Check value of 'result' */
>>>>>>> +}
>>>>>>> +
>>>>>>> +
>>>>>>> +int main (int argc, const char * argv[]) {
>>>>>>> +  return I(42);
>>>>>>> +}
>>>>>>> +
>>>>>>> +
>>>>>>>
>>>>>>> Added: debuginfo-tests/trunk/tests/blocks.m
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/blocks.m?rev=318435&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/tests/blocks.m (added)
>>>>>>> +++ debuginfo-tests/trunk/tests/blocks.m Thu Nov 16 10:26:20 2017
>>>>>>> @@ -0,0 +1,43 @@
>>>>>>> +// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
>>>>>>> +// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out
>>>>>>> -framework Foundation
>>>>>>> +// RUN: %test_debuginfo %s %t.out
>>>>>>> +
>>>>>>> +// REQUIRES: system-darwin
>>>>>>> +// Radar 9279956
>>>>>>> +
>>>>>>> +// DEBUGGER: break 31
>>>>>>> +// DEBUGGER: r
>>>>>>> +// DEBUGGER: p m2
>>>>>>> +// CHECK: ${{[0-9]}} = 1
>>>>>>> +// DEBUGGER: p dbTransaction
>>>>>>> +// CHECK: ${{[0-9]}} = 0
>>>>>>> +// DEBUGGER: p master
>>>>>>> +// CHECK: ${{[0-9]}} = 0
>>>>>>> +
>>>>>>> +#include <Cocoa/Cocoa.h>
>>>>>>> +
>>>>>>> +extern void foo(void(^)(void));
>>>>>>> +
>>>>>>> + at interface A:NSObject @end
>>>>>>> + at implementation A
>>>>>>> +- (void) helper {
>>>>>>> + int master = 0;
>>>>>>> + __block int m2 = 0;
>>>>>>> + __block int dbTransaction = 0;
>>>>>>> + int (^x)(void) = ^(void) { (void) self;
>>>>>>> + (void) master;
>>>>>>> + (void) dbTransaction;
>>>>>>> + m2++;
>>>>>>> + return m2;
>>>>>>> + };
>>>>>>> +  master = x();
>>>>>>> +}
>>>>>>> + at end
>>>>>>> +
>>>>>>> +void foo(void(^x)(void)) {}
>>>>>>> +
>>>>>>> +int main() {
>>>>>>> + A *a = [A alloc];
>>>>>>> + [a helper];
>>>>>>> + return 0;
>>>>>>> +}
>>>>>>>
>>>>>>> Added: debuginfo-tests/trunk/tests/ctor.cpp
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/ctor.cpp?rev=318435&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/tests/ctor.cpp (added)
>>>>>>> +++ debuginfo-tests/trunk/tests/ctor.cpp Thu Nov 16 10:26:20 2017
>>>>>>> @@ -0,0 +1,25 @@
>>>>>>> +// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o
>>>>>>> %t.o
>>>>>>> +// RUN: %clangxx %target_itanium_abi_host_triple %t.o -o %t.out
>>>>>>> +// RUN: %test_debuginfo %s %t.out
>>>>>>> +
>>>>>>> +
>>>>>>> +// DEBUGGER: break 14
>>>>>>> +// DEBUGGER: r
>>>>>>> +// DEBUGGER: p *this
>>>>>>> +// CHECK-NEXT-NOT: Cannot access memory at address
>>>>>>> +
>>>>>>> +class A {
>>>>>>> +public:
>>>>>>> + A() : zero(0), data(42)
>>>>>>> + {
>>>>>>> + }
>>>>>>> +private:
>>>>>>> + int zero;
>>>>>>> + int data;
>>>>>>> +};
>>>>>>> +
>>>>>>> +int main() {
>>>>>>> + A a;
>>>>>>> + return 0;
>>>>>>> +}
>>>>>>> +
>>>>>>>
>>>>>>> Added: debuginfo-tests/trunk/tests/dbg-arg.c
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/dbg-arg.c?rev=318435&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/tests/dbg-arg.c (added)
>>>>>>> +++ debuginfo-tests/trunk/tests/dbg-arg.c Thu Nov 16 10:26:20 2017
>>>>>>> @@ -0,0 +1,46 @@
>>>>>>> +// This test case checks debug info during register moves for an
>>>>>>> argument.
>>>>>>> +// RUN: %clang %target_itanium_abi_host_triple -m64 -mllvm
>>>>>>> -fast-isel=false  %s -c -o %t.o -g
>>>>>>> +// RUN: %clang %target_itanium_abi_host_triple -m64 %t.o -o %t.out
>>>>>>> +// RUN: %test_debuginfo %s %t.out
>>>>>>> +//
>>>>>>> +// DEBUGGER: break 26
>>>>>>> +// DEBUGGER: r
>>>>>>> +// DEBUGGER: print mutex
>>>>>>> +// CHECK:  ={{.* 0x[0-9A-Fa-f]+}}
>>>>>>> +//
>>>>>>> +// Radar 8412415
>>>>>>> +
>>>>>>> +struct _mtx
>>>>>>> +{
>>>>>>> +  long unsigned int ptr;
>>>>>>> +  int waiters;
>>>>>>> +  struct {
>>>>>>> +    int tag;
>>>>>>> +    int pad;
>>>>>>> +  } mtxi;
>>>>>>> +};
>>>>>>> +
>>>>>>> +
>>>>>>> +int foobar(struct _mtx *mutex) {
>>>>>>> +  int r = 1;
>>>>>>> +  int l = 0;
>>>>>>> +  int j = 0;
>>>>>>> +  do {
>>>>>>> +    if (mutex->waiters) {
>>>>>>> +      r = 2;
>>>>>>> +    }
>>>>>>> +    j = bar(r, l);
>>>>>>> +    ++l;
>>>>>>> +  } while (l < j);
>>>>>>> +  return r + j;
>>>>>>> +}
>>>>>>> +
>>>>>>> +int bar(int i, int j) {
>>>>>>> +  return i + j;
>>>>>>> +}
>>>>>>> +
>>>>>>> +int main() {
>>>>>>> +  struct _mtx m;
>>>>>>> +  m.waiters = 0;
>>>>>>> +  return foobar(&m);
>>>>>>> +}
>>>>>>>
>>>>>>> Added: debuginfo-tests/trunk/tests/foreach.m
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/foreach.m?rev=318435&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/tests/foreach.m (added)
>>>>>>> +++ debuginfo-tests/trunk/tests/foreach.m Thu Nov 16 10:26:20 2017
>>>>>>> @@ -0,0 +1,31 @@
>>>>>>> +// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
>>>>>>> +// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out
>>>>>>> -framework Foundation
>>>>>>> +// RUN: %test_debuginfo %s %t.out
>>>>>>> +//
>>>>>>> +// REQUIRES: system-darwin
>>>>>>> +// Radar 8757124
>>>>>>> +
>>>>>>> +// DEBUGGER: break 25
>>>>>>> +// DEBUGGER: r
>>>>>>> +// DEBUGGER: po thing
>>>>>>> +// CHECK: aaa
>>>>>>> +
>>>>>>> +#import <Foundation/Foundation.h>
>>>>>>> +
>>>>>>> +int main (int argc, const char * argv[]) {
>>>>>>> +
>>>>>>> +    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>>>>>>> +    NSArray *things = [NSArray arrayWithObjects:@"one", @"two",
>>>>>>> @"three" , nil];
>>>>>>> +    for (NSString *thing in things) {
>>>>>>> +        NSLog (@"%@", thing);
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    things = [NSArray arrayWithObjects:@"aaa", @"bbb", @"ccc" ,
>>>>>>> nil];
>>>>>>> +    for (NSString *thing in things) {
>>>>>>> +        NSLog (@"%@", thing);
>>>>>>> +    }
>>>>>>> +    [pool release];
>>>>>>> +    return 0;
>>>>>>> +}
>>>>>>> +
>>>>>>> +
>>>>>>>
>>>>>>> Added: debuginfo-tests/trunk/tests/forward-declare-class.cpp
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/forward-declare-class.cpp?rev=318435&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/tests/forward-declare-class.cpp (added)
>>>>>>> +++ debuginfo-tests/trunk/tests/forward-declare-class.cpp Thu Nov 16
>>>>>>> 10:26:20 2017
>>>>>>> @@ -0,0 +1,27 @@
>>>>>>> +// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o
>>>>>>> %t.o
>>>>>>> +// RUN: %test_debuginfo %s %t.o
>>>>>>> +// Radar 9168773
>>>>>>> +
>>>>>>> +// DEBUGGER: ptype A
>>>>>>> +// Work around a gdb bug where it believes that a class is a
>>>>>>> +// struct if there aren't any methods - even though it's tagged
>>>>>>> +// as a class.
>>>>>>> +// CHECK: type = {{struct|class}} A {
>>>>>>> +// CHECK-NEXT: {{(public:){0,1}}}
>>>>>>> +// CHECK-NEXT: int MyData;
>>>>>>> +// CHECK-NEXT: }
>>>>>>> +class A;
>>>>>>> +class B {
>>>>>>> +public:
>>>>>>> +  void foo(const A *p);
>>>>>>> +};
>>>>>>> +
>>>>>>> +B iEntry;
>>>>>>> +
>>>>>>> +class A {
>>>>>>> +public:
>>>>>>> +  int MyData;
>>>>>>> +};
>>>>>>> +
>>>>>>> +A irp;
>>>>>>> +
>>>>>>>
>>>>>>> Added: debuginfo-tests/trunk/tests/lit.local.cfg
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/lit.local.cfg?rev=318435&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/tests/lit.local.cfg (added)
>>>>>>> +++ debuginfo-tests/trunk/tests/lit.local.cfg Thu Nov 16 10:26:20
>>>>>>> 2017
>>>>>>> @@ -0,0 +1,3 @@
>>>>>>> +# debuginfo-tests are not expected to pass in a cross-compilation
>>>>>>> setup.
>>>>>>> +if 'native' not in config.available_features:
>>>>>>> +    config.unsupported = True
>>>>>>>
>>>>>>> Added: debuginfo-tests/trunk/tests/llgdb.py
>>>>>>> URL:
>>>>>>> http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/llgdb.py?rev=318435&view=auto
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- debuginfo-tests/trunk/tests/llgdb.py (added)
>>>>>>> +++ debuginfo-tests/trunk/tests/llgdb.py Thu Nov 16 10:26:20 2017
>>>>>>> @@ -0,0 +1,157 @@
>>>>>>> +#!/bin/env python
>>>>>>> +"""
>>>>>>> +A gdb-compatible frontend for lldb that implements just enough
>>>>>>> +commands to run the tests in the debuginfo-tests repository with
>>>>>>> lldb.
>>>>>>> +"""
>>>>>>> +
>>>>>>> +#
>>>>>>> ----------------------------------------------------------------------
>>>>>>> +# Auto-detect lldb python module.
>>>>>>> +import commands, platform, os,  sys
>>>>>>> +try:
>>>>>>> +    # Just try for LLDB in case PYTHONPATH is already correctly
>>>>>>> setup.
>>>>>>> +    import lldb
>>>>>>> +except ImportError:
>>>>>>> +    lldb_python_dirs = list()
>>>>>>> +    # lldb is not in the PYTHONPATH, try some defaults for the
>>>>>>> current platform.
>>>>>>> +    platform_system = platform.system()
>>>>>>> +    if platform_system == 'Darwin':
>>>>>>> +        # On Darwin, try the currently selected Xcode directory
>>>>>>> +        xcode_dir = commands.getoutput("xcode-select --print-path")
>>>>>>> +        if xcode_dir:
>>>>>>> +            lldb_python_dirs.append(os.path.realpath(xcode_dir +
>>>>>>> +'/../SharedFrameworks/LLDB.framework/Resources/Python'))
>>>>>>> +            lldb_python_dirs.append(xcode_dir +
>>>>>>> +'/Library/PrivateFrameworks/LLDB.framework/Resources/Python')
>>>>>>> +        lldb_python_dirs.append(
>>>>>>> +'/System/Library/PrivateFrameworks/LLDB.framework/Resources/Python')
>>>>>>> +    success = False
>>>>>>> +    for lldb_python_dir in lldb_python_dirs:
>>>>>>> +        if os.path.exists(lldb_python_dir):
>>>>>>> +            if not (sys.path.__contains__(lldb_python_dir)):
>>>>>>> +                sys.path.append(lldb_python_dir)
>>>>>>> +                try:
>>>>>>> +                    import lldb
>>>>>>> +                except ImportError:
>>>>>>> +                    pass
>>>>>>> +                else:
>>>>>>> +                    print 'imported lldb from: "%s"' %
>>>>>>> (lldb_python_dir)
>>>>>>> +                    success = True
>>>>>>> +                    break
>>>>>>> +    if not success:
>>>>>>> +        print "error: couldn't locate the 'lldb' module, please set
>>>>>>> PYTHONPATH correctly"
>>>>>>> +        sys.exit(1)
>>>>>>> +#
>>>>>>> ----------------------------------------------------------------------
>>>>>>> +
>>>>>>> +# Command line option handling.
>>>>>>> +import argparse
>>>>>>> +parser = argparse.ArgumentParser(description=__doc__)
>>>>>>> +parser.add_argument('--quiet', '-q', action="store_true",
>>>>>>> help='ignored')
>>>>>>> +parser.add_argument('-batch', action="store_true",
>>>>>>> +                    help='exit after processing comand line')
>>>>>>> +parser.add_argument('-n', action="store_true", help='ignore .lldb
>>>>>>> file')
>>>>>>> +parser.add_argument('-x', dest='script', type=file, help='execute
>>>>>>> commands from file')
>>>>>>> +parser.add_argument("target", help="the program to debug")
>>>>>>> +args = parser.parse_args()
>>>>>>> +
>>>>>>> +
>>>>>>> +# Create a new debugger instance.
>>>>>>> +debugger = lldb.SBDebugger.Create()
>>>>>>> +debugger.SkipLLDBInitFiles(args.n)
>>>>>>> +
>>>>>>> +# Don't return from lldb function calls until the process stops.
>>>>>>> +debugger.SetAsync(False)
>>>>>>> +
>>>>>>> +# Create a target from a file and arch.
>>>>>>> +arch = os.popen("file "+args.target).read().split()[-1]
>>>>>>> +target = debugger.CreateTargetWithFileAndArch(args.target, arch)
>>>>>>> +
>>>>>>> +if not target:
>>>>>>> +    print "Could not create target", args.target
>>>>>>> +    sys.exit(1)
>>>>>>> +
>>>>>>> +if not args.script:
>>>>>>> +    print "Interactive mode is not implemented."
>>>>>>> +    sys.exit(1)
>>>>>>> +
>>>>>>> +import re
>>>>>>> +for command in args.script:
>>>>>>> +    # Strip newline and whitespaces and split into words.
>>>>>>> +    cmd = command[:-1].strip().split()
>>>>>>> +    if not cmd:
>>>>>>> +        continue
>>>>>>> +
>>>>>>> +    print '> %s'% command[:-1]
>>>>>>> +
>>>>>>> +    try:
>>>>>>> +        if re.match('^r|(run)$', cmd[0]):
>>>>>>> +            error = lldb.SBError()
>>>>>>> +            launchinfo = lldb.SBLaunchInfo([])
>>>>>>> +            launchinfo.SetWorkingDirectory(os.getcwd())
>>>>>>> +            process = target.Launch(launchinfo, error)
>>>>>>> +            print error
>>>>>>> +            if not process or error.fail:
>>>>>>> +                state = process.GetState()
>>>>>>> +                print "State = %d" % state
>>>>>>> +
>>>>>>>
>>>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171117/978a9d36/attachment-0001.html>


More information about the llvm-commits mailing list