[llvm] c96fee9 - [llvm-symbolizer][test] Add explicit tests for CODE and DATA
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 16 03:02:42 PST 2021
Author: James Henderson
Date: 2021-02-16T10:59:25Z
New Revision: c96fee98dbff50356f5cc92724e1fcfec2865c42
URL: https://github.com/llvm/llvm-project/commit/c96fee98dbff50356f5cc92724e1fcfec2865c42
DIFF: https://github.com/llvm/llvm-project/commit/c96fee98dbff50356f5cc92724e1fcfec2865c42.diff
LOG: [llvm-symbolizer][test] Add explicit tests for CODE and DATA
These directives force the associated address to be interpreted as a
function or data respectively. CODE is the default when not specified.
Differential Revision: https://reviews.llvm.org/D96712
Reviewed by: MaskRay
Added:
llvm/test/tools/llvm-symbolizer/code.s
llvm/test/tools/llvm-symbolizer/data.s
Modified:
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-symbolizer/code.s b/llvm/test/tools/llvm-symbolizer/code.s
new file mode 100644
index 000000000000..a6b7b88a0e6d
--- /dev/null
+++ b/llvm/test/tools/llvm-symbolizer/code.s
@@ -0,0 +1,19 @@
+## Show that when "CODE" is used with an address, it forces the found location
+## to be symbolized as a function (this is the default).
+# REQUIRES: x86-registered-target
+# RUN: llvm-mc -g -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: llvm-symbolizer "CODE 0x1" "CODE 0x2" --obj=%t.o > %t.code
+# RUN: llvm-symbolizer 0x1 0x2 --obj=%t.o > %t.default
+# RUN: cmp %t.code %t.default
+# RUN: FileCheck %s --input-file=%t.code -DFILE=%s --implicit-check-not={{.}}
+
+# CHECK: f1
+f1:
+ nop
+# CHECK-NEXT: [[FILE]]:[[@LINE+1]]:0
+ ret
+# CHECK-EMPTY:
+# CHECK-NEXT: f2
+f2:
+# CHECK-NEXT: [[FILE]]:[[@LINE+1]]:0
+ ret
diff --git a/llvm/test/tools/llvm-symbolizer/data.s b/llvm/test/tools/llvm-symbolizer/data.s
new file mode 100644
index 000000000000..e8039f146dbd
--- /dev/null
+++ b/llvm/test/tools/llvm-symbolizer/data.s
@@ -0,0 +1,20 @@
+## Show that when "DATA" is used with an address, it forces the found location
+## to be symbolized as data.
+# REQUIRES: x86-registered-target
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: llvm-symbolizer "DATA 0x2" "DATA 0x8" --obj=%t.o | \
+# RUN: FileCheck %s -DFILE=%s --implicit-check-not={{.}}
+
+# CHECK: d1
+# CHECK-NEXT: 0 8
+# CHECK-EMPTY:
+# CHECK-NEXT: d2
+# CHECK-NEXT: 8 4
+
+d1:
+ .quad 0x1122334455667788
+ .size d1, 8
+
+d2:
+ .long 0x99aabbcc
+ .size d2, 4
More information about the llvm-commits
mailing list