Merge changes from topic "remove_art_tombstoned_parameter"

* changes:
  ART: Remove tombstoned parameters
  Revert "ART: Support per PID stack trace files."
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc
index 5518eb2..3aa481a 100644
--- a/runtime/parsed_options.cc
+++ b/runtime/parsed_options.cc
@@ -252,12 +252,6 @@
       .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 @@
   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 d12a976..7823014 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -232,7 +232,6 @@
       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::StartSignalCatcher() {
   if (!is_zygote_) {
-    signal_catcher_ = new SignalCatcher(stack_trace_file_, use_tombstoned_traces_);
+    signal_catcher_ = new SignalCatcher();
   }
 }
 
@@ -1152,12 +1151,6 @@
   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 1b7663c..56d95e0 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -871,14 +871,6 @@
 
   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 4121ad6..427385d 100644
--- a/runtime/runtime_options.def
+++ b/runtime/runtime_options.def
@@ -103,8 +103,6 @@
 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 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
 }
 
diff --git a/runtime/signal_catcher.h b/runtime/signal_catcher.h
index 8a2a728..46eae7e 100644
--- a/runtime/signal_catcher.h
+++ b/runtime/signal_catcher.h
@@ -33,17 +33,7 @@
  */
 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 @@
   // 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_);
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index be1296b..81e77be 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -80,11 +80,6 @@
 # The *hard* timeout where we really start trying to kill the dex2oat.
 DEX2OAT_RT_TIMEOUT="360" # 6 mins
 
-# if "y", set -Xstacktracedir and inform the test of its location. When
-# this is set, stack trace dumps (from signal 3) will be written to a file
-# under this directory instead of stdout.
-SET_STACK_TRACE_DUMP_DIR="n"
-
 # if "y", run 'sync' before dalvikvm to make sure all files from
 # build step (e.g. dex2oat) were finished writing.
 SYNC_BEFORE_RUN="n"
@@ -364,9 +359,6 @@
     elif [ "x$1" = "x--random-profile" ]; then
         RANDOM_PROFILE="y"
         shift
-    elif [ "x$1" = "x--set-stack-trace-dump-dir" ]; then
-        SET_STACK_TRACE_DUMP_DIR="y"
-        shift
     elif expr "x$1" : "x--" >/dev/null 2>&1; then
         echo "unknown $0 option: $1" 1>&2
         exit 1
@@ -375,22 +367,12 @@
     fi
 done
 
-mkdir_locations=""
-
 if [ "$USE_JVM" = "n" ]; then
     FLAGS="${FLAGS} ${ANDROID_FLAGS}"
     for feature in ${EXPERIMENTAL}; do
         FLAGS="${FLAGS} -Xexperimental:${feature} -Xcompiler-option --runtime-arg -Xcompiler-option -Xexperimental:${feature}"
         COMPILE_FLAGS="${COMPILE_FLAGS} --runtime-arg -Xexperimental:${feature}"
     done
-
-    if [ "$SET_STACK_TRACE_DUMP_DIR" = "y" ]; then
-        # Note that DEX_LOCATION is used as a proxy for tmpdir throughout this
-        # file (it will be under the test specific folder).
-        mkdir_locations="${mkdir_locations} $DEX_LOCATION/stack_traces"
-        FLAGS="${FLAGS} -Xstacktracedir:$DEX_LOCATION/stack_traces"
-        ARGS="${ARGS} --stack-trace-dir $DEX_LOCATION/stack_traces"
-    fi
 fi
 
 if [ "x$1" = "x" ] ; then
@@ -684,7 +666,7 @@
 dex2oat_cmdline="true"
 vdex_cmdline="true"
 dm_cmdline="true"
-mkdir_locations="${mkdir_locations} ${DEX_LOCATION}/dalvik-cache/$ISA"
+mkdir_locations="${DEX_LOCATION}/dalvik-cache/$ISA"
 strip_cmdline="true"
 sync_cmdline="true"