summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorMike Aizatsky <aizatsky@chromium.org>2016-01-09 00:14:35 +0000
committerMike Aizatsky <aizatsky@chromium.org>2016-01-09 00:14:35 +0000
commit17dbc2831e85c89a9167f986332edb8b1359a46e (patch)
tree688a0e076743c273c4740b2d3b540ef1f8a6196c /llvm/test
parent58a305bf155c885199a6e1edfe6481494fe8cd5d (diff)
downloadbcm5719-llvm-17dbc2831e85c89a9167f986332edb8b1359a46e.tar.gz
bcm5719-llvm-17dbc2831e85c89a9167f986332edb8b1359a46e.zip
[llvm-symbolizer] -print-source-context-lines option to print source code around the line.
Differential Revision: http://reviews.llvm.org/D15909 llvm-svn: 257236
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/lit.cfg2
-rw-r--r--llvm/test/tools/llvm-symbolizer/print_context.c22
2 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/lit.cfg b/llvm/test/lit.cfg
index 5cc4d6e0456..e06c10f6421 100644
--- a/llvm/test/lit.cfg
+++ b/llvm/test/lit.cfg
@@ -194,6 +194,7 @@ config.substitutions.append( ('%llvmshlibdir', config.llvm_shlib_dir) )
config.substitutions.append( ('%shlibext', config.llvm_shlib_ext) )
config.substitutions.append( ('%exeext', config.llvm_exe_ext) )
config.substitutions.append( ('%python', config.python_executable) )
+config.substitutions.append( ('%host_cc', config.host_cc) )
# OCaml substitutions.
# Support tests for both native and bytecode builds.
@@ -276,6 +277,7 @@ for pattern in [r"\bbugpoint\b(?!-)",
r"\bllvm-split\b",
r"\bllvm-tblgen\b",
r"\bllvm-c-test\b",
+ NOJUNK + r"\bllvm-symbolizer\b",
NOJUNK + r"\bopt\b",
r"\bFileCheck\b",
r"\bobj2yaml\b",
diff --git a/llvm/test/tools/llvm-symbolizer/print_context.c b/llvm/test/tools/llvm-symbolizer/print_context.c
new file mode 100644
index 00000000000..f1860e91988
--- /dev/null
+++ b/llvm/test/tools/llvm-symbolizer/print_context.c
@@ -0,0 +1,22 @@
+// REQUIRES: x86_64-linux
+// RUN: %host_cc -O0 -g %s -o %t 2>&1
+// RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s --check-prefix=CHECK
+
+#include <stdio.h>
+
+int inc(int a) {
+ return a + 1;
+}
+
+int main() {
+ printf("%p\n", inc);
+ return 0;
+}
+
+// CHECK: inc
+// CHECK: print_context.c:7
+// CHECK: 5 : #include
+// CHECK: 6 :
+// CHECK: 7 >: int inc
+// CHECK: 8 : return
+// CHECK: 9 : }
OpenPOWER on IntegriCloud