<div dir="ltr">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.<div><br></div><div>Can you think of a way to diagnose this?</div><div><br></div><div>(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)</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 16, 2017 at 3:01 PM Adrian Prantl <<a href="mailto:aprantl@apple.com">aprantl@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div>Looks like this broke the Darwin bots again:</div><div><br></div><a href="http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/40578/" target="_blank">http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/40578/</a><div><br></div><div></div></div><div style="word-wrap:break-word;line-break:after-white-space"><div>-- adrian</div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><br><div><br><blockquote type="cite"><div>On Nov 16, 2017, at 10:26 AM, Zachary Turner via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:</div><br class="m_-8698121616152739205Apple-interchange-newline"><div><div>Author: zturner<br>Date: Thu Nov 16 10:26:20 2017<br>New Revision: 318435<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=318435&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=318435&view=rev</a><br>Log:<br>Resubmit "Refactor debuginfo-tests"<br><br>This was reverted due to some failures on specific darwin buildbots,<br>the issue being that the new lit configuration was not setting the<br>SDKROOT environment variable.  We've tested a fix locally and confirmed<br>that it works, so this patch resubmits everything with the fix<br>applied.<br><br>Added:<br>    debuginfo-tests/trunk/CMakeLists.txt<br>    debuginfo-tests/trunk/<a href="http://lit.cfg.py" target="_blank">lit.cfg.py</a><br>    debuginfo-tests/trunk/<a href="http://lit.site.cfg.py.in" target="_blank">lit.site.cfg.py.in</a><br>    debuginfo-tests/trunk/tests/<br>    debuginfo-tests/trunk/tests/aggregate-indirect-arg.cpp<br>    debuginfo-tests/trunk/tests/asan-blocks.c<br>    debuginfo-tests/trunk/tests/asan.c<br>    debuginfo-tests/trunk/tests/block_var.m<br>    debuginfo-tests/trunk/tests/blocks.m<br>    debuginfo-tests/trunk/tests/ctor.cpp<br>    debuginfo-tests/trunk/tests/dbg-arg.c<br>    debuginfo-tests/trunk/tests/foreach.m<br>    debuginfo-tests/trunk/tests/forward-declare-class.cpp<br>    debuginfo-tests/trunk/tests/lit.local.cfg<br>    debuginfo-tests/trunk/tests/llgdb.py<br>    debuginfo-tests/trunk/tests/nested-struct.cpp<br>    debuginfo-tests/trunk/tests/nrvo-string.cpp<br>    debuginfo-tests/trunk/tests/safestack.c<br>    debuginfo-tests/trunk/tests/sret.cpp<br>    debuginfo-tests/trunk/tests/stack-var.c<br>    debuginfo-tests/trunk/tests/static-member-2.cpp<br>    debuginfo-tests/trunk/tests/static-member.cpp<br>    debuginfo-tests/trunk/tests/vla.c<br>Removed:<br>    debuginfo-tests/trunk/aggregate-indirect-arg.cpp<br>    debuginfo-tests/trunk/asan-blocks.c<br>    debuginfo-tests/trunk/asan.c<br>    debuginfo-tests/trunk/block_var.m<br>    debuginfo-tests/trunk/blocks.m<br>    debuginfo-tests/trunk/ctor.cpp<br>    debuginfo-tests/trunk/dbg-arg.c<br>    debuginfo-tests/trunk/foreach.m<br>    debuginfo-tests/trunk/forward-declare-class.cpp<br>    debuginfo-tests/trunk/lit.local.cfg<br>    debuginfo-tests/trunk/llgdb.py<br>    debuginfo-tests/trunk/nested-struct.cpp<br>    debuginfo-tests/trunk/nrvo-string.cpp<br>    debuginfo-tests/trunk/safestack.c<br>    debuginfo-tests/trunk/sret.cpp<br>    debuginfo-tests/trunk/stack-var.c<br>    debuginfo-tests/trunk/static-member-2.cpp<br>    debuginfo-tests/trunk/static-member.cpp<br>    debuginfo-tests/trunk/vla.c<br><br>Added: debuginfo-tests/trunk/CMakeLists.txt<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/CMakeLists.txt?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/CMakeLists.txt?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/CMakeLists.txt (added)<br>+++ debuginfo-tests/trunk/CMakeLists.txt Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,36 @@<br>+# Debug Info tests.  These tests invoke clang to generate programs with<br>+# various types of debug info, and then run those programs under a debugger<br>+# such as GDB or LLDB to verify the results.<br>+<br>+set(DEBUGINFO_TESTS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})<br>+set(DEBUGINFO_TESTS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})<br>+<br>+set(DEBUGINFO_TEST_DEPS<br>+  clang<br>+  llvm-config<br>+  FileCheck<br>+  count<br>+  not<br>+  )<br>+<br>+get_target_property(CLANG_SOURCE_DIR clang SOURCE_DIR)<br>+<br>+if (TARGET lld)<br>+  set(DEBUGINFO_TESTS_HAS_LLD 1)<br>+  list(APPEND DEBUGINFO_TEST_DEPS lld)<br>+  get_target_property(LLD_SOURCE_DIR lld SOURCE_DIR)<br>+endif()<br>+<br>+configure_lit_site_cfg(<br>+  ${CMAKE_CURRENT_SOURCE_DIR}/<a href="http://lit.site.cfg.py.in" target="_blank">lit.site.cfg.py.in</a><br>+  ${CMAKE_CURRENT_BINARY_DIR}/<a href="http://lit.site.cfg.py" target="_blank">lit.site.cfg.py</a><br>+  MAIN_CONFIG<br>+  ${CMAKE_CURRENT_SOURCE_DIR}/<a href="http://lit.cfg.py" target="_blank">lit.cfg.py</a><br>+  )<br>+<br>+add_lit_testsuite(check-debuginfo "Running debug info integration tests"<br>+  ${CMAKE_CURRENT_BINARY_DIR}<br>+  DEPENDS ${DEBUGINFO_TEST_DEPS}<br>+  )<br>+<br>+set_target_properties(check-debuginfo PROPERTIES FOLDER "Debug info tests")<br>\ No newline at end of file<br><br>Removed: debuginfo-tests/trunk/aggregate-indirect-arg.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/aggregate-indirect-arg.cpp?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/aggregate-indirect-arg.cpp?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/aggregate-indirect-arg.cpp (original)<br>+++ debuginfo-tests/trunk/aggregate-indirect-arg.cpp (removed)<br>@@ -1,32 +0,0 @@<br>-// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>-// RUN: %clangxx %target_itanium_abi_host_triple %t.o -o %t.out<br>-// RUN: %test_debuginfo %s %t.out <br>-// Radar 8945514<br>-// DEBUGGER: break 22<br>-// DEBUGGER: r<br>-// DEBUGGER: p v<br>-// CHECK: ${{[0-9]+}} =<br>-// CHECK:  Data ={{.*}} 0x0{{(0*)}}<br>-// CHECK:  Kind = 2142<br>-<br>-class SVal {<br>-public:<br>-  ~SVal() {}<br>-  const void* Data;<br>-  unsigned Kind;<br>-};<br>-<br>-void bar(SVal &v) {}<br>-class A {<br>-public:<br>-  void foo(SVal v) { bar(v); }<br>-};<br>-<br>-int main() {<br>-  SVal v;<br>-  v.Data = 0;<br>-  v.Kind = 2142;<br>-  A a;<br>-  a.foo(v);<br>-  return 0;<br>-}<br><br>Removed: debuginfo-tests/trunk/asan-blocks.c<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/asan-blocks.c?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/asan-blocks.c?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/asan-blocks.c (original)<br>+++ debuginfo-tests/trunk/asan-blocks.c (removed)<br>@@ -1,41 +0,0 @@<br>-// RUN: %clang -fblocks %target_itanium_abi_host_triple -arch x86_64 %s -o %t.out -g -fsanitize=address<br>-// RUN: %test_debuginfo %s %t.out<br>-// FIXME: Remove system-darwin when we build BlocksRuntime everywhere.<br>-// REQUIRES: not_asan, system-darwin<br>-//           Zorg configures the ASAN stage2 bots to not build the asan<br>-//           compiler-rt. Only run this test on non-asanified configurations.<br>-void b();<br>-struct S {<br>-  int a[8];<br>-};<br>-<br>-int f(struct S s, unsigned i) {<br>-  // DEBUGGER: break 17<br>-  // DEBUGGER: r<br>-  // DEBUGGER: p s<br>-  // CHECK: a = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, [7] = 7)<br>-  return s.a[i];<br>-}<br>-<br>-int main(int argc, const char **argv) {<br>-  struct S s = {{0, 1, 2, 3, 4, 5, 6, 7}};<br>-  if (f(s, 4) == 4) {<br>-    // DEBUGGER: break 27<br>-    // DEBUGGER: c<br>-    // DEBUGGER: p s<br>-    // CHECK: a = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, [7] = 7)<br>-    b();<br>-  }<br>-  return 0;<br>-}<br>-<br>-void c() {}<br>-<br>-void b() {<br>-  // DEBUGGER: break 40<br>-  // DEBUGGER: c<br>-  // DEBUGGER: p x<br>-  // CHECK: 42<br>-  __block int x = 42;<br>-  c();<br>-}<br><br>Removed: debuginfo-tests/trunk/asan.c<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/asan.c?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/asan.c?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/asan.c (original)<br>+++ debuginfo-tests/trunk/asan.c (removed)<br>@@ -1,31 +0,0 @@<br>-// RUN: %clang -fblocks %target_itanium_abi_host_triple -arch x86_64 %s -o %t.out -g -fsanitize=address<br>-// RUN: %test_debuginfo %s %t.out<br>-// REQUIRES: not_asan<br>-//           Zorg configures the ASAN stage2 bots to not build the asan<br>-//           compiler-rt. Only run this test on non-asanified configurations.<br>-//<br>-<br>-struct S {<br>-  int a[8];<br>-};<br>-<br>-int f(struct S s, unsigned i) {<br>-  // DEBUGGER: break 14<br>-  return s.a[i];<br>-}<br>-<br>-int main(int argc, const char **argv) {<br>-  struct S s = {{0, 1, 2, 3, 4, 5, 6, 7}};<br>-  if (f(s, 4) == 4)<br>-    return f(s, 0);<br>-  return 0;<br>-}<br>-<br>-// DEBUGGER: r<br>-// DEBUGGER: p s<br>-// CHECK: a =<br>-// DEBUGGER: p s.a[0]<br>-// CHECK: = 0<br>-// DEBUGGER: p s.a[1]<br>-// CHECK: = 1<br>-// DEBUGGER: p s.a[7]<br><br>Removed: debuginfo-tests/trunk/block_var.m<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/block_var.m?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/block_var.m?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/block_var.m (original)<br>+++ debuginfo-tests/trunk/block_var.m (removed)<br>@@ -1,32 +0,0 @@<br>-// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>-// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out -framework Foundation<br>-// RUN: %test_debuginfo %s %t.out <br>-<br>-// REQUIRES: system-darwin<br>-<br>-// DEBUGGER: break 24<br>-// DEBUGGER: r<br>-// DEBUGGER: p result<br>-// CHECK: ${{[0-9]}} = 42<br>-<br>-void doBlock(void (^block)(void))<br>-{<br>-    block();<br>-}<br>-<br>-int I(int n)<br>-{<br>-    __block int result;<br>-    int i = 2;<br>-    doBlock(^{<br>-        result = n;<br>-    });<br>-    return result + i; /* Check value of 'result' */<br>-}<br>-<br>-<br>-int main (int argc, const char * argv[]) {<br>-  return I(42);<br>-}<br>-<br>-<br><br>Removed: debuginfo-tests/trunk/blocks.m<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/blocks.m?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/blocks.m?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/blocks.m (original)<br>+++ debuginfo-tests/trunk/blocks.m (removed)<br>@@ -1,43 +0,0 @@<br>-// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>-// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out -framework Foundation<br>-// RUN: %test_debuginfo %s %t.out <br>-<br>-// REQUIRES: system-darwin<br>-// Radar 9279956<br>-<br>-// DEBUGGER: break 31<br>-// DEBUGGER: r<br>-// DEBUGGER: p m2<br>-// CHECK: ${{[0-9]}} = 1<br>-// DEBUGGER: p dbTransaction<br>-// CHECK: ${{[0-9]}} = 0<br>-// DEBUGGER: p master<br>-// CHECK: ${{[0-9]}} = 0<br>-<br>-#include <Cocoa/Cocoa.h><br>-<br>-extern void foo(void(^)(void));<br>-<br>-@interface A:NSObject @end<br>-@implementation A<br>-- (void) helper {<br>- int master = 0;<br>- __block int m2 = 0;<br>- __block int dbTransaction = 0;<br>- int (^x)(void) = ^(void) { (void) self; <br>-<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">     </span>(void) master; <br>-<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">       </span>(void) dbTransaction; <br>-<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">        </span>m2++;<br>-<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap"> </span>return m2;<br>-<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">    </span>};<br>-  master = x();<br>-}<br>-@end<br>-<br>-void foo(void(^x)(void)) {}<br>-<br>-int main() {<br>-<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">   </span>A *a = [A alloc];<br>-<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">     </span>[a helper];<br>-<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">   </span>return 0;<br>-}<br><br>Removed: debuginfo-tests/trunk/ctor.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/ctor.cpp?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/ctor.cpp?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/ctor.cpp (original)<br>+++ debuginfo-tests/trunk/ctor.cpp (removed)<br>@@ -1,25 +0,0 @@<br>-// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>-// RUN: %clangxx %target_itanium_abi_host_triple %t.o -o %t.out<br>-// RUN: %test_debuginfo %s %t.out <br>-<br>-<br>-// DEBUGGER: break 14<br>-// DEBUGGER: r<br>-// DEBUGGER: p *this<br>-// CHECK-NEXT-NOT: Cannot access memory at address <br>-<br>-class A {<br>-public:<br>-<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">       </span>A() : zero(0), data(42)<br>-<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">       </span>{<br>-<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">     </span>}<br>-private:<br>-<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">  </span>int zero;<br>-<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">     </span>int data;<br>-};<br>-<br>-int main() {<br>-<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">      </span>A a;<br>-<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">  </span>return 0;<br>-}<br>-<br><br>Removed: debuginfo-tests/trunk/dbg-arg.c<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/dbg-arg.c?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/dbg-arg.c?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/dbg-arg.c (original)<br>+++ debuginfo-tests/trunk/dbg-arg.c (removed)<br>@@ -1,46 +0,0 @@<br>-// This test case checks debug info during register moves for an argument.<br>-// RUN: %clang %target_itanium_abi_host_triple -m64 -mllvm -fast-isel=false  %s -c -o %t.o -g<br>-// RUN: %clang %target_itanium_abi_host_triple -m64 %t.o -o %t.out<br>-// RUN: %test_debuginfo %s %t.out<br>-//<br>-// DEBUGGER: break 26<br>-// DEBUGGER: r<br>-// DEBUGGER: print mutex<br>-// CHECK:  ={{.* 0x[0-9A-Fa-f]+}}<br>-//<br>-// Radar 8412415<br>-<br>-struct _mtx<br>-{<br>-  long unsigned int ptr;<br>-  int waiters;<br>-  struct {<br>-    int tag;<br>-    int pad;<br>-  } mtxi;<br>-};<br>-<br>-<br>-int foobar(struct _mtx *mutex) {<br>-  int r = 1;<br>-  int l = 0;<br>-  int j = 0;<br>-  do {<br>-    if (mutex->waiters) {<br>-      r = 2;<br>-    }<br>-    j = bar(r, l);<br>-    ++l;<br>-  } while (l < j);<br>-  return r + j;<br>-}<br>-<br>-int bar(int i, int j) {<br>-  return i + j;<br>-}<br>-<br>-int main() {<br>-  struct _mtx m;<br>-  m.waiters = 0;<br>-  return foobar(&m);<br>-}<br><br>Removed: debuginfo-tests/trunk/foreach.m<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/foreach.m?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/foreach.m?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/foreach.m (original)<br>+++ debuginfo-tests/trunk/foreach.m (removed)<br>@@ -1,31 +0,0 @@<br>-// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>-// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out -framework Foundation<br>-// RUN: %test_debuginfo %s %t.out <br>-//<br>-// REQUIRES: system-darwin<br>-// Radar 8757124<br>-<br>-// DEBUGGER: break 25<br>-// DEBUGGER: r<br>-// DEBUGGER: po thing<br>-// CHECK: aaa<br>-<br>-#import <Foundation/Foundation.h><br>-<br>-int main (int argc, const char * argv[]) {<br>-<br>-    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];<br>-    NSArray *things = [NSArray arrayWithObjects:@"one", @"two", @"three" , nil];<br>-    for (NSString *thing in things) {<br>-        NSLog (@"%@", thing);<br>-    }<br>-    <br>-    things = [NSArray arrayWithObjects:@"aaa", @"bbb", @"ccc" , nil];<br>-    for (NSString *thing in things) {<br>-        NSLog (@"%@", thing);<br>-    }<br>-    [pool release];<br>-    return 0;<br>-}<br>-<br>-<br><br>Removed: debuginfo-tests/trunk/forward-declare-class.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/forward-declare-class.cpp?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/forward-declare-class.cpp?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/forward-declare-class.cpp (original)<br>+++ debuginfo-tests/trunk/forward-declare-class.cpp (removed)<br>@@ -1,27 +0,0 @@<br>-// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>-// RUN: %test_debuginfo %s %t.o<br>-// Radar 9168773<br>-<br>-// DEBUGGER: ptype A<br>-// Work around a gdb bug where it believes that a class is a<br>-// struct if there aren't any methods - even though it's tagged<br>-// as a class.<br>-// CHECK: type = {{struct|class}} A {<br>-// CHECK-NEXT: {{(public:){0,1}}}<br>-// CHECK-NEXT: int MyData;<br>-// CHECK-NEXT: }<br>-class A;<br>-class B {<br>-public:<br>-  void foo(const A *p);<br>-};<br>-<br>-B iEntry;<br>-<br>-class A {<br>-public:<br>-  int MyData;<br>-};<br>-<br>-A irp;<br>-<br><br>Added: debuginfo-tests/trunk/<a href="http://lit.cfg.py" target="_blank">lit.cfg.py</a><br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/lit.cfg.py?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/lit.cfg.py?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/<a href="http://lit.cfg.py" target="_blank">lit.cfg.py</a> (added)<br>+++ debuginfo-tests/trunk/<a href="http://lit.cfg.py" target="_blank">lit.cfg.py</a> Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,59 @@<br>+# -*- Python -*-<br>+<br>+import os<br>+import platform<br>+import re<br>+import subprocess<br>+import tempfile<br>+<br>+import lit.formats<br>+import lit.util<br>+<br>+from lit.llvm import llvm_config<br>+from lit.llvm.subst import ToolSubst<br>+from lit.llvm.subst import FindTool<br>+<br>+# Configuration file for the 'lit' test runner.<br>+<br>+# name: The name of this test suite.<br>+<a href="http://config.name" target="_blank">config.name</a> = 'debuginfo-tests'<br>+<br>+# testFormat: The test format to use to interpret tests.<br>+#<br>+# For now we require '&&' between commands, until they get globally killed and<br>+# the test runner updated.<br>+config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)<br>+<br>+# suffixes: A list of file extensions to treat as test files.<br>+config.suffixes = ['.c', '.cpp', '.m']<br>+<br>+# excludes: A list of directories to exclude from the testsuite. The 'Inputs'<br>+# subdirectories contain auxiliary inputs for various tests in their parent<br>+# directories.<br>+config.excludes = ['Inputs']<br>+<br>+# test_source_root: The root path where tests are located.<br>+config.test_source_root = os.path.join(config.debuginfo_tests_src_root, 'tests')<br>+<br>+# test_exec_root: The root path where tests should be run.<br>+config.test_exec_root = config.debuginfo_tests_obj_root<br>+<br>+llvm_config.use_default_substitutions()<br>+<br>+llvm_config.use_clang()<br>+<br>+if config.llvm_use_sanitizer:<br>+    # Propagate path to symbolizer for ASan/MSan.<br>+    llvm_config.with_system_environment(<br>+        ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'])<br>+<br>+tool_dirs = [config.llvm_tools_dir]<br>+<br>+tools = [<br>+    ToolSubst('%test_debuginfo', command=os.path.join(<br>+        config.llvm_src_root, 'utils', '<a href="http://test_debuginfo.pl" target="_blank">test_debuginfo.pl</a>')),<br>+]<br>+<br>+llvm_config.add_tool_substitutions(tools, tool_dirs)<br>+<br>+lit.util.usePlatformSdkOnDarwin(config, lit_config)<br><br>Removed: debuginfo-tests/trunk/lit.local.cfg<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/lit.local.cfg?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/lit.local.cfg?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/lit.local.cfg (original)<br>+++ debuginfo-tests/trunk/lit.local.cfg (removed)<br>@@ -1,3 +0,0 @@<br>-# debuginfo-tests are not expected to pass in a cross-compilation setup.<br>-if 'native' not in config.available_features:<br>-    config.unsupported = True<br><br>Added: debuginfo-tests/trunk/<a href="http://lit.site.cfg.py.in" target="_blank">lit.site.cfg.py.in</a><br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/lit.site.cfg.py.in?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/lit.site.cfg.py.in?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/<a href="http://lit.site.cfg.py.in" target="_blank">lit.site.cfg.py.in</a> (added)<br>+++ debuginfo-tests/trunk/<a href="http://lit.site.cfg.py.in" target="_blank">lit.site.cfg.py.in</a> Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,25 @@<br>+@LIT_SITE_CFG_IN_HEADER@<br>+<br>+import lit.util<br>+<br>+config.test_exec_root = "@CMAKE_BINARY_DIR@"<br>+<br>+config.llvm_src_root = "@LLVM_SOURCE_DIR@"<br>+config.llvm_obj_root = "@LLVM_BINARY_DIR@"<br>+config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"<br>+config.llvm_libs_dir = "@LLVM_LIBS_DIR@"<br>+config.llvm_shlib_dir = "@SHLIBDIR@"<br>+config.llvm_plugin_ext = "@LLVM_PLUGIN_EXT@"<br>+config.debuginfo_tests_obj_root = "@DEBUGINFO_TESTS_BINARY_DIR@"<br>+config.debuginfo_tests_src_root = "@DEBUGINFO_TESTS_SOURCE_DIR@"<br>+config.has_lld = lit.util.pythonize_bool("@DEBUGINFO_TESTS_HAS_LLD@")<br>+config.host_triple = "@LLVM_HOST_TRIPLE@"<br>+config.target_triple = "@TARGET_TRIPLE@"<br>+config.host_arch = "@HOST_ARCH@"<br>+<br>+config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"<br>+<br>+@LIT_SITE_CFG_IN_FOOTER@<br>+<br>+# Let the main config do the real work.<br>+lit_config.load_config(config, "@DEBUGINFO_TESTS_SOURCE_DIR@/<a href="http://lit.cfg.py" target="_blank">lit.cfg.py</a>")<br><br>Removed: debuginfo-tests/trunk/llgdb.py<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/llgdb.py?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/llgdb.py?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/llgdb.py (original)<br>+++ debuginfo-tests/trunk/llgdb.py (removed)<br>@@ -1,157 +0,0 @@<br>-#!/bin/env python<br>-"""<br>-A gdb-compatible frontend for lldb that implements just enough<br>-commands to run the tests in the debuginfo-tests repository with lldb.<br>-"""<br>-<br>-# ----------------------------------------------------------------------<br>-# Auto-detect lldb python module.<br>-import commands, platform, os,  sys<br>-try:<br>-    # Just try for LLDB in case PYTHONPATH is already correctly setup.<br>-    import lldb<br>-except ImportError:<br>-    lldb_python_dirs = list()<br>-    # lldb is not in the PYTHONPATH, try some defaults for the current platform.<br>-    platform_system = platform.system()<br>-    if platform_system == 'Darwin':<br>-        # On Darwin, try the currently selected Xcode directory<br>-        xcode_dir = commands.getoutput("xcode-select --print-path")<br>-        if xcode_dir:<br>-            lldb_python_dirs.append(os.path.realpath(xcode_dir +<br>-'/../SharedFrameworks/LLDB.framework/Resources/Python'))<br>-            lldb_python_dirs.append(xcode_dir +<br>-'/Library/PrivateFrameworks/LLDB.framework/Resources/Python')<br>-        lldb_python_dirs.append(<br>-'/System/Library/PrivateFrameworks/LLDB.framework/Resources/Python')<br>-    success = False<br>-    for lldb_python_dir in lldb_python_dirs:<br>-        if os.path.exists(lldb_python_dir):<br>-            if not (sys.path.__contains__(lldb_python_dir)):<br>-                sys.path.append(lldb_python_dir)<br>-                try:<br>-                    import lldb<br>-                except ImportError:<br>-                    pass<br>-                else:<br>-                    print 'imported lldb from: "%s"' % (lldb_python_dir)<br>-                    success = True<br>-                    break<br>-    if not success:<br>-        print "error: couldn't locate the 'lldb' module, please set PYTHONPATH correctly"<br>-        sys.exit(1)<br>-# ----------------------------------------------------------------------<br>-<br>-# Command line option handling.<br>-import argparse<br>-parser = argparse.ArgumentParser(description=__doc__)<br>-parser.add_argument('--quiet', '-q', action="store_true", help='ignored')<br>-parser.add_argument('-batch', action="store_true",<br>-                    help='exit after processing comand line')<br>-parser.add_argument('-n', action="store_true", help='ignore .lldb file')<br>-parser.add_argument('-x', dest='script', type=file, help='execute commands from file')<br>-parser.add_argument("target", help="the program to debug")<br>-args = parser.parse_args()<br>-<br>-<br>-# Create a new debugger instance.<br>-debugger = lldb.SBDebugger.Create()<br>-debugger.SkipLLDBInitFiles(args.n)<br>-<br>-# Don't return from lldb function calls until the process stops.<br>-debugger.SetAsync(False)<br>-<br>-# Create a target from a file and arch.<br>-arch = os.popen("file "+args.target).read().split()[-1]<br>-target = debugger.CreateTargetWithFileAndArch(args.target, arch)<br>-<br>-if not target:<br>-    print "Could not create target", args.target<br>-    sys.exit(1)<br>-<br>-if not args.script:<br>-    print "Interactive mode is not implemented."<br>-    sys.exit(1)<br>-<br>-import re<br>-for command in args.script:<br>-    # Strip newline and whitespaces and split into words.<br>-    cmd = command[:-1].strip().split()<br>-    if not cmd:<br>-        continue<br>-<br>-    print '> %s'% command[:-1]<br>-<br>-    try:<br>-        if re.match('^r|(run)$', cmd[0]):<br>-            error = lldb.SBError()<br>-            launchinfo = lldb.SBLaunchInfo([])<br>-            launchinfo.SetWorkingDirectory(os.getcwd())<br>-            process = target.Launch(launchinfo, error)<br>-            print error<br>-            if not process or error.fail:<br>-                state = process.GetState()<br>-                print "State = %d" % state<br>-                print """<br>-ERROR: Could not launch process.<br>-NOTE: There are several reasons why this may happen:<br>-  * Root needs to run "DevToolsSecurity --enable".<br>-  * Older versions of lldb cannot launch more than one process simultaneously.<br>-"""<br>-                sys.exit(1)<br>-<br>-        elif re.match('^b|(break)$', cmd[0]) and len(cmd) == 2:<br>-            if re.match('[0-9]+', cmd[1]):<br>-                # b line<br>-                mainfile = target.FindFunctions('main')[0].compile_unit.file<br>-                print target.BreakpointCreateByLocation(mainfile, int(cmd[1]))<br>-            else:<br>-                # b file:line<br>-                file, line = cmd[1].split(':')<br>-                print target.BreakpointCreateByLocation(file, int(line))<br>-<br>-        elif re.match('^ptype$', cmd[0]) and len(cmd) == 2:<br>-            # GDB's ptype has multiple incarnations depending on its<br>-            # argument (global variable, function, type).  The definition<br>-            # here is for looking up the signature of a function and only<br>-            # if that fails it looks for a type with that name.<br>-            # Type lookup in LLDB would be "image lookup --type".<br>-            for elem in target.FindFunctions(cmd[1]):<br>-                print elem.function.type<br>-                continue<br>-            print target.FindFirstType(cmd[1])<br>-<br>-        elif re.match('^po$', cmd[0]) and len(cmd) > 1:<br>-            try:<br>-                opts = lldb.SBExpressionOptions()<br>-                opts.SetFetchDynamicValue(True)<br>-                opts.SetCoerceResultToId(True)<br>-                print target.EvaluateExpression(' '.join(cmd[1:]), opts)<br>-            except:<br>-                # FIXME: This is a fallback path for the <a href="http://lab.llvm.org" target="_blank">lab.llvm.org</a><br>-                # buildbot running OS X 10.7; it should be removed.<br>-                thread = process.GetThreadAtIndex(0)<br>-                frame = thread.GetFrameAtIndex(0)<br>-                print frame.EvaluateExpression(' '.join(cmd[1:]))<br>-<br>-        elif re.match('^p|(print)$', cmd[0]) and len(cmd) > 1:<br>-            thread = process.GetThreadAtIndex(0)<br>-            frame = thread.GetFrameAtIndex(0)<br>-            print frame.EvaluateExpression(' '.join(cmd[1:]))<br>-<br>-        elif re.match('^n|(next)$', cmd[0]):<br>-            thread = process.GetThreadAtIndex(0)<br>-            thread.StepOver()<br>-<br>-        elif re.match('^q|(quit)$', cmd[0]):<br>-            sys.exit(0)<br>-<br>-        else:<br>-            print debugger.HandleCommand(' '.join(cmd))<br>-<br>-    except SystemExit:<br>-        lldb.SBDebugger_Terminate()<br>-        raise<br>-    except:<br>-        print 'Could not handle the command "%s"' % ' '.join(cmd)<br>-<br><br>Removed: debuginfo-tests/trunk/nested-struct.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/nested-struct.cpp?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/nested-struct.cpp?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/nested-struct.cpp (original)<br>+++ debuginfo-tests/trunk/nested-struct.cpp (removed)<br>@@ -1,21 +0,0 @@<br>-// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>-// RUN: %test_debuginfo %s %t.o<br>-// Radar 9440721<br>-// If debug info for my_number() is emitted outside function foo's scope<br>-// then a debugger may not be able to handle it. At least one version of<br>-// gdb crashes in such cases.<br>-<br>-// DEBUGGER: ptype foo<br>-// CHECK: int (void)<br>-<br>-int foo() {<br>-  struct Local {<br>-    static int my_number() {<br>-      return 42;<br>-    }<br>-  };<br>-<br>-  int i = 0;<br>-  i = Local::my_number();<br>-  return i + 1;<br>-}<br><br>Removed: debuginfo-tests/trunk/nrvo-string.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/nrvo-string.cpp?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/nrvo-string.cpp?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/nrvo-string.cpp (original)<br>+++ debuginfo-tests/trunk/nrvo-string.cpp (removed)<br>@@ -1,27 +0,0 @@<br>-// This ensures that DW_OP_deref is inserted when necessary, such as when NRVO<br>-// of a string object occurs in C++.<br>-//<br>-// RUN: %clangxx -O0 -fno-exceptions %target_itanium_abi_host_triple %s -o %t.out -g<br>-// RUN: %test_debuginfo %s %t.out<br>-// RUN: %clangxx -O1 -fno-exceptions %target_itanium_abi_host_triple %s -o %t.out -g<br>-// RUN: %test_debuginfo %s %t.out<br>-//<br>-// PR34513<br>-<br>-struct string {<br>-  string() {}<br>-  string(int i) : i(i) {}<br>-  ~string() {}<br>-  int i = 0;<br>-};<br>-string get_string() {<br>-  string unused;<br>-  string result = 3;<br>-// DEBUGGER: break 21<br>-  return result;<br>-}<br>-int main() { get_string(); }<br>-<br>-// DEBUGGER: r<br>-// DEBUGGER: print result.i<br>-// CHECK:  = 3<br><br>Removed: debuginfo-tests/trunk/safestack.c<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/safestack.c?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/safestack.c?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/safestack.c (original)<br>+++ debuginfo-tests/trunk/safestack.c (removed)<br>@@ -1,51 +0,0 @@<br>-// RUN: %clang %target_itanium_abi_host_triple -arch x86_64 %s -o %t.out -g -fsanitize=safe-stack<br>-// RUN: %test_debuginfo %s %t.out<br>-// REQUIRES: not_asan<br>-//           Zorg configures the ASAN stage2 bots to not build the<br>-//           safestack compiler-rt.  Only run this test on<br>-//           non-asanified configurations.<br>-<br>-struct S {<br>-  int a[8];<br>-};<br>-<br>-int f(struct S s, unsigned i);<br>-<br>-int main(int argc, const char **argv) {<br>-  struct S s = {{0, 1, 2, 3, 4, 5, 6, 7}};<br>-  // DEBUGGER: break 17<br>-  f(s, 4);<br>-  // DEBUGGER: break 19<br>-  return 0;<br>-}<br>-<br>-int f(struct S s, unsigned i) {<br>-  // DEBUGGER: break 24<br>-  return s.a[i];<br>-}<br>-<br>-// DEBUGGER: r<br>-// DEBUGGER: p s<br>-// CHECK: a =<br>-// DEBUGGER: p s.a[0]<br>-// CHECK: = 0<br>-// DEBUGGER: p s.a[1]<br>-// CHECK: = 1<br>-// DEBUGGER: p s.a[7]<br>-// CHECK: = 7<br>-// DEBUGGER: c<br>-// DEBUGGER: p s<br>-// CHECK: a =<br>-// DEBUGGER: p s.a[0]<br>-// CHECK: = 0<br>-// DEBUGGER: p s.a[1]<br>-// CHECK: = 1<br>-// DEBUGGER: p s.a[7]<br>-// DEBUGGER: c<br>-// DEBUGGER: p s<br>-// CHECK: a =<br>-// DEBUGGER: p s.a[0]<br>-// CHECK: = 0<br>-// DEBUGGER: p s.a[1]<br>-// CHECK: = 1<br>-// DEBUGGER: p s.a[7]<br><br>Removed: debuginfo-tests/trunk/sret.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/sret.cpp?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/sret.cpp?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/sret.cpp (original)<br>+++ debuginfo-tests/trunk/sret.cpp (removed)<br>@@ -1,71 +0,0 @@<br>-// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>-// RUN: %clangxx %target_itanium_abi_host_triple %t.o -o %t.out<br>-// RUN: %test_debuginfo %s %t.out <br>-// Radar 8775834<br>-// DEBUGGER: break 62<br>-// DEBUGGER: r<br>-// DEBUGGER: p a<br>-// CHECK: ${{[0-9]+}} =<br>-// LLDB does not print artificial members.<br>-// CHECK:  {{(_vptr\$A =)?.*}}m_int = 12<br>-<br>-class A<br>-{<br>-public:<br>-    A (int i=0);<br>-    A (const A& rhs);<br>-    const A&<br>-    operator= (const A& rhs);<br>-    virtual ~A() {}<br>-<br>-    int get_int();<br>-<br>-protected:<br>-    int m_int;<br>-};<br>-<br>-A::A (int i) : <br>-    m_int(i)<br>-{<br>-}<br>-<br>-A::A (const A& rhs) :<br>-    m_int (rhs.m_int)<br>-{<br>-}<br>-<br>-const A &<br>-A::operator =(const A& rhs)<br>-{<br>-    m_int = rhs.m_int;<br>-    return *this;<br>-}<br>-<br>-int A::get_int()<br>-{<br>-    return m_int;<br>-}<br>-<br>-class B<br>-{<br>-public:<br>-    B () {}<br>-    <br>-    A AInstance();<br>-};<br>-<br>-A <br>-B::AInstance()<br>-{<br>-    A a(12);<br>-    return a;<br>-}<br>-<br>-int main (int argc, char const *argv[])<br>-{<br>-    B b;<br>-    int return_val = b.AInstance().get_int();<br>-    <br>-    A a(b.AInstance());<br>-    return return_val;<br>-}<br><br>Removed: debuginfo-tests/trunk/stack-var.c<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/stack-var.c?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/stack-var.c?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/stack-var.c (original)<br>+++ debuginfo-tests/trunk/stack-var.c (removed)<br>@@ -1,18 +0,0 @@<br>-// RUN: %clang %target_itanium_abi_host_triple %s -O -o %t.out -g<br>-// RUN: %test_debuginfo %s %t.out<br>-<br>-void __attribute__((noinline, optnone)) bar(int *test) {}<br>-int main() {<br>-  int test;<br>-  test = 23;<br>-  // DEBUGGER: break 12<br>-  // DEBUGGER: r<br>-  // DEBUGGER: p test<br>-  // CHECK: = 23<br>-  bar(&test);<br>-  // DEBUGGER: break 17<br>-  // DEBUGGER: c<br>-  // DEBUGGER: p test<br>-  // CHECK: = 23<br>-  return test;<br>-}<br><br>Removed: debuginfo-tests/trunk/static-member-2.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/static-member-2.cpp?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/static-member-2.cpp?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/static-member-2.cpp (original)<br>+++ debuginfo-tests/trunk/static-member-2.cpp (removed)<br>@@ -1,39 +0,0 @@<br>-// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -o %t -c<br>-// RUN: %clangxx %target_itanium_abi_host_triple %t -o %t.out<br>-// RUN: %test_debuginfo %s %t.out<br>-<br>-// FIXME: LLDB finds the wrong symbol for "C". <a>rdar://problem/14933867</a><br>-// XFAIL: darwin<br>-<br>-// DEBUGGER: delete breakpoints<br>-// DEBUGGER: break static-member.cpp:33<br>-// DEBUGGER: r<br>-// DEBUGGER: ptype C<br>-// CHECK:      {{struct|class}} C {<br>-// CHECK:      static const int a;<br>-// CHECK-NEXT: static int b;<br>-// CHECK-NEXT: static int c;<br>-// CHECK-NEXT: int d;<br>-// CHECK-NEXT: }<br>-// DEBUGGER: p C::a<br>-// CHECK: ${{[0-9]}} = 4<br>-// DEBUGGER: p C::c<br>-// CHECK: ${{[0-9]}} = 15<br>-<br>-// PR14471, PR14734<br>-<br>-class C {<br>-public:<br>-  const static int a = 4;<br>-  static int b;<br>-  static int c;<br>-  int d;<br>-};<br>-<br>-int C::c = 15;<br>-const int C::a;<br>-<br>-int main() {<br>-    C instance_C;<br>-    return C::a;<br>-}<br><br>Removed: debuginfo-tests/trunk/static-member.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/static-member.cpp?rev=318434&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/static-member.cpp?rev=318434&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/static-member.cpp (original)<br>+++ debuginfo-tests/trunk/static-member.cpp (removed)<br>@@ -1,36 +0,0 @@<br>-// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -o %t -c<br>-// RUN: %clangxx %target_itanium_abi_host_triple %t -o %t.out<br>-// RUN: %test_debuginfo %s %t.out<br>-<br>-// DEBUGGER: delete breakpoints<br>-// DEBUGGER: break static-member.cpp:33<br>-// DEBUGGER: r<br>-// DEBUGGER: ptype MyClass<br>-// CHECK:      {{struct|class}} MyClass {<br>-// CHECK:      static const int a;<br>-// CHECK-NEXT: static int b;<br>-// CHECK-NEXT: static int c;<br>-// CHECK-NEXT: int d;<br>-// CHECK-NEXT: }<br>-// DEBUGGER: p MyClass::a<br>-// CHECK: ${{[0-9]}} = 4<br>-// DEBUGGER: p MyClass::c<br>-// CHECK: ${{[0-9]}} = 15<br>-<br>-// PR14471, PR14734<br>-<br>-class MyClass {<br>-public:<br>-  const static int a = 4;<br>-  static int b;<br>-  static int c;<br>-  int d;<br>-};<br>-<br>-int MyClass::c = 15;<br>-const int MyClass::a;<br>-<br>-int main() {<br>-    MyClass instance_MyClass;<br>-    return MyClass::a;<br>-}<br><br>Added: debuginfo-tests/trunk/tests/aggregate-indirect-arg.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/aggregate-indirect-arg.cpp?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/aggregate-indirect-arg.cpp?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/aggregate-indirect-arg.cpp (added)<br>+++ debuginfo-tests/trunk/tests/aggregate-indirect-arg.cpp Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,32 @@<br>+// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>+// RUN: %clangxx %target_itanium_abi_host_triple %t.o -o %t.out<br>+// RUN: %test_debuginfo %s %t.out<br>+// Radar 8945514<br>+// DEBUGGER: break 22<br>+// DEBUGGER: r<br>+// DEBUGGER: p v<br>+// CHECK: ${{[0-9]+}} =<br>+// CHECK:  Data ={{.*}} 0x0{{(0*)}}<br>+// CHECK:  Kind = 2142<br>+<br>+class SVal {<br>+public:<br>+  ~SVal() {}<br>+  const void* Data;<br>+  unsigned Kind;<br>+};<br>+<br>+void bar(SVal &v) {}<br>+class A {<br>+public:<br>+  void foo(SVal v) { bar(v); }<br>+};<br>+<br>+int main() {<br>+  SVal v;<br>+  v.Data = 0;<br>+  v.Kind = 2142;<br>+  A a;<br>+  a.foo(v);<br>+  return 0;<br>+}<br><br>Added: debuginfo-tests/trunk/tests/asan-blocks.c<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/asan-blocks.c?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/asan-blocks.c?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/asan-blocks.c (added)<br>+++ debuginfo-tests/trunk/tests/asan-blocks.c Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,41 @@<br>+// RUN: %clang -fblocks %target_itanium_abi_host_triple -arch x86_64 %s -o %t.out -g -fsanitize=address<br>+// RUN: %test_debuginfo %s %t.out<br>+// FIXME: Remove system-darwin when we build BlocksRuntime everywhere.<br>+// REQUIRES: not_asan, system-darwin<br>+//           Zorg configures the ASAN stage2 bots to not build the asan<br>+//           compiler-rt. Only run this test on non-asanified configurations.<br>+void b();<br>+struct S {<br>+  int a[8];<br>+};<br>+<br>+int f(struct S s, unsigned i) {<br>+  // DEBUGGER: break 17<br>+  // DEBUGGER: r<br>+  // DEBUGGER: p s<br>+  // CHECK: a = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, [7] = 7)<br>+  return s.a[i];<br>+}<br>+<br>+int main(int argc, const char **argv) {<br>+  struct S s = {{0, 1, 2, 3, 4, 5, 6, 7}};<br>+  if (f(s, 4) == 4) {<br>+    // DEBUGGER: break 27<br>+    // DEBUGGER: c<br>+    // DEBUGGER: p s<br>+    // CHECK: a = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, [7] = 7)<br>+    b();<br>+  }<br>+  return 0;<br>+}<br>+<br>+void c() {}<br>+<br>+void b() {<br>+  // DEBUGGER: break 40<br>+  // DEBUGGER: c<br>+  // DEBUGGER: p x<br>+  // CHECK: 42<br>+  __block int x = 42;<br>+  c();<br>+}<br><br>Added: debuginfo-tests/trunk/tests/asan.c<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/asan.c?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/asan.c?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/asan.c (added)<br>+++ debuginfo-tests/trunk/tests/asan.c Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,31 @@<br>+// RUN: %clang -fblocks %target_itanium_abi_host_triple -arch x86_64 %s -o %t.out -g -fsanitize=address<br>+// RUN: %test_debuginfo %s %t.out<br>+// REQUIRES: not_asan<br>+//           Zorg configures the ASAN stage2 bots to not build the asan<br>+//           compiler-rt. Only run this test on non-asanified configurations.<br>+//<br>+<br>+struct S {<br>+  int a[8];<br>+};<br>+<br>+int f(struct S s, unsigned i) {<br>+  // DEBUGGER: break 14<br>+  return s.a[i];<br>+}<br>+<br>+int main(int argc, const char **argv) {<br>+  struct S s = {{0, 1, 2, 3, 4, 5, 6, 7}};<br>+  if (f(s, 4) == 4)<br>+    return f(s, 0);<br>+  return 0;<br>+}<br>+<br>+// DEBUGGER: r<br>+// DEBUGGER: p s<br>+// CHECK: a =<br>+// DEBUGGER: p s.a[0]<br>+// CHECK: = 0<br>+// DEBUGGER: p s.a[1]<br>+// CHECK: = 1<br>+// DEBUGGER: p s.a[7]<br><br>Added: debuginfo-tests/trunk/tests/block_var.m<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/block_var.m?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/block_var.m?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/block_var.m (added)<br>+++ debuginfo-tests/trunk/tests/block_var.m Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,32 @@<br>+// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>+// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out -framework Foundation<br>+// RUN: %test_debuginfo %s %t.out<br>+<br>+// REQUIRES: system-darwin<br>+<br>+// DEBUGGER: break 24<br>+// DEBUGGER: r<br>+// DEBUGGER: p result<br>+// CHECK: ${{[0-9]}} = 42<br>+<br>+void doBlock(void (^block)(void))<br>+{<br>+    block();<br>+}<br>+<br>+int I(int n)<br>+{<br>+    __block int result;<br>+    int i = 2;<br>+    doBlock(^{<br>+        result = n;<br>+    });<br>+    return result + i; /* Check value of 'result' */<br>+}<br>+<br>+<br>+int main (int argc, const char * argv[]) {<br>+  return I(42);<br>+}<br>+<br>+<br><br>Added: debuginfo-tests/trunk/tests/blocks.m<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/blocks.m?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/blocks.m?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/blocks.m (added)<br>+++ debuginfo-tests/trunk/tests/blocks.m Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,43 @@<br>+// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>+// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out -framework Foundation<br>+// RUN: %test_debuginfo %s %t.out<br>+<br>+// REQUIRES: system-darwin<br>+// Radar 9279956<br>+<br>+// DEBUGGER: break 31<br>+// DEBUGGER: r<br>+// DEBUGGER: p m2<br>+// CHECK: ${{[0-9]}} = 1<br>+// DEBUGGER: p dbTransaction<br>+// CHECK: ${{[0-9]}} = 0<br>+// DEBUGGER: p master<br>+// CHECK: ${{[0-9]}} = 0<br>+<br>+#include <Cocoa/Cocoa.h><br>+<br>+extern void foo(void(^)(void));<br>+<br>+@interface A:NSObject @end<br>+@implementation A<br>+- (void) helper {<br>+ int master = 0;<br>+ __block int m2 = 0;<br>+ __block int dbTransaction = 0;<br>+ int (^x)(void) = ^(void) { (void) self;<br>+<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">        </span>(void) master;<br>+<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">        </span>(void) dbTransaction;<br>+<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap"> </span>m2++;<br>+<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap"> </span>return m2;<br>+<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">    </span>};<br>+  master = x();<br>+}<br>+@end<br>+<br>+void foo(void(^x)(void)) {}<br>+<br>+int main() {<br>+<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">   </span>A *a = [A alloc];<br>+<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">     </span>[a helper];<br>+<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">   </span>return 0;<br>+}<br><br>Added: debuginfo-tests/trunk/tests/ctor.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/ctor.cpp?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/ctor.cpp?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/ctor.cpp (added)<br>+++ debuginfo-tests/trunk/tests/ctor.cpp Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,25 @@<br>+// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>+// RUN: %clangxx %target_itanium_abi_host_triple %t.o -o %t.out<br>+// RUN: %test_debuginfo %s %t.out<br>+<br>+<br>+// DEBUGGER: break 14<br>+// DEBUGGER: r<br>+// DEBUGGER: p *this<br>+// CHECK-NEXT-NOT: Cannot access memory at address<br>+<br>+class A {<br>+public:<br>+<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap"> </span>A() : zero(0), data(42)<br>+<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">       </span>{<br>+<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">     </span>}<br>+private:<br>+<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">  </span>int zero;<br>+<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">     </span>int data;<br>+};<br>+<br>+int main() {<br>+<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">      </span>A a;<br>+<span class="m_-8698121616152739205Apple-tab-span" style="white-space:pre-wrap">  </span>return 0;<br>+}<br>+<br><br>Added: debuginfo-tests/trunk/tests/dbg-arg.c<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/dbg-arg.c?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/dbg-arg.c?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/dbg-arg.c (added)<br>+++ debuginfo-tests/trunk/tests/dbg-arg.c Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,46 @@<br>+// This test case checks debug info during register moves for an argument.<br>+// RUN: %clang %target_itanium_abi_host_triple -m64 -mllvm -fast-isel=false  %s -c -o %t.o -g<br>+// RUN: %clang %target_itanium_abi_host_triple -m64 %t.o -o %t.out<br>+// RUN: %test_debuginfo %s %t.out<br>+//<br>+// DEBUGGER: break 26<br>+// DEBUGGER: r<br>+// DEBUGGER: print mutex<br>+// CHECK:  ={{.* 0x[0-9A-Fa-f]+}}<br>+//<br>+// Radar 8412415<br>+<br>+struct _mtx<br>+{<br>+  long unsigned int ptr;<br>+  int waiters;<br>+  struct {<br>+    int tag;<br>+    int pad;<br>+  } mtxi;<br>+};<br>+<br>+<br>+int foobar(struct _mtx *mutex) {<br>+  int r = 1;<br>+  int l = 0;<br>+  int j = 0;<br>+  do {<br>+    if (mutex->waiters) {<br>+      r = 2;<br>+    }<br>+    j = bar(r, l);<br>+    ++l;<br>+  } while (l < j);<br>+  return r + j;<br>+}<br>+<br>+int bar(int i, int j) {<br>+  return i + j;<br>+}<br>+<br>+int main() {<br>+  struct _mtx m;<br>+  m.waiters = 0;<br>+  return foobar(&m);<br>+}<br><br>Added: debuginfo-tests/trunk/tests/foreach.m<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/foreach.m?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/foreach.m?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/foreach.m (added)<br>+++ debuginfo-tests/trunk/tests/foreach.m Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,31 @@<br>+// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>+// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out -framework Foundation<br>+// RUN: %test_debuginfo %s %t.out<br>+//<br>+// REQUIRES: system-darwin<br>+// Radar 8757124<br>+<br>+// DEBUGGER: break 25<br>+// DEBUGGER: r<br>+// DEBUGGER: po thing<br>+// CHECK: aaa<br>+<br>+#import <Foundation/Foundation.h><br>+<br>+int main (int argc, const char * argv[]) {<br>+<br>+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];<br>+    NSArray *things = [NSArray arrayWithObjects:@"one", @"two", @"three" , nil];<br>+    for (NSString *thing in things) {<br>+        NSLog (@"%@", thing);<br>+    }<br>+<br>+    things = [NSArray arrayWithObjects:@"aaa", @"bbb", @"ccc" , nil];<br>+    for (NSString *thing in things) {<br>+        NSLog (@"%@", thing);<br>+    }<br>+    [pool release];<br>+    return 0;<br>+}<br>+<br>+<br><br>Added: debuginfo-tests/trunk/tests/forward-declare-class.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/forward-declare-class.cpp?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/forward-declare-class.cpp?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/forward-declare-class.cpp (added)<br>+++ debuginfo-tests/trunk/tests/forward-declare-class.cpp Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,27 @@<br>+// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>+// RUN: %test_debuginfo %s %t.o<br>+// Radar 9168773<br>+<br>+// DEBUGGER: ptype A<br>+// Work around a gdb bug where it believes that a class is a<br>+// struct if there aren't any methods - even though it's tagged<br>+// as a class.<br>+// CHECK: type = {{struct|class}} A {<br>+// CHECK-NEXT: {{(public:){0,1}}}<br>+// CHECK-NEXT: int MyData;<br>+// CHECK-NEXT: }<br>+class A;<br>+class B {<br>+public:<br>+  void foo(const A *p);<br>+};<br>+<br>+B iEntry;<br>+<br>+class A {<br>+public:<br>+  int MyData;<br>+};<br>+<br>+A irp;<br>+<br><br>Added: debuginfo-tests/trunk/tests/lit.local.cfg<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/lit.local.cfg?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/lit.local.cfg?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/lit.local.cfg (added)<br>+++ debuginfo-tests/trunk/tests/lit.local.cfg Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,3 @@<br>+# debuginfo-tests are not expected to pass in a cross-compilation setup.<br>+if 'native' not in config.available_features:<br>+    config.unsupported = True<br><br>Added: debuginfo-tests/trunk/tests/llgdb.py<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/llgdb.py?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/llgdb.py?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/llgdb.py (added)<br>+++ debuginfo-tests/trunk/tests/llgdb.py Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,157 @@<br>+#!/bin/env python<br>+"""<br>+A gdb-compatible frontend for lldb that implements just enough<br>+commands to run the tests in the debuginfo-tests repository with lldb.<br>+"""<br>+<br>+# ----------------------------------------------------------------------<br>+# Auto-detect lldb python module.<br>+import commands, platform, os,  sys<br>+try:<br>+    # Just try for LLDB in case PYTHONPATH is already correctly setup.<br>+    import lldb<br>+except ImportError:<br>+    lldb_python_dirs = list()<br>+    # lldb is not in the PYTHONPATH, try some defaults for the current platform.<br>+    platform_system = platform.system()<br>+    if platform_system == 'Darwin':<br>+        # On Darwin, try the currently selected Xcode directory<br>+        xcode_dir = commands.getoutput("xcode-select --print-path")<br>+        if xcode_dir:<br>+            lldb_python_dirs.append(os.path.realpath(xcode_dir +<br>+'/../SharedFrameworks/LLDB.framework/Resources/Python'))<br>+            lldb_python_dirs.append(xcode_dir +<br>+'/Library/PrivateFrameworks/LLDB.framework/Resources/Python')<br>+        lldb_python_dirs.append(<br>+'/System/Library/PrivateFrameworks/LLDB.framework/Resources/Python')<br>+    success = False<br>+    for lldb_python_dir in lldb_python_dirs:<br>+        if os.path.exists(lldb_python_dir):<br>+            if not (sys.path.__contains__(lldb_python_dir)):<br>+                sys.path.append(lldb_python_dir)<br>+                try:<br>+                    import lldb<br>+                except ImportError:<br>+                    pass<br>+                else:<br>+                    print 'imported lldb from: "%s"' % (lldb_python_dir)<br>+                    success = True<br>+                    break<br>+    if not success:<br>+        print "error: couldn't locate the 'lldb' module, please set PYTHONPATH correctly"<br>+        sys.exit(1)<br>+# ----------------------------------------------------------------------<br>+<br>+# Command line option handling.<br>+import argparse<br>+parser = argparse.ArgumentParser(description=__doc__)<br>+parser.add_argument('--quiet', '-q', action="store_true", help='ignored')<br>+parser.add_argument('-batch', action="store_true",<br>+                    help='exit after processing comand line')<br>+parser.add_argument('-n', action="store_true", help='ignore .lldb file')<br>+parser.add_argument('-x', dest='script', type=file, help='execute commands from file')<br>+parser.add_argument("target", help="the program to debug")<br>+args = parser.parse_args()<br>+<br>+<br>+# Create a new debugger instance.<br>+debugger = lldb.SBDebugger.Create()<br>+debugger.SkipLLDBInitFiles(args.n)<br>+<br>+# Don't return from lldb function calls until the process stops.<br>+debugger.SetAsync(False)<br>+<br>+# Create a target from a file and arch.<br>+arch = os.popen("file "+args.target).read().split()[-1]<br>+target = debugger.CreateTargetWithFileAndArch(args.target, arch)<br>+<br>+if not target:<br>+    print "Could not create target", args.target<br>+    sys.exit(1)<br>+<br>+if not args.script:<br>+    print "Interactive mode is not implemented."<br>+    sys.exit(1)<br>+<br>+import re<br>+for command in args.script:<br>+    # Strip newline and whitespaces and split into words.<br>+    cmd = command[:-1].strip().split()<br>+    if not cmd:<br>+        continue<br>+<br>+    print '> %s'% command[:-1]<br>+<br>+    try:<br>+        if re.match('^r|(run)$', cmd[0]):<br>+            error = lldb.SBError()<br>+            launchinfo = lldb.SBLaunchInfo([])<br>+            launchinfo.SetWorkingDirectory(os.getcwd())<br>+            process = target.Launch(launchinfo, error)<br>+            print error<br>+            if not process or error.fail:<br>+                state = process.GetState()<br>+                print "State = %d" % state<br>+                print """<br>+ERROR: Could not launch process.<br>+NOTE: There are several reasons why this may happen:<br>+  * Root needs to run "DevToolsSecurity --enable".<br>+  * Older versions of lldb cannot launch more than one process simultaneously.<br>+"""<br>+                sys.exit(1)<br>+<br>+        elif re.match('^b|(break)$', cmd[0]) and len(cmd) == 2:<br>+            if re.match('[0-9]+', cmd[1]):<br>+                # b line<br>+                mainfile = target.FindFunctions('main')[0].compile_unit.file<br>+                print target.BreakpointCreateByLocation(mainfile, int(cmd[1]))<br>+            else:<br>+                # b file:line<br>+                file, line = cmd[1].split(':')<br>+                print target.BreakpointCreateByLocation(file, int(line))<br>+<br>+        elif re.match('^ptype$', cmd[0]) and len(cmd) == 2:<br>+            # GDB's ptype has multiple incarnations depending on its<br>+            # argument (global variable, function, type).  The definition<br>+            # here is for looking up the signature of a function and only<br>+            # if that fails it looks for a type with that name.<br>+            # Type lookup in LLDB would be "image lookup --type".<br>+            for elem in target.FindFunctions(cmd[1]):<br>+                print elem.function.type<br>+                continue<br>+            print target.FindFirstType(cmd[1])<br>+<br>+        elif re.match('^po$', cmd[0]) and len(cmd) > 1:<br>+            try:<br>+                opts = lldb.SBExpressionOptions()<br>+                opts.SetFetchDynamicValue(True)<br>+                opts.SetCoerceResultToId(True)<br>+                print target.EvaluateExpression(' '.join(cmd[1:]), opts)<br>+            except:<br>+                # FIXME: This is a fallback path for the <a href="http://lab.llvm.org" target="_blank">lab.llvm.org</a><br>+                # buildbot running OS X 10.7; it should be removed.<br>+                thread = process.GetThreadAtIndex(0)<br>+                frame = thread.GetFrameAtIndex(0)<br>+                print frame.EvaluateExpression(' '.join(cmd[1:]))<br>+<br>+        elif re.match('^p|(print)$', cmd[0]) and len(cmd) > 1:<br>+            thread = process.GetThreadAtIndex(0)<br>+            frame = thread.GetFrameAtIndex(0)<br>+            print frame.EvaluateExpression(' '.join(cmd[1:]))<br>+<br>+        elif re.match('^n|(next)$', cmd[0]):<br>+            thread = process.GetThreadAtIndex(0)<br>+            thread.StepOver()<br>+<br>+        elif re.match('^q|(quit)$', cmd[0]):<br>+            sys.exit(0)<br>+<br>+        else:<br>+            print debugger.HandleCommand(' '.join(cmd))<br>+<br>+    except SystemExit:<br>+        lldb.SBDebugger_Terminate()<br>+        raise<br>+    except:<br>+        print 'Could not handle the command "%s"' % ' '.join(cmd)<br>+<br><br>Added: debuginfo-tests/trunk/tests/nested-struct.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/nested-struct.cpp?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/nested-struct.cpp?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/nested-struct.cpp (added)<br>+++ debuginfo-tests/trunk/tests/nested-struct.cpp Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,21 @@<br>+// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>+// RUN: %test_debuginfo %s %t.o<br>+// Radar 9440721<br>+// If debug info for my_number() is emitted outside function foo's scope<br>+// then a debugger may not be able to handle it. At least one version of<br>+// gdb crashes in such cases.<br>+<br>+// DEBUGGER: ptype foo<br>+// CHECK: int (void)<br>+<br>+int foo() {<br>+  struct Local {<br>+    static int my_number() {<br>+      return 42;<br>+    }<br>+  };<br>+<br>+  int i = 0;<br>+  i = Local::my_number();<br>+  return i + 1;<br>+}<br><br>Added: debuginfo-tests/trunk/tests/nrvo-string.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/nrvo-string.cpp?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/nrvo-string.cpp?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/nrvo-string.cpp (added)<br>+++ debuginfo-tests/trunk/tests/nrvo-string.cpp Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,27 @@<br>+// This ensures that DW_OP_deref is inserted when necessary, such as when NRVO<br>+// of a string object occurs in C++.<br>+//<br>+// RUN: %clangxx -O0 -fno-exceptions %target_itanium_abi_host_triple %s -o %t.out -g<br>+// RUN: %test_debuginfo %s %t.out<br>+// RUN: %clangxx -O1 -fno-exceptions %target_itanium_abi_host_triple %s -o %t.out -g<br>+// RUN: %test_debuginfo %s %t.out<br>+//<br>+// PR34513<br>+<br>+struct string {<br>+  string() {}<br>+  string(int i) : i(i) {}<br>+  ~string() {}<br>+  int i = 0;<br>+};<br>+string get_string() {<br>+  string unused;<br>+  string result = 3;<br>+// DEBUGGER: break 21<br>+  return result;<br>+}<br>+int main() { get_string(); }<br>+<br>+// DEBUGGER: r<br>+// DEBUGGER: print result.i<br>+// CHECK:  = 3<br><br>Added: debuginfo-tests/trunk/tests/safestack.c<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/safestack.c?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/safestack.c?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/safestack.c (added)<br>+++ debuginfo-tests/trunk/tests/safestack.c Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,51 @@<br>+// RUN: %clang %target_itanium_abi_host_triple -arch x86_64 %s -o %t.out -g -fsanitize=safe-stack<br>+// RUN: %test_debuginfo %s %t.out<br>+// REQUIRES: not_asan<br>+//           Zorg configures the ASAN stage2 bots to not build the<br>+//           safestack compiler-rt.  Only run this test on<br>+//           non-asanified configurations.<br>+<br>+struct S {<br>+  int a[8];<br>+};<br>+<br>+int f(struct S s, unsigned i);<br>+<br>+int main(int argc, const char **argv) {<br>+  struct S s = {{0, 1, 2, 3, 4, 5, 6, 7}};<br>+  // DEBUGGER: break 17<br>+  f(s, 4);<br>+  // DEBUGGER: break 19<br>+  return 0;<br>+}<br>+<br>+int f(struct S s, unsigned i) {<br>+  // DEBUGGER: break 24<br>+  return s.a[i];<br>+}<br>+<br>+// DEBUGGER: r<br>+// DEBUGGER: p s<br>+// CHECK: a =<br>+// DEBUGGER: p s.a[0]<br>+// CHECK: = 0<br>+// DEBUGGER: p s.a[1]<br>+// CHECK: = 1<br>+// DEBUGGER: p s.a[7]<br>+// CHECK: = 7<br>+// DEBUGGER: c<br>+// DEBUGGER: p s<br>+// CHECK: a =<br>+// DEBUGGER: p s.a[0]<br>+// CHECK: = 0<br>+// DEBUGGER: p s.a[1]<br>+// CHECK: = 1<br>+// DEBUGGER: p s.a[7]<br>+// DEBUGGER: c<br>+// DEBUGGER: p s<br>+// CHECK: a =<br>+// DEBUGGER: p s.a[0]<br>+// CHECK: = 0<br>+// DEBUGGER: p s.a[1]<br>+// CHECK: = 1<br>+// DEBUGGER: p s.a[7]<br><br>Added: debuginfo-tests/trunk/tests/sret.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/sret.cpp?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/sret.cpp?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/sret.cpp (added)<br>+++ debuginfo-tests/trunk/tests/sret.cpp Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,71 @@<br>+// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o<br>+// RUN: %clangxx %target_itanium_abi_host_triple %t.o -o %t.out<br>+// RUN: %test_debuginfo %s %t.out<br>+// Radar 8775834<br>+// DEBUGGER: break 62<br>+// DEBUGGER: r<br>+// DEBUGGER: p a<br>+// CHECK: ${{[0-9]+}} =<br>+// LLDB does not print artificial members.<br>+// CHECK:  {{(_vptr\$A =)?.*}}m_int = 12<br>+<br>+class A<br>+{<br>+public:<br>+    A (int i=0);<br>+    A (const A& rhs);<br>+    const A&<br>+    operator= (const A& rhs);<br>+    virtual ~A() {}<br>+<br>+    int get_int();<br>+<br>+protected:<br>+    int m_int;<br>+};<br>+<br>+A::A (int i) :<br>+    m_int(i)<br>+{<br>+}<br>+<br>+A::A (const A& rhs) :<br>+    m_int (rhs.m_int)<br>+{<br>+}<br>+<br>+const A &<br>+A::operator =(const A& rhs)<br>+{<br>+    m_int = rhs.m_int;<br>+    return *this;<br>+}<br>+<br>+int A::get_int()<br>+{<br>+    return m_int;<br>+}<br>+<br>+class B<br>+{<br>+public:<br>+    B () {}<br>+<br>+    A AInstance();<br>+};<br>+<br>+A<br>+B::AInstance()<br>+{<br>+    A a(12);<br>+    return a;<br>+}<br>+<br>+int main (int argc, char const *argv[])<br>+{<br>+    B b;<br>+    int return_val = b.AInstance().get_int();<br>+<br>+    A a(b.AInstance());<br>+    return return_val;<br>+}<br><br>Added: debuginfo-tests/trunk/tests/stack-var.c<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/stack-var.c?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/stack-var.c?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/stack-var.c (added)<br>+++ debuginfo-tests/trunk/tests/stack-var.c Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,18 @@<br>+// RUN: %clang %target_itanium_abi_host_triple %s -O -o %t.out -g<br>+// RUN: %test_debuginfo %s %t.out<br>+<br>+void __attribute__((noinline, optnone)) bar(int *test) {}<br>+int main() {<br>+  int test;<br>+  test = 23;<br>+  // DEBUGGER: break 12<br>+  // DEBUGGER: r<br>+  // DEBUGGER: p test<br>+  // CHECK: = 23<br>+  bar(&test);<br>+  // DEBUGGER: break 17<br>+  // DEBUGGER: c<br>+  // DEBUGGER: p test<br>+  // CHECK: = 23<br>+  return test;<br>+}<br><br>Added: debuginfo-tests/trunk/tests/static-member-2.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/static-member-2.cpp?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/static-member-2.cpp?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/static-member-2.cpp (added)<br>+++ debuginfo-tests/trunk/tests/static-member-2.cpp Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,39 @@<br>+// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -o %t -c<br>+// RUN: %clangxx %target_itanium_abi_host_triple %t -o %t.out<br>+// RUN: %test_debuginfo %s %t.out<br>+<br>+// FIXME: LLDB finds the wrong symbol for "C". <a>rdar://problem/14933867</a><br>+// XFAIL: darwin<br>+<br>+// DEBUGGER: delete breakpoints<br>+// DEBUGGER: break static-member.cpp:33<br>+// DEBUGGER: r<br>+// DEBUGGER: ptype C<br>+// CHECK:      {{struct|class}} C {<br>+// CHECK:      static const int a;<br>+// CHECK-NEXT: static int b;<br>+// CHECK-NEXT: static int c;<br>+// CHECK-NEXT: int d;<br>+// CHECK-NEXT: }<br>+// DEBUGGER: p C::a<br>+// CHECK: ${{[0-9]}} = 4<br>+// DEBUGGER: p C::c<br>+// CHECK: ${{[0-9]}} = 15<br>+<br>+// PR14471, PR14734<br>+<br>+class C {<br>+public:<br>+  const static int a = 4;<br>+  static int b;<br>+  static int c;<br>+  int d;<br>+};<br>+<br>+int C::c = 15;<br>+const int C::a;<br>+<br>+int main() {<br>+    C instance_C;<br>+    return C::a;<br>+}<br><br>Added: debuginfo-tests/trunk/tests/static-member.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/static-member.cpp?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/static-member.cpp?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/static-member.cpp (added)<br>+++ debuginfo-tests/trunk/tests/static-member.cpp Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,36 @@<br>+// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -o %t -c<br>+// RUN: %clangxx %target_itanium_abi_host_triple %t -o %t.out<br>+// RUN: %test_debuginfo %s %t.out<br>+<br>+// DEBUGGER: delete breakpoints<br>+// DEBUGGER: break static-member.cpp:33<br>+// DEBUGGER: r<br>+// DEBUGGER: ptype MyClass<br>+// CHECK:      {{struct|class}} MyClass {<br>+// CHECK:      static const int a;<br>+// CHECK-NEXT: static int b;<br>+// CHECK-NEXT: static int c;<br>+// CHECK-NEXT: int d;<br>+// CHECK-NEXT: }<br>+// DEBUGGER: p MyClass::a<br>+// CHECK: ${{[0-9]}} = 4<br>+// DEBUGGER: p MyClass::c<br>+// CHECK: ${{[0-9]}} = 15<br>+<br>+// PR14471, PR14734<br>+<br>+class MyClass {<br>+public:<br>+  const static int a = 4;<br>+  static int b;<br>+  static int c;<br>+  int d;<br>+};<br>+<br>+int MyClass::c = 15;<br>+const int MyClass::a;<br>+<br>+int main() {<br>+    MyClass instance_MyClass;<br>+    return MyClass::a;<br>+}<br><br>Added: debuginfo-tests/trunk/tests/vla.c<br>URL: <a href="http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/vla.c?rev=318435&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/tests/vla.c?rev=318435&view=auto</a><br>==============================================================================<br>--- debuginfo-tests/trunk/tests/vla.c (added)<br>+++ debuginfo-tests/trunk/tests/vla.c Thu Nov 16 10:26:20 2017<br>@@ -0,0 +1,24 @@<br>+// This test case verifies the debug location for variable-length arrays.<br></div></div></blockquote></div></div></div></blockquote></div>