[debuginfo-tests] r312265 - Fix debuginfo-tests with GDB on Linux

Robinson, Paul via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 10:54:59 PDT 2017


Thanks, I've been wondering if anybody still used this project.
--paulr

> -----Original Message-----
> From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On Behalf
> Of Reid Kleckner via llvm-commits
> Sent: Thursday, August 31, 2017 11:17 AM
> To: llvm-commits at lists.llvm.org
> Subject: [debuginfo-tests] r312265 - Fix debuginfo-tests with GDB on Linux
> 
> Author: rnk
> Date: Thu Aug 31 11:16:55 2017
> New Revision: 312265
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=312265&view=rev
> Log:
> Fix debuginfo-tests with GDB on Linux
> 
> Summary:
> Split asan.c into asan.c and asan-blocks.c, which will be
> darwin-specific. I suspect we could make it pass on Linux by adding
> cmake to build BlocksRuntime from compiler-rt, but I'm not shaving that
> yak yet.
> 
> asan.c and safestack.c: GDB and LLDB appear to print aggregates
> differently today. Print individual elements instead of the entire
> aggregate.
> 
> dbg-arg.c: GDB doesn't appear to print leading zeros when printing
> pointers.
> 
> stack-var.c: Add the optnone attribute so that LLVM won't optimize away
> this no-op function call. This should be a cross-platform failure
> observable on Mac, so this is surprising.
> 
> Reviewers: aprantl, dblaikie
> 
> Subscribers: llvm-commits
> 
> Differential Revision: https://reviews.llvm.org/D37344
> 
> Added:
>     debuginfo-tests/trunk/asan-blocks.c
> Modified:
>     debuginfo-tests/trunk/asan.c
>     debuginfo-tests/trunk/dbg-arg.c
>     debuginfo-tests/trunk/safestack.c
>     debuginfo-tests/trunk/stack-var.c
> 
> Added: debuginfo-tests/trunk/asan-blocks.c
> URL: http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/asan-
> blocks.c?rev=312265&view=auto
> ==========================================================================
> ====
> --- debuginfo-tests/trunk/asan-blocks.c (added)
> +++ debuginfo-tests/trunk/asan-blocks.c Thu Aug 31 11:16:55 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();
> +}
> 
> Modified: debuginfo-tests/trunk/asan.c
> URL: http://llvm.org/viewvc/llvm-project/debuginfo-
> tests/trunk/asan.c?rev=312265&r1=312264&r2=312265&view=diff
> ==========================================================================
> ====
> --- debuginfo-tests/trunk/asan.c (original)
> +++ debuginfo-tests/trunk/asan.c Thu Aug 31 11:16:55 2017
> @@ -1,40 +1,31 @@
> -// RUN: %clang %target_itanium_abi_host_triple -arch x86_64 %s -o %t.out
> -g -fsanitize=address
> +// 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.
> -void b();
> +//
> +
>  struct S {
>    int a[8];
>  };
> 
>  int f(struct S s, unsigned i) {
> -  // DEBUGGER: break 16
> -  // DEBUGGER: r
> -  // DEBUGGER: p s
> -  // CHECK: a = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5,
> [6] = 6, [7] = 7)
> +  // 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) {
> -    // DEBUGGER: break 26
> -    // DEBUGGER: c
> -    // DEBUGGER: p s
> -    // CHECK: a = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5,
> [6] = 6, [7] = 7)
> -    b();
> -  }
> +  if (f(s, 4) == 4)
> +    return f(s, 0);
>    return 0;
>  }
> 
> -void c() {}
> -
> -void b() {
> -  // DEBUGGER: break 39
> -  // DEBUGGER: c
> -  // DEBUGGER: p x
> -  // CHECK: 42
> -  __block int x = 42;
> -  c();
> -}
> +// 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]
> 
> Modified: debuginfo-tests/trunk/dbg-arg.c
> URL: http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/dbg-
> arg.c?rev=312265&r1=312264&r2=312265&view=diff
> ==========================================================================
> ====
> --- debuginfo-tests/trunk/dbg-arg.c (original)
> +++ debuginfo-tests/trunk/dbg-arg.c Thu Aug 31 11:16:55 2017
> @@ -1,12 +1,12 @@
>  // This test case checks debug info during register moves for an
> argument.
> -// RUN: %clang %target_itanium_abi_host_triple -arch x86_64 -mllvm -fast-
> isel=false  %s -c -o %t.o -g
> -// RUN: %clang %target_itanium_abi_host_triple -arch x86_64 %t.o -o
> %t.out
> +// 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:  ={{.*}} 0x0
> +// CHECK:  ={{.* 0x[0-9A-Fa-f]+}}
>  //
>  // Radar 8412415
> 
> 
> Modified: debuginfo-tests/trunk/safestack.c
> URL: http://llvm.org/viewvc/llvm-project/debuginfo-
> tests/trunk/safestack.c?rev=312265&r1=312264&r2=312265&view=diff
> ==========================================================================
> ====
> --- debuginfo-tests/trunk/safestack.c (original)
> +++ debuginfo-tests/trunk/safestack.c Thu Aug 31 11:16:55 2017
> @@ -26,10 +26,26 @@ int f(struct S s, unsigned i) {
> 
>  // DEBUGGER: r
>  // DEBUGGER: p s
> -// CHECK: a = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6]
> = 6, [7] = 7)
> +// 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 = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6]
> = 6, [7] = 7)
> +// 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 = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6]
> = 6, [7] = 7)
> +// CHECK: a =
> +// DEBUGGER: p s.a[0]
> +// CHECK: = 0
> +// DEBUGGER: p s.a[1]
> +// CHECK: = 1
> +// DEBUGGER: p s.a[7]
> 
> Modified: debuginfo-tests/trunk/stack-var.c
> URL: http://llvm.org/viewvc/llvm-project/debuginfo-tests/trunk/stack-
> var.c?rev=312265&r1=312264&r2=312265&view=diff
> ==========================================================================
> ====
> --- debuginfo-tests/trunk/stack-var.c (original)
> +++ debuginfo-tests/trunk/stack-var.c Thu Aug 31 11:16:55 2017
> @@ -1,18 +1,18 @@
>  // RUN: %clang %target_itanium_abi_host_triple %s -O -o %t.out -g
>  // RUN: %test_debuginfo %s %t.out
> 
> -void __attribute__((noinline)) bar(int *test) {}
> +void __attribute__((noinline, optnone)) bar(int *test) {}
>  int main() {
>    int test;
>    test = 23;
>    // DEBUGGER: break 12
>    // DEBUGGER: r
>    // DEBUGGER: p test
> -  // CHECK: 23
> +  // CHECK: = 23
>    bar(&test);
>    // DEBUGGER: break 17
>    // DEBUGGER: c
>    // DEBUGGER: p test
> -  // CHECK: 23
> +  // CHECK: = 23
>    return test;
>  }
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list