Revert "Improve stack unwinding during gcstress tests."

This reverts commit 357d4db493467e4dd74b2ba1d4b8d7c80f8409b6.

Reason for revert: Investigating timeout issues.

Bug: 142039427
Change-Id: Iec1df893c75c6ab5b8cd52ba4b617acff57c3049
diff --git a/runtime/backtrace_helper.cc b/runtime/backtrace_helper.cc
index 2d39270..98280c7 100644
--- a/runtime/backtrace_helper.cc
+++ b/runtime/backtrace_helper.cc
@@ -26,8 +26,6 @@
 #include "unwindstack/Memory.h"
 #include "unwindstack/Unwinder.h"
 
-#include "base/bit_utils.h"
-#include "entrypoints/runtime_asm_entrypoints.h"
 #include "thread-inl.h"
 
 #else
@@ -58,9 +56,6 @@
     unwindstack::Elf::SetCachingEnabled(true);
   }
 
-  // Reparse process mmaps to detect newly loaded libraries.
-  bool Reparse() { return maps_.Reparse(); }
-
   static UnwindHelper* Get(Thread* self, size_t max_depth) {
     UnwindHelper* tls = reinterpret_cast<UnwindHelper*>(self->GetCustomTLS(kTlsKey));
     if (tls == nullptr) {
@@ -73,7 +68,7 @@
   unwindstack::Unwinder* Unwinder() { return &unwinder_; }
 
  private:
-  unwindstack::LocalUpdatableMaps maps_;
+  unwindstack::LocalMaps maps_;
   std::shared_ptr<unwindstack::Memory> memory_;
   unwindstack::JitDebug jit_;
   unwindstack::DexFiles dex_;
@@ -81,41 +76,19 @@
 };
 
 void BacktraceCollector::Collect() {
-  if (!CollectImpl()) {
-    // Reparse process mmaps to detect newly loaded libraries and retry.
-    UnwindHelper::Get(Thread::Current(), max_depth_)->Reparse();
-    if (!CollectImpl()) {
-      // Failed to unwind stack. Ignore for now.
-    }
-  }
-}
-
-bool BacktraceCollector::CollectImpl() {
   unwindstack::Unwinder* unwinder = UnwindHelper::Get(Thread::Current(), max_depth_)->Unwinder();
   std::unique_ptr<unwindstack::Regs> regs(unwindstack::Regs::CreateFromLocal());
   RegsGetLocal(regs.get());
   unwinder->SetRegs(regs.get());
   unwinder->Unwind();
-
   num_frames_ = 0;
   if (unwinder->NumFrames() > skip_count_) {
-    for (auto it = unwinder->frames().begin() + skip_count_; it != unwinder->frames().end(); ++it) {
-      CHECK_LT(num_frames_, max_depth_);
+    for (auto it = unwinder->frames().begin() + skip_count_;
+         max_depth_ > num_frames_ && it != unwinder->frames().end();
+         ++it) {
       out_frames_[num_frames_++] = static_cast<uintptr_t>(it->pc);
-
-      // Expected early end: Instrumentation breaks unwinding (b/138296821).
-      size_t align = GetInstructionSetAlignment(kRuntimeISA);
-      if (RoundUp(it->pc, align) == reinterpret_cast<uintptr_t>(GetQuickInstrumentationExitPc())) {
-        return true;
-      }
     }
   }
-
-  if (unwinder->LastErrorCode() == unwindstack::ERROR_INVALID_MAP) {
-    return false;
-  }
-
-  return true;
 }
 
 #else
diff --git a/runtime/backtrace_helper.h b/runtime/backtrace_helper.h
index 2fee62c..8eda3fa 100644
--- a/runtime/backtrace_helper.h
+++ b/runtime/backtrace_helper.h
@@ -36,10 +36,6 @@
   void Collect();
 
  private:
-  // Try to collect backtrace. Returns false on failure.
-  // It is used to retry backtrace on temporary failure.
-  bool CollectImpl();
-
   uintptr_t* const out_frames_ = nullptr;
   size_t num_frames_ = 0u;
   const size_t max_depth_ = 0u;
diff --git a/runtime/deoptimization_kind.h b/runtime/deoptimization_kind.h
index 5be6f3d..14e189c 100644
--- a/runtime/deoptimization_kind.h
+++ b/runtime/deoptimization_kind.h
@@ -17,8 +17,6 @@
 #ifndef ART_RUNTIME_DEOPTIMIZATION_KIND_H_
 #define ART_RUNTIME_DEOPTIMIZATION_KIND_H_
 
-#include "base/logging.h"
-
 namespace art {
 
 enum class DeoptimizationKind {
diff --git a/runtime/entrypoints/runtime_asm_entrypoints.h b/runtime/entrypoints/runtime_asm_entrypoints.h
index f350ce4..3f4e91e 100644
--- a/runtime/entrypoints/runtime_asm_entrypoints.h
+++ b/runtime/entrypoints/runtime_asm_entrypoints.h
@@ -19,12 +19,8 @@
 
 #include "deoptimization_kind.h"
 
-#include "jni.h"
-
 namespace art {
 
-class ArtMethod;
-
 #ifndef BUILDING_LIBART
 #error "File and symbols only for use within libart."
 #endif