[PATCH] [compiler-rt] bug 23600 - sanitizer stack trace pc off by 1

Kostya Serebryany kcc at google.com
Wed May 27 10:41:07 PDT 2015


================
Comment at: test/sanitizer_common/TestCases/print-stack-trace-pc.cc:7
@@ +6,3 @@
+// RUN: %clangxx -O0 %s -o %t && %tool_symbolizer_path=%llvm_obj_root/bin/llvm-symbolizer %tool_options='stack_trace_format="#%%n %%p %%f:%%l"' %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx -O3 %s -o %t && %tool_symbolizer_path=%llvm_obj_root/bin/llvm-symbolizer %tool_options='stack_trace_format="#%%n %%p %%f:%%l"' %run %t 2>&1 | FileCheck %s
+
----------------
This is strange. The test should know where the symbolizer is, 
other tests don't require this. 

================
Comment at: test/sanitizer_common/TestCases/print-stack-trace-pc.cc:22
@@ +21,3 @@
+#define FOO_LINE  101
+#define BAR_LINE  201
+#define MAIN_LINE 301
----------------
I think you can make this test simpler by using e.g. [[@LINE-1]] in the CHECK: line, see e.g. 
test/asan/TestCases/unaligned_loads_and_stores.cc

Just add the CHECK lines closer to the code, then use a small constant offset, e.g. [[@LINE-4]]

================
Comment at: test/sanitizer_common/TestCases/print-stack-trace-pc.cc:26
@@ +25,3 @@
+void __attribute__((weak)) foo(void) {
+    *pfrm++ = (struct StackFrame) {
+        __builtin_return_address(0), __func__, FOO_LINE
----------------
This code repeats 3 times, right? 
Maybe put it in a macro?

http://reviews.llvm.org/D10065

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list