diff options
| author | 2017-12-07 15:44:13 -0800 | |
|---|---|---|
| committer | 2017-12-07 16:26:11 -0800 | |
| commit | 39b378ca3b4b6dc6da1651b84ee4289cd9bff0f8 (patch) | |
| tree | 1da7bdc834fbc2f11243fa2b936f0d7a67d982c1 | |
| parent | dcc528d2c7d5ac2cc075d4c965fdf702421d0f43 (diff) | |
ART: Factor out gAborting
Cut dependencies on base/logging.h by moving gAborting to its
own header. Leave the static storage in logging.cc.
Test: m
Change-Id: Ib2ca880e15f9cb50cb9aab803784826bb46efb5e
| -rw-r--r-- | dexoptanalyzer/dexoptanalyzer.cc | 1 | ||||
| -rw-r--r-- | runtime/barrier.cc | 4 | ||||
| -rw-r--r-- | runtime/base/aborting.h | 31 | ||||
| -rw-r--r-- | runtime/base/file_utils.cc | 2 | ||||
| -rw-r--r-- | runtime/base/logging.cc | 3 | ||||
| -rw-r--r-- | runtime/base/logging.h | 5 | ||||
| -rw-r--r-- | runtime/base/mutex.h | 2 | ||||
| -rw-r--r-- | runtime/gc/heap-inl.h | 1 | ||||
| -rw-r--r-- | runtime/native_stack_dump.cc | 2 | ||||
| -rw-r--r-- | runtime/runtime.cc | 1 | ||||
| -rw-r--r-- | runtime/runtime_common.cc | 5 | ||||
| -rw-r--r-- | runtime/signal_catcher.cc | 1 | ||||
| -rw-r--r-- | runtime/thread-inl.h | 2 | ||||
| -rw-r--r-- | runtime/thread_list.cc | 1 | ||||
| -rw-r--r-- | runtime/verifier/method_verifier.cc | 1 | ||||
| -rw-r--r-- | runtime/verifier/reg_type_cache.cc | 1 |
16 files changed, 50 insertions, 13 deletions
diff --git a/dexoptanalyzer/dexoptanalyzer.cc b/dexoptanalyzer/dexoptanalyzer.cc index 39c9b9993b..cde68da801 100644 --- a/dexoptanalyzer/dexoptanalyzer.cc +++ b/dexoptanalyzer/dexoptanalyzer.cc @@ -16,6 +16,7 @@ #include <string> +#include "base/logging.h" // For InitLogging. #include "android-base/stringprintf.h" #include "android-base/strings.h" #include "base/file_utils.h" diff --git a/runtime/barrier.cc b/runtime/barrier.cc index 8d3bc0e095..4329a5a245 100644 --- a/runtime/barrier.cc +++ b/runtime/barrier.cc @@ -16,7 +16,9 @@ #include "barrier.h" -#include "base/logging.h" // Required for gAborting. +#include <android-base/logging.h> + +#include "base/aborting.h" #include "base/mutex.h" #include "base/time_utils.h" #include "thread.h" diff --git a/runtime/base/aborting.h b/runtime/base/aborting.h new file mode 100644 index 0000000000..8906c96ea7 --- /dev/null +++ b/runtime/base/aborting.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ART_RUNTIME_BASE_ABORTING_H_ +#define ART_RUNTIME_BASE_ABORTING_H_ + +#include <atomic> + +namespace art { + +// 0 if not abort, non-zero if an abort is in progress. Used on fatal exit to prevents recursive +// aborts. Global declaration allows us to disable some error checking to ensure fatal shutdown +// makes forward progress. +extern std::atomic<unsigned int> gAborting; + +} // namespace art + +#endif // ART_RUNTIME_BASE_ABORTING_H_ diff --git a/runtime/base/file_utils.cc b/runtime/base/file_utils.cc index 323a06519d..db498600d9 100644 --- a/runtime/base/file_utils.cc +++ b/runtime/base/file_utils.cc @@ -89,7 +89,7 @@ bool ReadFileToString(const std::string& file_name, std::string* result) { } } -bool PrintFileToLog(const std::string& file_name, LogSeverity level) { +bool PrintFileToLog(const std::string& file_name, android::base::LogSeverity level) { File file(file_name, O_RDONLY, false); if (!file.IsOpened()) { return false; diff --git a/runtime/base/logging.cc b/runtime/base/logging.cc index 26106eef2f..90eb74c75c 100644 --- a/runtime/base/logging.cc +++ b/runtime/base/logging.cc @@ -20,7 +20,8 @@ #include <limits> #include <sstream> -#include "base/mutex.h" +#include "aborting.h" +#include "mutex.h" #include "thread-current-inl.h" #include "utils.h" diff --git a/runtime/base/logging.h b/runtime/base/logging.h index 981fbbfba4..c562bdf59f 100644 --- a/runtime/base/logging.h +++ b/runtime/base/logging.h @@ -63,11 +63,6 @@ struct LogVerbosity { // Global log verbosity setting, initialized by InitLogging. extern LogVerbosity gLogVerbosity; -// 0 if not abort, non-zero if an abort is in progress. Used on fatal exit to prevents recursive -// aborts. Global declaration allows us to disable some error checking to ensure fatal shutdown -// makes forward progress. -extern std::atomic<unsigned int> gAborting; - // Configure logging based on ANDROID_LOG_TAGS environment variable. // We need to parse a string that looks like // diff --git a/runtime/base/mutex.h b/runtime/base/mutex.h index 9a037b50bf..7077298ca9 100644 --- a/runtime/base/mutex.h +++ b/runtime/base/mutex.h @@ -27,7 +27,7 @@ #include <android-base/logging.h> #include "atomic.h" -#include "base/logging.h" // For gAborting. +#include "base/aborting.h" #include "base/macros.h" #include "globals.h" diff --git a/runtime/gc/heap-inl.h b/runtime/gc/heap-inl.h index 2047646413..141efd2f06 100644 --- a/runtime/gc/heap-inl.h +++ b/runtime/gc/heap-inl.h @@ -20,6 +20,7 @@ #include "heap.h" #include "allocation_listener.h" +#include "base/logging.h" // For VLOG. #include "base/time_utils.h" #include "gc/accounting/atomic_stack.h" #include "gc/accounting/card_table-inl.h" diff --git a/runtime/native_stack_dump.cc b/runtime/native_stack_dump.cc index 841506bce3..ec9455289f 100644 --- a/runtime/native_stack_dump.cc +++ b/runtime/native_stack_dump.cc @@ -40,8 +40,8 @@ #include "android-base/stringprintf.h" #include "arch/instruction_set.h" +#include "base/aborting.h" #include "base/file_utils.h" -#include "base/logging.h" // For gAborting. #include "base/memory_tool.h" #include "base/mutex.h" #include "base/unix_file/fd_file.h" diff --git a/runtime/runtime.cc b/runtime/runtime.cc index d15de38b0a..7239ad3213 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -57,6 +57,7 @@ #include "asm_support.h" #include "asm_support_check.h" #include "atomic.h" +#include "base/aborting.h" #include "base/arena_allocator.h" #include "base/dumpable.h" #include "base/enums.h" diff --git a/runtime/runtime_common.cc b/runtime/runtime_common.cc index b49bec6921..59af9187f9 100644 --- a/runtime/runtime_common.cc +++ b/runtime/runtime_common.cc @@ -26,8 +26,9 @@ #include <android-base/logging.h> #include <android-base/stringprintf.h> +#include "base/aborting.h" #include "base/file_utils.h" -#include "base/logging.h" // For gAborting. +#include "base/logging.h" // For LogHelper, GetCmdLine. #include "base/macros.h" #include "base/mutex.h" #include "native_stack_dump.h" @@ -431,7 +432,7 @@ void HandleUnexpectedSignalCommon(int signal_number, logger(LOG_STREAM(FATAL_WITHOUT_ABORT)); } if (kIsDebugBuild && signal_number == SIGSEGV) { - PrintFileToLog("/proc/self/maps", LogSeverity::FATAL_WITHOUT_ABORT); + PrintFileToLog("/proc/self/maps", android::base::LogSeverity::FATAL_WITHOUT_ABORT); } Runtime* runtime = Runtime::Current(); diff --git a/runtime/signal_catcher.cc b/runtime/signal_catcher.cc index bf5d718113..d9c4da9b96 100644 --- a/runtime/signal_catcher.cc +++ b/runtime/signal_catcher.cc @@ -35,6 +35,7 @@ #include "arch/instruction_set.h" #include "base/file_utils.h" +#include "base/logging.h" // For GetCmdLine. #include "base/time_utils.h" #include "base/unix_file/fd_file.h" #include "class_linker.h" diff --git a/runtime/thread-inl.h b/runtime/thread-inl.h index 9d08531b69..62b0789a43 100644 --- a/runtime/thread-inl.h +++ b/runtime/thread-inl.h @@ -19,8 +19,8 @@ #include "thread.h" +#include "base/aborting.h" #include "base/casts.h" -#include "base/logging.h" // For gAborting. #include "base/mutex-inl.h" #include "base/time_utils.h" #include "jni_env_ext.h" diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc index 9f553147c4..8754819e09 100644 --- a/runtime/thread_list.cc +++ b/runtime/thread_list.cc @@ -28,6 +28,7 @@ #include "nativehelper/scoped_local_ref.h" #include "nativehelper/scoped_utf_chars.h" +#include "base/aborting.h" #include "base/histogram-inl.h" #include "base/mutex-inl.h" #include "base/systrace.h" diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index f10cd37a2c..82820fda9a 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -22,6 +22,7 @@ #include "art_field-inl.h" #include "art_method-inl.h" +#include "base/aborting.h" #include "base/enums.h" #include "base/logging.h" // For VLOG. #include "base/mutex-inl.h" diff --git a/runtime/verifier/reg_type_cache.cc b/runtime/verifier/reg_type_cache.cc index a3f08c8580..c68fa0f0d6 100644 --- a/runtime/verifier/reg_type_cache.cc +++ b/runtime/verifier/reg_type_cache.cc @@ -18,6 +18,7 @@ #include <type_traits> +#include "base/aborting.h" #include "base/arena_bit_vector.h" #include "base/bit_vector-inl.h" #include "base/casts.h" |