summaryrefslogtreecommitdiffstats
path: root/runtime/signal_catcher.cc
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2018-05-03 10:40:37 -0700
committerAndreas Gampe <agampe@google.com>2018-05-04 11:55:30 -0700
commit53af040f8c1a817dcb1e727a3e83baab3449569a (patch)
tree29a38f4aee4392fc7580f630f7909fb11da15ee5 /runtime/signal_catcher.cc
parentb09abb2f8a988ccc95d91dc8624577188c771bc0 (diff)
downloadart-53af040f8c1a817dcb1e727a3e83baab3449569a.tar.gz
art-53af040f8c1a817dcb1e727a3e83baab3449569a.tar.bz2
art-53af040f8c1a817dcb1e727a3e83baab3449569a.zip
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
Diffstat (limited to 'runtime/signal_catcher.cc')
-rw-r--r--runtime/signal_catcher.cc56
1 files changed, 9 insertions, 47 deletions
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
}