From: Alexey Samsonov Date: Fri, 8 Feb 2013 14:34:33 +0000 (+0000) Subject: Update tests for DWARF parser: store sources next to pre-built object files and provi... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f64edf8d802824202b50046638696a6b7897d4d6;p=oota-llvm.git Update tests for DWARF parser: store sources next to pre-built object files and provide build instructions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174711 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/DebugInfo/Inputs/dwarfdump-inl-test.cc b/test/DebugInfo/Inputs/dwarfdump-inl-test.cc new file mode 100644 index 00000000000..8ffbb528f2a --- /dev/null +++ b/test/DebugInfo/Inputs/dwarfdump-inl-test.cc @@ -0,0 +1,15 @@ +#include "dwarfdump-inl-test.h" +static inline int inlined_f() { + volatile int x = inlined_g(); + return x; +} + +int main() { + return inlined_f(); +} + +// Built with Clang 3.2 +// $ mkdir -p /tmp/dbginfo +// $ cp dwarfdump-inl-test.* /tmp/dbginfo +// $ cd /tmp/dbginfo +// $ clang++ -O2 -gline-tables-only -fsanitize=address -fPIC -shared dwarfdump-inl-test.cc -o diff --git a/test/DebugInfo/Inputs/dwarfdump-inl-test.elf-x86-64 b/test/DebugInfo/Inputs/dwarfdump-inl-test.elf-x86-64 index 9a1d5383caa..6df03dad95a 100755 Binary files a/test/DebugInfo/Inputs/dwarfdump-inl-test.elf-x86-64 and b/test/DebugInfo/Inputs/dwarfdump-inl-test.elf-x86-64 differ diff --git a/test/DebugInfo/Inputs/dwarfdump-inl-test.h b/test/DebugInfo/Inputs/dwarfdump-inl-test.h new file mode 100644 index 00000000000..ecc2aaac099 --- /dev/null +++ b/test/DebugInfo/Inputs/dwarfdump-inl-test.h @@ -0,0 +1,9 @@ +inline int inlined_h() { + volatile int z = 0; + return z; +} + +inline int inlined_g() { + volatile int y = inlined_h(); + return y; +} diff --git a/test/DebugInfo/Inputs/dwarfdump-test.cc b/test/DebugInfo/Inputs/dwarfdump-test.cc new file mode 100644 index 00000000000..40899986490 --- /dev/null +++ b/test/DebugInfo/Inputs/dwarfdump-test.cc @@ -0,0 +1,23 @@ +class DummyClass { + int a_; + public: + DummyClass(int a) : a_(a) {} + int add(int b) { + return a_ + b; + } +}; + +int f(int a, int b) { + DummyClass c(a); + return c.add(b); +} + +int main() { + return f(2, 3); +} + +// Built with Clang 3.2: +// $ mkdir -p /tmp/dbginfo +// $ cp dwarfdump-test.cc /tmp/dbginfo +// $ cd /tmp/dbginfo +// $ clang++ -g dwarfdump-test.cc -o diff --git a/test/DebugInfo/Inputs/dwarfdump-test.elf-x86-64 b/test/DebugInfo/Inputs/dwarfdump-test.elf-x86-64 index fe20c8e5966..455dd1ce4fc 100755 Binary files a/test/DebugInfo/Inputs/dwarfdump-test.elf-x86-64 and b/test/DebugInfo/Inputs/dwarfdump-test.elf-x86-64 differ diff --git a/test/DebugInfo/Inputs/dwarfdump-test2-helper.cc b/test/DebugInfo/Inputs/dwarfdump-test2-helper.cc new file mode 100644 index 00000000000..7d9264050bd --- /dev/null +++ b/test/DebugInfo/Inputs/dwarfdump-test2-helper.cc @@ -0,0 +1,3 @@ +extern "C" int a() { + return 0; +} diff --git a/test/DebugInfo/Inputs/dwarfdump-test2-main.cc b/test/DebugInfo/Inputs/dwarfdump-test2-main.cc new file mode 100644 index 00000000000..b327674ab79 --- /dev/null +++ b/test/DebugInfo/Inputs/dwarfdump-test2-main.cc @@ -0,0 +1,11 @@ +extern "C" int a(); + +int main() { + return a(); +} + +// Built with gcc 4.6.3 +// $ mkdir -p /tmp/dbginfo +// $ cp dwarfdump-test2-helper.cc dwarfdump-test2-main.cc /tmp/dbginfo/ +// $ cd /tmp/dbginfo +// $ g++ -g dwarfdump-test2-helper.cc dwarfdump-test2-main.cc -o diff --git a/test/DebugInfo/Inputs/dwarfdump-test2.elf-x86-64 b/test/DebugInfo/Inputs/dwarfdump-test2.elf-x86-64 index ce4af7fd06b..6f362ad62cf 100755 Binary files a/test/DebugInfo/Inputs/dwarfdump-test2.elf-x86-64 and b/test/DebugInfo/Inputs/dwarfdump-test2.elf-x86-64 differ diff --git a/test/DebugInfo/Inputs/dwarfdump-test3-decl.h b/test/DebugInfo/Inputs/dwarfdump-test3-decl.h new file mode 100644 index 00000000000..4a79e959b0c --- /dev/null +++ b/test/DebugInfo/Inputs/dwarfdump-test3-decl.h @@ -0,0 +1,7 @@ +#include "dwarfdump-test3-decl2.h" + +class C { + explicit C(bool a = false, bool b = false); +}; + +void do1() {} diff --git a/test/DebugInfo/Inputs/dwarfdump-test3-decl2.h b/test/DebugInfo/Inputs/dwarfdump-test3-decl2.h new file mode 100644 index 00000000000..9c92d56fcf4 --- /dev/null +++ b/test/DebugInfo/Inputs/dwarfdump-test3-decl2.h @@ -0,0 +1 @@ +void do2() { } diff --git a/test/DebugInfo/Inputs/dwarfdump-test3.cc b/test/DebugInfo/Inputs/dwarfdump-test3.cc new file mode 100644 index 00000000000..7b4d7ea7118 --- /dev/null +++ b/test/DebugInfo/Inputs/dwarfdump-test3.cc @@ -0,0 +1,12 @@ +#include "dwarfdump-test3-decl.h" + +C::C(bool a, bool b) {} + +// Built with gcc 4.6.3 +// $ mkdir -p /tmp/dbginfo/include +// $ mkdir -p /tmp/include +// $ cp dwarfdump-test3.cc /tmp/dbginfo +// $ cp dwarfdump-test3-decl.h /tmp/include +// $ cp dwarfdump-test3-decl2.h /tmp/dbginfo/include +// $ cd /tmp/dbginfo +// $ gcc dwarfdump-test3.cc -g -I/tmp/include -Iinclude -fPIC -shared -o diff --git a/test/DebugInfo/Inputs/dwarfdump-test3.elf-x86-64 b/test/DebugInfo/Inputs/dwarfdump-test3.elf-x86-64 index 7c173046205..7330cd8baa1 100755 Binary files a/test/DebugInfo/Inputs/dwarfdump-test3.elf-x86-64 and b/test/DebugInfo/Inputs/dwarfdump-test3.elf-x86-64 differ diff --git a/test/DebugInfo/Inputs/dwarfdump-test4-decl.h b/test/DebugInfo/Inputs/dwarfdump-test4-decl.h new file mode 100644 index 00000000000..9abd875415d --- /dev/null +++ b/test/DebugInfo/Inputs/dwarfdump-test4-decl.h @@ -0,0 +1 @@ +inline void a(){} diff --git a/test/DebugInfo/Inputs/dwarfdump-test4-part1.cc b/test/DebugInfo/Inputs/dwarfdump-test4-part1.cc new file mode 100644 index 00000000000..94a818cddd5 --- /dev/null +++ b/test/DebugInfo/Inputs/dwarfdump-test4-part1.cc @@ -0,0 +1,8 @@ +#include "dwarfdump-test4-decl.h" +int c(){a();} + +// Built with gcc 4.6.3 +// $ mkdir -p /tmp/dbginfo +// $ cp dwarfdump-test4-*.* /tmp/dbginfo +// $ cd /tmp/dbginfo +// $ gcc -fPIC -shared -g dwarfdump-test4-part*.cc -o diff --git a/test/DebugInfo/Inputs/dwarfdump-test4-part2.cc b/test/DebugInfo/Inputs/dwarfdump-test4-part2.cc new file mode 100644 index 00000000000..2a1936f0b3d --- /dev/null +++ b/test/DebugInfo/Inputs/dwarfdump-test4-part2.cc @@ -0,0 +1,2 @@ +#include "dwarfdump-test4-decl.h" +int d(){a();} diff --git a/test/DebugInfo/Inputs/dwarfdump-test4.elf-x86-64 b/test/DebugInfo/Inputs/dwarfdump-test4.elf-x86-64 index 884870859d9..a1dd8b91baa 100755 Binary files a/test/DebugInfo/Inputs/dwarfdump-test4.elf-x86-64 and b/test/DebugInfo/Inputs/dwarfdump-test4.elf-x86-64 differ diff --git a/test/DebugInfo/Inputs/lit.local.cfg b/test/DebugInfo/Inputs/lit.local.cfg new file mode 100644 index 00000000000..e6f55eef7af --- /dev/null +++ b/test/DebugInfo/Inputs/lit.local.cfg @@ -0,0 +1 @@ +config.suffixes = [] diff --git a/test/DebugInfo/dwarfdump-inlining.test b/test/DebugInfo/dwarfdump-inlining.test index d3a7e12a870..e926634d52f 100644 --- a/test/DebugInfo/dwarfdump-inlining.test +++ b/test/DebugInfo/dwarfdump-inlining.test @@ -1,28 +1,28 @@ -RUN: llvm-dwarfdump %p/Inputs/dwarfdump-inl-test.elf-x86-64 --address=0x613 \ +RUN: llvm-dwarfdump %p/Inputs/dwarfdump-inl-test.elf-x86-64 --address=0x710 \ RUN: --inlining --functions | FileCheck %s -check-prefix DEEP_STACK -RUN: llvm-dwarfdump %p/Inputs/dwarfdump-inl-test.elf-x86-64 --address=0x6de \ +RUN: llvm-dwarfdump %p/Inputs/dwarfdump-inl-test.elf-x86-64 --address=0x7d1 \ RUN: --inlining | FileCheck %s -check-prefix SHORTER_STACK -RUN: llvm-dwarfdump %p/Inputs/dwarfdump-inl-test.elf-x86-64 --address=0x685 \ +RUN: llvm-dwarfdump %p/Inputs/dwarfdump-inl-test.elf-x86-64 --address=0x785 \ RUN: --inlining | FileCheck %s -check-prefix SHORT_STACK -RUN: llvm-dwarfdump %p/Inputs/dwarfdump-inl-test.elf-x86-64 --address=0x640 \ +RUN: llvm-dwarfdump %p/Inputs/dwarfdump-inl-test.elf-x86-64 --address=0x737 \ RUN: --functions | FileCheck %s -check-prefix INL_FUNC_NAME DEEP_STACK: inlined_h -DEEP_STACK-NEXT: header.h:2:21 +DEEP_STACK-NEXT: dwarfdump-inl-test.h:2 DEEP_STACK-NEXT: inlined_g -DEEP_STACK-NEXT: header.h:7 +DEEP_STACK-NEXT: dwarfdump-inl-test.h:7 DEEP_STACK-NEXT: inlined_f -DEEP_STACK-NEXT: main.cc:3 +DEEP_STACK-NEXT: dwarfdump-inl-test.cc:3 DEEP_STACK-NEXT: main -DEEP_STACK-NEXT: main.cc:8 +DEEP_STACK-NEXT: dwarfdump-inl-test.cc:8 -SHORTER_STACK: header.h:7:20 -SHORTER_STACK-NEXT: main.cc:3 -SHORTER_STACK-NEXT: main.cc:8 +SHORTER_STACK: dwarfdump-inl-test.h:7 +SHORTER_STACK-NEXT: dwarfdump-inl-test.cc:3 +SHORTER_STACK-NEXT: dwarfdump-inl-test.cc:8 -SHORT_STACK: main.cc:3:20 -SHORT_STACK-NEXT: main.cc:8 +SHORT_STACK: dwarfdump-inl-test.cc:3 +SHORT_STACK-NEXT: dwarfdump-inl-test.cc:8 INL_FUNC_NAME: inlined_g -INL_FUNC_NAME-NEXT: header.h:7:20 +INL_FUNC_NAME-NEXT: dwarfdump-inl-test.h:7 diff --git a/test/DebugInfo/dwarfdump-test.test b/test/DebugInfo/dwarfdump-test.test index 973c3447e34..355445e6495 100644 --- a/test/DebugInfo/dwarfdump-test.test +++ b/test/DebugInfo/dwarfdump-test.test @@ -1,56 +1,56 @@ RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test.elf-x86-64 \ -RUN: --address=0x400589 --functions | FileCheck %s -check-prefix MAIN +RUN: --address=0x400559 --functions | FileCheck %s -check-prefix MAIN RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test.elf-x86-64 \ -RUN: --address=0x400558 --functions | FileCheck %s -check-prefix FUNCTION +RUN: --address=0x400528 --functions | FileCheck %s -check-prefix FUNCTION RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test.elf-x86-64 \ -RUN: --address=0x4005b6 --functions | FileCheck %s -check-prefix CTOR_WITH_SPEC +RUN: --address=0x400586 --functions | FileCheck %s -check-prefix CTOR_WITH_SPEC RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test2.elf-x86-64 \ -RUN: --address=0x4004b8 --functions | FileCheck %s -check-prefix MANY_CU_1 +RUN: --address=0x4004e8 --functions | FileCheck %s -check-prefix MANY_CU_1 RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test2.elf-x86-64 \ -RUN: --address=0x4004c4 --functions | FileCheck %s -check-prefix MANY_CU_2 +RUN: --address=0x4004f4 --functions | FileCheck %s -check-prefix MANY_CU_2 RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test3.elf-x86-64 \ -RUN: --address=0x580 --functions | FileCheck %s -check-prefix ABS_ORIGIN_1 +RUN: --address=0x640 --functions | FileCheck %s -check-prefix ABS_ORIGIN_1 RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test3.elf-x86-64 \ -RUN: --address=0x573 --functions | FileCheck %s -check-prefix INCLUDE_TEST_1 +RUN: --address=0x633 --functions | FileCheck %s -check-prefix INCLUDE_TEST_1 RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test3.elf-x86-64 \ -RUN: --address=0x56d --functions | FileCheck %s -check-prefix INCLUDE_TEST_2 +RUN: --address=0x62d --functions | FileCheck %s -check-prefix INCLUDE_TEST_2 RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test4.elf-x86-64 \ -RUN: --address=0x55c --functions \ +RUN: --address=0x62c --functions \ RUN: | FileCheck %s -check-prefix MANY_SEQ_IN_LINE_TABLE RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test4.elf-x86-64 \ RUN: | FileCheck %s -check-prefix DEBUG_RANGES MAIN: main -MAIN-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16:10 +MAIN-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16 FUNCTION: _Z1fii -FUNCTION-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:11:18 +FUNCTION-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:11 -CTOR_WITH_SPEC: _ZN10DummyClassC1Ei -CTOR_WITH_SPEC-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:4:30 +CTOR_WITH_SPEC: DummyClass +CTOR_WITH_SPEC-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:4 MANY_CU_1: a -MANY_CU_1-NEXT: /tmp/dbginfo{{[/\\]}}a.cc:2:0 +MANY_CU_1-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test2-helper.cc:2 MANY_CU_2: main -MANY_CU_2-NEXT: /tmp/dbginfo{{[/\\]}}main.cc:4:0 +MANY_CU_2-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test2-main.cc:4 ABS_ORIGIN_1: C -ABS_ORIGIN_1-NEXT: /tmp/dbginfo{{[/\\]}}def2.cc:4:0 +ABS_ORIGIN_1-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test3.cc:3 -INCLUDE_TEST_1: _Z3do2v -INCLUDE_TEST_1-NEXT: /tmp/dbginfo{{[/\\]}}include{{[/\\]}}decl2.h:1:0 +INCLUDE_TEST_1: _Z3do1v +INCLUDE_TEST_1-NEXT: /tmp/include{{[/\\]}}dwarfdump-test3-decl.h:7 -INCLUDE_TEST_2: _Z3do1v -INCLUDE_TEST_2-NEXT: /tmp/include{{[/\\]}}decl.h:5:0 +INCLUDE_TEST_2: _Z3do2v +INCLUDE_TEST_2-NEXT: /tmp/dbginfo{{[/\\]}}include{{[/\\]}}dwarfdump-test3-decl2.h:1 MANY_SEQ_IN_LINE_TABLE: _Z1cv -MANY_SEQ_IN_LINE_TABLE-NEXT: /tmp/dbginfo/sequences{{[/\\]}}c.cc:2:0 +MANY_SEQ_IN_LINE_TABLE-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test4-part1.cc:2 DEBUG_RANGES: .debug_ranges contents: -DEBUG_RANGES-NEXT: 00000000 000000000000055c 0000000000000567 -DEBUG_RANGES-NEXT: 00000000 0000000000000567 000000000000056d +DEBUG_RANGES-NEXT: 00000000 000000000000062c 0000000000000637 +DEBUG_RANGES-NEXT: 00000000 0000000000000637 000000000000063d DEBUG_RANGES-NEXT: 00000000 -DEBUG_RANGES-NEXT: 00000030 0000000000000570 000000000000057b -DEBUG_RANGES-NEXT: 00000030 0000000000000567 000000000000056d +DEBUG_RANGES-NEXT: 00000030 0000000000000640 000000000000064b +DEBUG_RANGES-NEXT: 00000030 0000000000000637 000000000000063d DEBUG_RANGES-NEXT: 00000030