diff options
| author | 2018-05-03 10:40:37 -0700 | |
|---|---|---|
| committer | 2018-05-04 11:55:30 -0700 | |
| commit | 53af040f8c1a817dcb1e727a3e83baab3449569a (patch) | |
| tree | 29a38f4aee4392fc7580f630f7909fb11da15ee5 | |
| parent | b09abb2f8a988ccc95d91dc8624577188c771bc0 (diff) | |
ART: Remove tombstoned parameters
These are no longer supported. Always try to use tombstoned when on
a device.
Bug: 77288304
Test: m test-art-host
Test: Device boots
Test: manual ANR dumps work
Change-Id: Iffd3287432becfc7982cdcb9a0cfe44f0c5b5143
| -rw-r--r-- | runtime/parsed_options.cc | 7 | ||||
| -rw-r--r-- | runtime/runtime.cc | 9 | ||||
| -rw-r--r-- | runtime/runtime.h | 8 | ||||
| -rw-r--r-- | runtime/runtime_options.def | 2 | ||||
| -rw-r--r-- | runtime/signal_catcher.cc | 56 | ||||
| -rw-r--r-- | runtime/signal_catcher.h | 19 |
6 files changed, 11 insertions, 90 deletions
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc index 5518eb2c49..3aa481af8c 100644 --- a/runtime/parsed_options.cc +++ b/runtime/parsed_options.cc @@ -252,12 +252,6 @@ std::unique_ptr<RuntimeParser> ParsedOptions::MakeParser(bool ignore_unrecognize .Define("-Xstackdumplockprofthreshold:_") .WithType<unsigned int>() .IntoKey(M::StackDumpLockProfThreshold) - .Define("-Xusetombstonedtraces") - .WithValue(true) - .IntoKey(M::UseTombstonedTraces) - .Define("-Xstacktracefile:_") - .WithType<std::string>() - .IntoKey(M::StackTraceFile) .Define("-Xmethod-trace") .IntoKey(M::MethodTrace) .Define("-Xmethod-trace-file:_") @@ -699,7 +693,6 @@ void ParsedOptions::Usage(const char* fmt, ...) { UsageMessage(stream, "The following Dalvik options are supported:\n"); UsageMessage(stream, " -Xzygote\n"); UsageMessage(stream, " -Xjnitrace:substring (eg NativeClass or nativeMethod)\n"); - UsageMessage(stream, " -Xstacktracefile:<filename>\n"); UsageMessage(stream, " -Xgc:[no]preverify\n"); UsageMessage(stream, " -Xgc:[no]postverify\n"); UsageMessage(stream, " -XX:HeapGrowthLimit=N\n"); diff --git a/runtime/runtime.cc b/runtime/runtime.cc index d12a976be8..7823014781 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -232,7 +232,6 @@ Runtime::Runtime() intern_table_(nullptr), class_linker_(nullptr), signal_catcher_(nullptr), - use_tombstoned_traces_(false), java_vm_(nullptr), fault_message_lock_("Fault message lock"), fault_message_(""), @@ -904,7 +903,7 @@ void Runtime::InitNonZygoteOrPostFork( void Runtime::StartSignalCatcher() { if (!is_zygote_) { - signal_catcher_ = new SignalCatcher(stack_trace_file_, use_tombstoned_traces_); + signal_catcher_ = new SignalCatcher(); } } @@ -1152,12 +1151,6 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) { abort_ = runtime_options.GetOrDefault(Opt::HookAbort); default_stack_size_ = runtime_options.GetOrDefault(Opt::StackSize); - use_tombstoned_traces_ = runtime_options.GetOrDefault(Opt::UseTombstonedTraces); -#if !defined(ART_TARGET_ANDROID) - CHECK(!use_tombstoned_traces_) - << "-Xusetombstonedtraces is only supported in an Android environment"; -#endif - stack_trace_file_ = runtime_options.ReleaseOrDefault(Opt::StackTraceFile); compiler_executable_ = runtime_options.ReleaseOrDefault(Opt::Compiler); compiler_options_ = runtime_options.ReleaseOrDefault(Opt::CompilerOptions); diff --git a/runtime/runtime.h b/runtime/runtime.h index 1b7663cbdf..56d95e0b63 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -871,14 +871,6 @@ class Runtime { SignalCatcher* signal_catcher_; - // If true, the runtime will connect to tombstoned via a socket to - // request an open file descriptor to write its traces to. - bool use_tombstoned_traces_; - - // Location to which traces must be written on SIGQUIT. Only used if - // tombstoned_traces_ == false. - std::string stack_trace_file_; - std::unique_ptr<JavaVMExt> java_vm_; std::unique_ptr<jit::Jit> jit_; diff --git a/runtime/runtime_options.def b/runtime/runtime_options.def index 4121ad69ed..427385d914 100644 --- a/runtime/runtime_options.def +++ b/runtime/runtime_options.def @@ -103,8 +103,6 @@ RUNTIME_OPTIONS_KEY (Unit, ForceNativeBridge) RUNTIME_OPTIONS_KEY (LogVerbosity, Verbose) RUNTIME_OPTIONS_KEY (unsigned int, LockProfThreshold) RUNTIME_OPTIONS_KEY (unsigned int, StackDumpLockProfThreshold) -RUNTIME_OPTIONS_KEY (bool, UseTombstonedTraces, false) -RUNTIME_OPTIONS_KEY (std::string, StackTraceFile) RUNTIME_OPTIONS_KEY (Unit, MethodTrace) RUNTIME_OPTIONS_KEY (std::string, MethodTraceFile, "/data/misc/trace/method-trace-file.bin") RUNTIME_OPTIONS_KEY (unsigned int, MethodTraceFileSize, 10 * MB) diff --git a/runtime/signal_catcher.cc b/runtime/signal_catcher.cc index d590ad5cc6..f4a27b8397 100644 --- a/runtime/signal_catcher.cc +++ b/runtime/signal_catcher.cc @@ -73,19 +73,10 @@ static void DumpCmdLine(std::ostream& os) { #endif } -SignalCatcher::SignalCatcher(const std::string& stack_trace_file, - bool use_tombstoned_stack_trace_fd) - : stack_trace_file_(stack_trace_file), - use_tombstoned_stack_trace_fd_(use_tombstoned_stack_trace_fd), - lock_("SignalCatcher lock"), +SignalCatcher::SignalCatcher() + : lock_("SignalCatcher lock"), cond_("SignalCatcher::cond_", lock_), thread_(nullptr) { -#if !defined(ART_TARGET_ANDROID) - // We're not running on Android, so we can't communicate with tombstoned - // to ask for an open file. - CHECK(!use_tombstoned_stack_trace_fd_); -#endif - SetHaltFlag(false); // Create a raw pthread; its start routine will attach to the runtime. @@ -116,37 +107,11 @@ bool SignalCatcher::ShouldHalt() { return halt_; } -bool SignalCatcher::OpenStackTraceFile(android::base::unique_fd* tombstone_fd, - android::base::unique_fd* output_fd) { - if (use_tombstoned_stack_trace_fd_) { -#if defined(ART_TARGET_ANDROID) - return tombstoned_connect(getpid(), tombstone_fd, output_fd, kDebuggerdJavaBacktrace); -#else - UNUSED(tombstone_fd); - UNUSED(output_fd); -#endif - } - - // The runtime is not configured to dump traces to a file, will LOG(INFO) - // instead. - if (stack_trace_file_.empty()) { - return false; - } - - int fd = open(stack_trace_file_.c_str(), O_APPEND | O_CREAT | O_WRONLY, 0666); - if (fd == -1) { - PLOG(ERROR) << "Unable to open stack trace file '" << stack_trace_file_ << "'"; - return false; - } - - output_fd->reset(fd); - return true; -} - void SignalCatcher::Output(const std::string& s) { +#if defined(ART_TARGET_ANDROID) android::base::unique_fd tombstone_fd; android::base::unique_fd output_fd; - if (!OpenStackTraceFile(&tombstone_fd, &output_fd)) { + if (!tombstoned_connect(getpid(), &tombstone_fd, &output_fd, kDebuggerdJavaBacktrace)) { LOG(INFO) << s; return; } @@ -161,19 +126,16 @@ void SignalCatcher::Output(const std::string& s) { file->Erase(); } - const std::string output_path_msg = (use_tombstoned_stack_trace_fd_) ? - "[tombstoned]" : stack_trace_file_; - if (success) { - LOG(INFO) << "Wrote stack traces to '" << output_path_msg << "'"; + LOG(INFO) << "Wrote stack traces to tombstoned"; } else { - PLOG(ERROR) << "Failed to write stack traces to '" << output_path_msg << "'"; + PLOG(ERROR) << "Failed to write stack traces to tombstoned"; } - -#if defined(ART_TARGET_ANDROID) - if (use_tombstoned_stack_trace_fd_ && !tombstoned_notify_completion(tombstone_fd)) { + if (!tombstoned_notify_completion(tombstone_fd)) { PLOG(WARNING) << "Unable to notify tombstoned of dump completion"; } +#else + LOG(INFO) << s; #endif } diff --git a/runtime/signal_catcher.h b/runtime/signal_catcher.h index 8a2a7289de..46eae7e50e 100644 --- a/runtime/signal_catcher.h +++ b/runtime/signal_catcher.h @@ -33,17 +33,7 @@ class Thread; */ class SignalCatcher { public: - // If |use_tombstoned_stack_trace_fd| is |true|, traces will be - // written to a file descriptor provided by tombstoned. The process - // will communicate with tombstoned via a unix domain socket. This - // mode of stack trace dumping is only supported in an Android - // environment. - // - // If false, all traces will be dumped to |stack_trace_file| if it's - // non-empty. If |stack_trace_file| is empty, all traces will be written - // to the log buffer. - SignalCatcher(const std::string& stack_trace_file, - const bool use_tombstoned_stack_trace_fd); + SignalCatcher(); ~SignalCatcher(); void HandleSigQuit() REQUIRES(!Locks::mutator_lock_, !Locks::thread_list_lock_, @@ -54,19 +44,12 @@ class SignalCatcher { // NO_THREAD_SAFETY_ANALYSIS for static function calling into member function with excludes lock. static void* Run(void* arg) NO_THREAD_SAFETY_ANALYSIS; - // NOTE: We're using android::base::unique_fd here for easier - // interoperability with tombstoned client APIs. - bool OpenStackTraceFile(android::base::unique_fd* tombstone_fd, - android::base::unique_fd* output_fd); void HandleSigUsr1(); void Output(const std::string& s); void SetHaltFlag(bool new_value) REQUIRES(!lock_); bool ShouldHalt() REQUIRES(!lock_); int WaitForSignal(Thread* self, SignalSet& signals) REQUIRES(!lock_); - std::string stack_trace_file_; - const bool use_tombstoned_stack_trace_fd_; - mutable Mutex lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; ConditionVariable cond_ GUARDED_BY(lock_); bool halt_ GUARDED_BY(lock_); |