Index: compiler-rt/lib/asan/asan_errors.cc =================================================================== --- compiler-rt/lib/asan/asan_errors.cc +++ compiler-rt/lib/asan/asan_errors.cc @@ -39,7 +39,8 @@ } static void MaybeDumpInstructionBytes(uptr pc) { - if (!flags()->dump_instruction_bytes || (pc < GetPageSizeCached())) return; + if (!common_flags()->dump_instruction_bytes || (pc < GetPageSizeCached())) + return; InternalScopedString str(1024); str.append("First 16 instruction bytes at pc: "); if (IsAccessibleMemoryRange(pc, 16)) { @@ -54,7 +55,7 @@ } static void MaybeDumpRegisters(void *context) { - if (!flags()->dump_registers) return; + if (!common_flags()->dump_registers) return; SignalContext::DumpAllRegisters(context); } Index: compiler-rt/lib/asan/asan_flags.inc =================================================================== --- compiler-rt/lib/asan/asan_flags.inc +++ compiler-rt/lib/asan/asan_flags.inc @@ -147,11 +147,6 @@ "If >=2, detect violation of One-Definition-Rule (ODR); " "If ==1, detect ODR-violation only if the two variables " "have different sizes") -ASAN_FLAG(bool, dump_instruction_bytes, false, - "If true, dump 16 bytes starting at the instruction that caused SEGV") -ASAN_FLAG(bool, dump_registers, true, - "If true, dump values of CPU registers when SEGV happens. Only " - "available on OS X for now.") ASAN_FLAG(const char *, suppressions, "", "Suppressions file name.") ASAN_FLAG(bool, halt_on_error, true, "Crash the program after printing the first error report " Index: compiler-rt/lib/sanitizer_common/sanitizer_flags.inc =================================================================== --- compiler-rt/lib/sanitizer_common/sanitizer_flags.inc +++ compiler-rt/lib/sanitizer_common/sanitizer_flags.inc @@ -229,3 +229,8 @@ "(asan only).") COMMON_FLAG(bool, html_cov_report, false, "Generate html coverage report.") COMMON_FLAG(const char *, sancov_path, "sancov", "Sancov tool location.") +COMMON_FLAG(bool, dump_instruction_bytes, false, + "If true, dump 16 bytes starting at the instruction that caused SEGV") +COMMON_FLAG(bool, dump_registers, true, + "If true, dump values of CPU registers when SEGV happens. Only " + "available on OS X for now.") Index: compiler-rt/test/sanitizer_common/TestCases/Posix/dump_instruction_bytes.cc =================================================================== --- compiler-rt/test/sanitizer_common/TestCases/Posix/dump_instruction_bytes.cc +++ compiler-rt/test/sanitizer_common/TestCases/Posix/dump_instruction_bytes.cc @@ -1,10 +1,11 @@ -// Check that ASan prints the faulting instruction bytes on +// Check that sanitizer prints the faulting instruction bytes on // dump_instruction_bytes=1 -// RUN: %clangxx_asan %s -o %t -// RUN: %env_asan_opts=dump_instruction_bytes=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-DUMP +// RUN: %clangxx %s -o %t +// RUN: %env_tool_opts=dump_instruction_bytes=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-DUMP // RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NODUMP // // REQUIRES: x86-target-arch +// XFAIL: lsan, msan, tsan, ubsan int main() { #if defined(__x86_64__)