diff options
author | Sebastien Hertz <shertz@google.com> | 2014-09-09 12:10:13 +0200 |
---|---|---|
committer | Sebastien Hertz <shertz@google.com> | 2014-09-18 14:31:54 +0200 |
commit | 6995c60cd6657c10811055c42661a55b10b47cef (patch) | |
tree | 6fc528bca6f0c6fb989f88cb6af6c4829e1da172 /runtime/debugger.h | |
parent | d41491adb23764f28a80cbb7f2bd7af6491cd892 (diff) | |
download | art-6995c60cd6657c10811055c42661a55b10b47cef.tar.gz art-6995c60cd6657c10811055c42661a55b10b47cef.tar.bz2 art-6995c60cd6657c10811055c42661a55b10b47cef.zip |
Update JDWP event filtering to avoid useless ids
To reduce the number of JDWP ids in the debugger, we update the event filtering
support to work with runtime objects (Thread, Class, Object, ...) instead of
JDWP ids (ThreadId, RefTypeId, ObjectId, ...).
We used to create useless JDWP ids for events even if they were not reported
because of event filtering (thread only, class only, instance only, ...). Now
we only create JDWP ids when we know we're going to report an event.
Bug: 17343664
(cherry picked from commit d539167b7f11136fe570a77aff2ee4935842007a)
Change-Id: I8619e219733fc2fa3569f473b7bd8d9af4181f2b
Diffstat (limited to 'runtime/debugger.h')
-rw-r--r-- | runtime/debugger.h | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/runtime/debugger.h b/runtime/debugger.h index e171d7854f..97985ec649 100644 --- a/runtime/debugger.h +++ b/runtime/debugger.h @@ -43,6 +43,8 @@ class Object; class Throwable; } // namespace mirror class AllocRecord; +class ObjectRegistry; +class ScopedObjectAccessUnchecked; class Thread; class ThrowLocation; @@ -250,6 +252,8 @@ class Dbg { */ static std::string GetClassName(JDWP::RefTypeId id) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + static std::string GetClassName(mirror::Class* klass) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static JDWP::JdwpError GetClassObject(JDWP::RefTypeId id, JDWP::ObjectId* class_object_id) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static JDWP::JdwpError GetSuperclass(JDWP::RefTypeId id, JDWP::RefTypeId* superclass_id) @@ -294,7 +298,24 @@ class Dbg { JDWP::ObjectId* new_array) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - static bool MatchType(JDWP::RefTypeId instance_class_id, JDWP::RefTypeId class_id) + // + // Event filtering. + // + static bool MatchThread(JDWP::ObjectId expected_thread_id, Thread* event_thread) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + static bool MatchLocation(const JDWP::JdwpLocation& expected_location, + const JDWP::EventLocation& event_location) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + static bool MatchType(mirror::Class* event_class, JDWP::RefTypeId class_id) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + static bool MatchField(JDWP::RefTypeId expected_type_id, JDWP::FieldId expected_field_id, + mirror::ArtField* event_field) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + static bool MatchInstance(JDWP::ObjectId expected_instance_id, mirror::Object* event_instance) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // @@ -431,8 +452,9 @@ class Dbg { LOCKS_EXCLUDED(Locks::thread_list_lock_) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - static JDWP::ObjectId GetThreadSelfId() - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + static JDWP::ObjectId GetThreadSelfId() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + static JDWP::ObjectId GetThreadId(Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + static void SuspendVM() LOCKS_EXCLUDED(Locks::thread_list_lock_, Locks::thread_suspend_count_lock_); @@ -602,6 +624,22 @@ class Dbg { static void DdmSendHeapSegments(bool native) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + static ObjectRegistry* GetObjectRegistry() { + return gRegistry; + } + + static JDWP::JdwpTag TagFromObject(const ScopedObjectAccessUnchecked& soa, mirror::Object* o) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + static JDWP::JdwpTypeTag GetTypeTag(mirror::Class* klass) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + static JDWP::FieldId ToFieldId(const mirror::ArtField* f) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + static void SetJdwpLocation(JDWP::JdwpLocation* location, mirror::ArtMethod* m, uint32_t dex_pc) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + private: static void DdmBroadcast(bool connect) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static void PostThreadStartOrStop(Thread*, uint32_t) @@ -612,9 +650,6 @@ class Dbg { const JValue* return_value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - static JDWP::ObjectId GetThisObjectIdForEvent(mirror::Object* this_object) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - static void ProcessDeoptimizationRequest(const DeoptimizationRequest& request) EXCLUSIVE_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -627,6 +662,8 @@ class Dbg { static size_t alloc_record_head_ GUARDED_BY(Locks::alloc_tracker_lock_); static size_t alloc_record_count_ GUARDED_BY(Locks::alloc_tracker_lock_); + static ObjectRegistry* gRegistry; + // Deoptimization requests to be processed each time the event list is updated. This is used when // registering and unregistering events so we do not deoptimize while holding the event list // lock. |