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
diff --git a/runtime/signal_catcher.cc b/runtime/signal_catcher.cc
index d590ad5..f4a27b8 100644
--- a/runtime/signal_catcher.cc
+++ b/runtime/signal_catcher.cc
@@ -73,19 +73,10 @@
#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 @@
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 @@
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
}