diff options
author | Ian Rogers <irogers@google.com> | 2013-04-09 09:45:49 -0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2013-04-09 09:45:49 -0700 |
commit | f08e473519dc5c7ccb85eb2b333f9d0aff23a329 (patch) | |
tree | 796cb1f9102e07c33de163281a2e34af5bf634d0 | |
parent | 10e75abe80fc86ff5a6a5b4b3bcef382b3c596be (diff) | |
download | android_art-f08e473519dc5c7ccb85eb2b333f9d0aff23a329.tar.gz android_art-f08e473519dc5c7ccb85eb2b333f9d0aff23a329.tar.bz2 android_art-f08e473519dc5c7ccb85eb2b333f9d0aff23a329.zip |
Fix abort regression.
Change https://googleplex-android-review.googlesource.com/#/c/249463/ set a
boolean prior to testing it meaning that all aborts were seen as recursive and
no meaningful log information was given.
Also a fix related to https://googleplex-android-review.googlesource.com/293665
where we were attempting to dump other threads stacks during aborting even
though those threads weren't suspended.
Change-Id: I1f848512c5e380529579db3d16bb8f5ddda36ad3
-rw-r--r-- | src/base/logging.cc | 2 | ||||
-rw-r--r-- | src/base/logging.h | 2 | ||||
-rw-r--r-- | src/compiler/driver/compiler_driver.cc | 2 | ||||
-rw-r--r-- | src/runtime.cc | 6 | ||||
-rw-r--r-- | src/runtime_linux.cc | 2 | ||||
-rw-r--r-- | src/thread.cc | 18 |
6 files changed, 18 insertions, 14 deletions
diff --git a/src/base/logging.cc b/src/base/logging.cc index 6d0452bcb3..c9f28c81d8 100644 --- a/src/base/logging.cc +++ b/src/base/logging.cc @@ -25,7 +25,7 @@ namespace art { LogVerbosity gLogVerbosity; -bool gAborting = false; +unsigned int gAborting = 0; static LogSeverity gMinimumLogSeverity = INFO; static std::string* gCmdLine; diff --git a/src/base/logging.h b/src/base/logging.h index a08acabfac..310357d11b 100644 --- a/src/base/logging.h +++ b/src/base/logging.h @@ -319,7 +319,7 @@ extern LogVerbosity gLogVerbosity; // Used on fatal exit. Prevents recursive aborts. Allows us to disable // some error checking to ensure fatal shutdown makes forward progress. -extern bool gAborting; +extern unsigned int gAborting; extern void InitLogging(char* argv[]); diff --git a/src/compiler/driver/compiler_driver.cc b/src/compiler/driver/compiler_driver.cc index 9db9ee8124..7ce01eda87 100644 --- a/src/compiler/driver/compiler_driver.cc +++ b/src/compiler/driver/compiler_driver.cc @@ -1397,7 +1397,7 @@ static const char* class_initializer_black_list[] = { "Ljavax/net/ssl/HttpsURLConnection;", // Calls SSLSocketFactory.getDefault -> java.security.Security.getProperty. "Llibcore/icu/LocaleData;", // Requires java.util.Locale. "Llibcore/icu/TimeZoneNames;", // Requires java.util.TimeZone. - "Llibcore/io/IoUtils;", // Calls OsConstants.initConstants. + "Llibcore/io/IoUtils;", // Calls Random.<init> -> System.currentTimeMillis -> FileDescriptor -> OsConstants.initConstants. "Llibcore/io/OsConstants;", // Platform specific. "Llibcore/net/MimeUtils;", // Calls libcore.net.MimeUtils.getContentTypesPropertiesStream -> System.getProperty. "Llibcore/util/ZoneInfo;", // Sub-class of TimeZone. diff --git a/src/runtime.cc b/src/runtime.cc index 23a7309bd8..9661f50ce7 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -147,11 +147,11 @@ Runtime::~Runtime() { struct AbortState { void Dump(std::ostream& os) { - if (gAborting) { + if (gAborting > 1) { os << "Runtime aborting --- recursively, so no thread-specific detail!\n"; return; } - gAborting = true; + gAborting++; os << "Runtime aborting...\n"; if (Runtime::Current() == NULL) { os << "(Runtime does not yet exist!)\n"; @@ -193,7 +193,7 @@ struct AbortState { }; void Runtime::Abort() { - gAborting = true; // set before taking any locks + gAborting++; // set before taking any locks // Ensure that we don't have multiple threads trying to abort at once, // which would result in significantly worse diagnostics. diff --git a/src/runtime_linux.cc b/src/runtime_linux.cc index 0be6339f4c..a4fc3af606 100644 --- a/src/runtime_linux.cc +++ b/src/runtime_linux.cc @@ -236,7 +236,7 @@ void HandleUnexpectedSignal(int signal_number, siginfo_t* info, void* raw_contex } handlingUnexpectedSignal = true; - gAborting = true; // set before taking any locks + gAborting++; // set before taking any locks MutexLock mu(Thread::Current(), *Locks::unexpected_signal_lock_); bool has_address = (signal_number == SIGILL || signal_number == SIGBUS || diff --git a/src/thread.cc b/src/thread.cc index 2c955b173b..74d58e30f3 100644 --- a/src/thread.cc +++ b/src/thread.cc @@ -859,14 +859,18 @@ static bool ShouldShowNativeStack(const Thread* thread) { } void Thread::DumpStack(std::ostream& os) const { - // If we're currently in native code, dump that stack before dumping the managed stack. - if (ShouldShowNativeStack(this)) { - DumpKernelStack(os, GetTid(), " kernel: ", false); - DumpNativeStack(os, GetTid(), " native: ", false); + if (this == Thread::Current() || IsSuspended()) { + // If we're currently in native code, dump that stack before dumping the managed stack. + if (ShouldShowNativeStack(this)) { + DumpKernelStack(os, GetTid(), " kernel: ", false); + DumpNativeStack(os, GetTid(), " native: ", false); + } + UniquePtr<Context> context(Context::Create()); + StackDumpVisitor dumper(os, const_cast<Thread*>(this), context.get(), !throwing_OutOfMemoryError_); + dumper.WalkStack(); + } else { + os << "Not able to dump stack of thread that isn't suspended"; } - UniquePtr<Context> context(Context::Create()); - StackDumpVisitor dumper(os, const_cast<Thread*>(this), context.get(), !throwing_OutOfMemoryError_); - dumper.WalkStack(); } void Thread::ThreadExitCallback(void* arg) { |