diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-02-26 17:16:38 -0800 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-02-28 17:02:17 -0800 |
commit | 15d3402bbf8265eb1165694da2e4117eb128f3bc (patch) | |
tree | eea2dae3c338d3070f63e086fa2a3669a9204873 /runtime/runtime.cc | |
parent | ba8fdcc10193cdfa825c973d740b7ebf6dec2d89 (diff) | |
download | art-15d3402bbf8265eb1165694da2e4117eb128f3bc.zip art-15d3402bbf8265eb1165694da2e4117eb128f3bc.tar.gz art-15d3402bbf8265eb1165694da2e4117eb128f3bc.tar.bz2 |
Add custom SIGSEGV handler to help find heap corruption.
The new signal handler prints heap diagnostics when you get a SIGSEGV.
Added a fault message member in runtime which is modifiable by
Runtime::SetFaultMessage. When you get a SIGSEGV it will print out
whatever is stored in this string as well as the normal information.
This is useful for debugging heap corruption since it lets you see
which threads were in which methods when the last GC occured.
Added some smarter object dumping logic when the faulting address is
in the heap.
Bug: 12934910
Change-Id: Ia72be2c39f70ad711cbd746d66fad2b617d5d29f
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r-- | runtime/runtime.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 1ef15f7..90ba7d3 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -91,6 +91,8 @@ Runtime::Runtime() resolution_method_(nullptr), imt_conflict_method_(nullptr), default_imt_(nullptr), + fault_message_lock_("Fault message lock"), + fault_message_(""), method_verifiers_lock_("Method verifiers lock"), threads_being_born_(0), shutdown_cond_(new ConditionVariable("Runtime shutdown", *Locks::runtime_shutdown_lock_)), @@ -1598,4 +1600,9 @@ void Runtime::RecordWeakStringRemoval(mirror::String* s, uint32_t hash_code) con DCHECK(IsActiveTransaction()); preinitialization_transaction->RecordWeakStringRemoval(s, hash_code); } + +void Runtime::SetFaultMessage(const std::string& message) { + MutexLock mu(Thread::Current(), fault_message_lock_); + fault_message_ = message; +} } // namespace art |