diff options
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r-- | runtime/runtime.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc index c4010e3..23405e6 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -22,6 +22,7 @@ #include <signal.h> #include <sys/syscall.h> +#include <valgrind.h> #include <cstdio> #include <cstdlib> @@ -77,6 +78,7 @@ namespace art { +static constexpr bool kEnableJavaStackTraceHandler = true; Runtime* Runtime::instance_ = NULL; Runtime::Runtime() @@ -111,6 +113,7 @@ Runtime::Runtime() exit_(nullptr), abort_(nullptr), stats_enabled_(false), + running_on_valgrind_(RUNNING_ON_VALGRIND > 0), profile_(false), profile_period_s_(0), profile_duration_s_(0), @@ -523,12 +526,11 @@ bool Runtime::Init(const Options& raw_options, bool ignore_unrecognized) { if (options->explicit_checks_ != (ParsedOptions::kExplicitSuspendCheck | ParsedOptions::kExplicitNullCheck | - ParsedOptions::kExplicitStackOverflowCheck)) { - // Initialize the fault manager. + ParsedOptions::kExplicitStackOverflowCheck) || kEnableJavaStackTraceHandler) { fault_manager.Init(); - // These need to be in a specific order. The null point check must be - // the last in the list. + // These need to be in a specific order. The null point check handler must be + // after the suspend check and stack overflow check handlers. if ((options->explicit_checks_ & ParsedOptions::kExplicitSuspendCheck) == 0) { suspend_handler_ = new SuspensionHandler(&fault_manager); } @@ -540,6 +542,10 @@ bool Runtime::Init(const Options& raw_options, bool ignore_unrecognized) { if ((options->explicit_checks_ & ParsedOptions::kExplicitNullCheck) == 0) { null_pointer_handler_ = new NullPointerHandler(&fault_manager); } + + if (kEnableJavaStackTraceHandler) { + new JavaStackTraceHandler(&fault_manager); + } } heap_ = new gc::Heap(options->heap_initial_size_, @@ -576,7 +582,7 @@ bool Runtime::Init(const Options& raw_options, bool ignore_unrecognized) { // objects. We can't supply a thread group yet; it will be fixed later. Since we are the main // thread, we do not get a java peer. Thread* self = Thread::Attach("main", false, NULL, false); - CHECK_EQ(self->thin_lock_thread_id_, ThreadList::kMainThreadId); + CHECK_EQ(self->GetThreadId(), ThreadList::kMainThreadId); CHECK(self != NULL); // Set us to runnable so tools using a runtime can allocate and GC by default |