[compiler-rt] r291141 - Revert "[sancov] introducing SANCOV_OPTIONS"
Mike Aizatsky via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 5 08:55:56 PST 2017
Author: aizatsky
Date: Thu Jan 5 10:55:56 2017
New Revision: 291141
URL: http://llvm.org/viewvc/llvm-project?rev=291141&view=rev
Log:
Revert "[sancov] introducing SANCOV_OPTIONS"
and related changes
https://llvm.org/svn/llvm-project/compiler-rt/trunk@291068
Removed:
compiler-rt/trunk/lib/sanitizer_common/sancov_flags.cc
compiler-rt/trunk/lib/sanitizer_common/sancov_flags.h
compiler-rt/trunk/lib/sanitizer_common/sancov_flags.inc
compiler-rt/trunk/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc
Modified:
compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt?rev=291141&r1=291140&r2=291141&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt Thu Jan 5 10:55:56 2017
@@ -52,7 +52,6 @@ set(SANITIZER_NOLIBC_SOURCES
set(SANITIZER_LIBCDEP_SOURCES
sanitizer_common_libcdep.cc
- sancov_flags.cc
sanitizer_coverage_libcdep.cc
sanitizer_coverage_libcdep_new.cc
sanitizer_coverage_mapping_libcdep.cc
Removed: compiler-rt/trunk/lib/sanitizer_common/sancov_flags.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sancov_flags.cc?rev=291140&view=auto
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sancov_flags.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sancov_flags.cc (removed)
@@ -1,60 +0,0 @@
-//===-- sancov_flags.cc -----------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Sanitizer Coverage runtime flags.
-//
-//===----------------------------------------------------------------------===//
-
-#include "sancov_flags.h"
-#include "sanitizer_flag_parser.h"
-#include "sanitizer_platform.h"
-
-#if SANITIZER_WINDOWS
-// Windows doesn't have weak symbols.
-extern "C" const char* __sancov_default_options() { return ""; }
-#endif
-
-using namespace __sanitizer;
-
-namespace __sancov {
-
-SancovFlags sancov_flags_dont_use_directly; // use via flags();
-
-void SancovFlags::SetDefaults() {
-#define SANCOV_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue;
-#include "sancov_flags.inc"
-#undef SANCOV_FLAG
-}
-
-static void RegisterSancovFlags(FlagParser *parser, SancovFlags *f) {
-#define SANCOV_FLAG(Type, Name, DefaultValue, Description) \
- RegisterFlag(parser, #Name, Description, &f->Name);
-#include "sancov_flags.inc"
-#undef SANCOV_FLAG
-}
-
-static const char *MaybeCallSancovDefaultOptions() {
- return (&__sancov_default_options) ? __sancov_default_options() : "";
-}
-
-void InitializeSancovFlags() {
- SancovFlags *f = sancov_flags();
- f->SetDefaults();
-
- FlagParser parser;
- RegisterSancovFlags(&parser, f);
-
- parser.ParseString(MaybeCallSancovDefaultOptions());
- parser.ParseString(GetEnv("SANCOV_OPTIONS"));
-
- ReportUnrecognizedFlags();
- if (f->help) parser.PrintFlagDescriptions();
-}
-
-} // namespace __sancov
Removed: compiler-rt/trunk/lib/sanitizer_common/sancov_flags.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sancov_flags.h?rev=291140&view=auto
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sancov_flags.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sancov_flags.h (removed)
@@ -1,40 +0,0 @@
-//===-- sancov_flags.h ------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Sanitizer Coverage runtime flags.
-//
-//===----------------------------------------------------------------------===//
-#ifndef SANCOV_FLAGS_H
-#define SANCOV_FLAGS_H
-
-#include "sanitizer_flag_parser.h"
-#include "sanitizer_internal_defs.h"
-
-namespace __sancov {
-
-struct SancovFlags {
-#define SANCOV_FLAG(Type, Name, DefaultValue, Description) Type Name;
-#include "sancov_flags.inc"
-#undef SANCOV_FLAG
-
- void SetDefaults();
-};
-
-extern SancovFlags sancov_flags_dont_use_directly;
-
-inline SancovFlags* sancov_flags() { return &sancov_flags_dont_use_directly; }
-
-void InitializeSancovFlags();
-
-extern "C" SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE const char*
-__sancov_default_options();
-
-} // namespace __sancov
-
-#endif
Removed: compiler-rt/trunk/lib/sanitizer_common/sancov_flags.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sancov_flags.inc?rev=291140&view=auto
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sancov_flags.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sancov_flags.inc (removed)
@@ -1,21 +0,0 @@
-//===-- sancov_flags.inc ----------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Sanitizer Coverage runtime flags.
-//
-//===----------------------------------------------------------------------===//
-#ifndef SANCOV_FLAG
-#error "Defnine SANCOV_FLAG prior to including this file!"
-#endif
-
-SANCOV_FLAG(bool, symbolize, true,
- "If set, converage information will be symbolized by sancov tool "
- "after dumping.")
-
-SANCOV_FLAG(bool, help, false, "Print flags help.")
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc?rev=291141&r1=291140&r2=291141&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc Thu Jan 5 10:55:56 2017
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// Sanitizer Coverage Controller for Trace PC Guard.
-#include "sancov_flags.h"
#include "sanitizer_allocator_internal.h"
#include "sanitizer_atomic.h"
#include "sanitizer_common.h"
@@ -18,7 +17,6 @@ using namespace __sanitizer;
using AddressRange = LoadedModule::AddressRange;
-namespace __sancov {
namespace {
static const u64 Magic64 = 0xC0BFFFFFFFFFFF64ULL;
@@ -98,10 +96,6 @@ static void SanitizerDumpCoverage(const
InternalFree(file_path);
InternalFree(module_name);
InternalFree(pcs);
-
- if (sancov_flags()->symbolize) {
- Printf("TODO(aizatsky): call sancov to symbolize\n");
- }
}
// Collects trace-pc guard coverage.
@@ -112,8 +106,6 @@ class TracePcGuardController {
CHECK(!initialized);
initialized = true;
- InitializeSancovFlags();
-
pc_vector.Initialize(0);
}
@@ -148,27 +140,26 @@ class TracePcGuardController {
static TracePcGuardController pc_guard_controller;
} // namespace
-} // namespace __sancov
extern "C" {
SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_dump_coverage( // NOLINT
const uptr* pcs, uptr len) {
- return __sancov::SanitizerDumpCoverage(pcs, len);
+ return SanitizerDumpCoverage(pcs, len);
}
SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void
__sanitizer_cov_trace_pc_guard(u32* guard) {
if (!*guard) return;
- __sancov::pc_guard_controller.TracePcGuard(guard, GET_CALLER_PC() - 1);
+ pc_guard_controller.TracePcGuard(guard, GET_CALLER_PC() - 1);
}
SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void
__sanitizer_cov_trace_pc_guard_init(u32* start, u32* end) {
if (start == end || *start) return;
- __sancov::pc_guard_controller.InitTracePcGuard(start, end);
+ pc_guard_controller.InitTracePcGuard(start, end);
}
SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_dump_trace_pc_guard_coverage() {
- __sancov::pc_guard_controller.Dump();
+ pc_guard_controller.Dump();
}
} // extern "C"
Removed: compiler-rt/trunk/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc?rev=291140&view=auto
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc (removed)
@@ -1,35 +0,0 @@
-// Tests trace pc guard coverage collection.
-//
-// REQUIRES: has_sancovcc,stable-runtime
-// XFAIL: tsan,darwin
-// TODO: this will fail on powerpc64,s390x once sancov will be called.
-//
-// RUN: DIR=%t_workdir
-// RUN: rm -rf $DIR
-// RUN: mkdir -p $DIR
-// RUN: cd $DIR
-// RUN: %clangxx -O0 -fsanitize-coverage=trace-pc-guard %s -ldl -o %t
-// RUN: %env_tool_opts=coverage=1 %t 2>&1 | FileCheck %s
-// RUN: %env_tool_opts=coverage=1 SANCOV_OPTIONS=symbolize=0 %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOSYM
-// RUN: rm -rf $DIR
-
-#include <stdio.h>
-
-int foo() {
- fprintf(stderr, "foo\n");
- return 1;
-}
-
-int main() {
- fprintf(stderr, "main\n");
- foo();
- foo();
-}
-
-// CHECK: main
-// CHECK: SanitizerCoverage: ./sanitizer_coverage_symbolize.{{.*}}.sancov 2 PCs written
-// CHECK: call sancov
-
-// CHECK-NOSYM: main
-// CHECK-NOSYM: SanitizerCoverage: ./sanitizer_coverage_symbolize.{{.*}}.sancov 2 PCs written
-// CHECK-NOSYM-NOT: call sancov
More information about the llvm-commits
mailing list