-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm-symbolizer][test] Extract tests from llvm-symbolizer.test and s…
…implify (#2) This is the third of a series of patches simplifying llvm-symbolizer tests. See r352752 and r352753 for the previous two. This patch splits out a number of distinct test cases from llvm-symbolizer.test into separate tests, and simplifies them in various ways including: 1) using --obj/positional arguments for the input file and addresses instead of stdin, 2) using runtime-generated inputs rather than a pre-canned binary, and 3) testing more specifically (i.e. checking only what is interesting to the behaviour changed in the original commit for that test case). This patch also removes the test case for using --obj. The tools/llvm-symbolizer/basic.s test already tests this case. Finally, this patch adds a simple test case to the demangle switch test case to show that demangling happens by default. See https://bugs.llvm.org/show_bug.cgi?id=40070#c1 for the motivation. Reviewed by: dblaikie Differential Revision: https://reviews.llvm.org/D57446 llvm-svn: 352754
- Loading branch information
Showing
6 changed files
with
66 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +0,0 @@ | ||
int f(int a, int b) { | ||
return a + b; | ||
} | ||
|
||
int g(int a) { | ||
return a + 1; | ||
} | ||
|
||
|
||
int main() { | ||
return f(2, g(2)); | ||
} | ||
|
||
// Built with Clang 3.3: | ||
// $ mkdir -p /tmp/dbginfo | ||
// $ cp llvm-symbolizer-test.c /tmp/dbginfo | ||
// $ cd /tmp/dbginfo | ||
// $ clang -g llvm-symbolizer-test.c -o <output> | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# REQUIRES: x86-registered-target | ||
|
||
# RUN: llvm-mc --filetype=obj --triple=x86_64-pc-linux %s -o %t.o -g | ||
|
||
# RUN: llvm-symbolizer --obj=%t.o 0 1 2 | FileCheck %s | ||
|
||
# CHECK: f() | ||
# CHECK-NEXT: symbolize-demangling.s:20 | ||
# CHECK-EMPTY: | ||
# CHECK-NEXT: {{^g$}} | ||
# CHECK-NEXT: symbolize-demangling.s:22 | ||
# CHECK-EMPTY: | ||
# CHECK-NEXT: {{^baz$}} | ||
# CHECK-NEXT: symbolize-demangling.s:24 | ||
|
||
.type _Z1fv,@function | ||
.type g,@function | ||
.type baz,@function | ||
_Z1fv: | ||
nop | ||
g: | ||
nop | ||
baz: | ||
nop |
5 changes: 5 additions & 0 deletions
5
llvm/test/DebugInfo/symbolize-macho-universal-unknown-arch.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
RUN: llvm-symbolizer --obj=%p/Inputs/macho-universal 0x1f84 | FileCheck %s | ||
|
||
CHECK-NOT: main | ||
CHECK: ?? | ||
CHECK-NOT: main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
RUN: llvm-symbolizer --no-demangle --default-arch=i386 --obj=%p/Inputs/macho-universal 0x1f84 | FileCheck %s --check-prefix=DEFAULT | ||
RUN: llvm-symbolizer --no-demangle --obj=%p/Inputs/macho-universal:i386 0x1f67 | FileCheck %s --check-prefix=I386 | ||
RUN: llvm-symbolizer --no-demangle --obj=%p/Inputs/macho-universal:x86_64 0x100000f05 | FileCheck %s --check-prefix=X86-64 | ||
|
||
DEFAULT: main | ||
I386: _Z3inci | ||
X86-64: _Z3inci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# REQUIRES: x86-registered-target | ||
|
||
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o -g | ||
|
||
.type _Z1cv,@function | ||
_Z1cv: | ||
nop | ||
|
||
# Check the default is to demangle and that the last of --demangle and | ||
# --no-demangle wins. | ||
# RUN: llvm-symbolizer --obj %t.o 0 \ | ||
# RUN: | FileCheck %s --check-prefix=DEMANGLED_FUNCTION_NAME | ||
# RUN: llvm-symbolizer --demangle --obj %t.o 0 \ | ||
# RUN: | FileCheck %s --check-prefix=DEMANGLED_FUNCTION_NAME | ||
# RUN: llvm-symbolizer -C --obj %t.o 0 \ | ||
# RUN: | FileCheck %s --check-prefix=DEMANGLED_FUNCTION_NAME | ||
# RUN: llvm-symbolizer --no-demangle --obj %t.o 0 \ | ||
# RUN: | FileCheck %s --check-prefix=MANGLED_FUNCTION_NAME | ||
# RUN: llvm-symbolizer --demangle --no-demangle --obj %t.o 0 \ | ||
# RUN: | FileCheck %s --check-prefix=MANGLED_FUNCTION_NAME | ||
# RUN: llvm-symbolizer -C --no-demangle --obj %t.o 0 \ | ||
# RUN: | FileCheck %s --check-prefix=MANGLED_FUNCTION_NAME | ||
# RUN: llvm-symbolizer --no-demangle --demangle --obj %t.o 0 \ | ||
# RUN: | FileCheck %s --check-prefix=DEMANGLED_FUNCTION_NAME | ||
# RUN: llvm-symbolizer --no-demangle -C --obj %t.o 0 \ | ||
# RUN: | FileCheck %s --check-prefix=DEMANGLED_FUNCTION_NAME | ||
|
||
# MANGLED_FUNCTION_NAME: _Z1cv | ||
# DEMANGLED_FUNCTION_NAME: c() |