debugger.h revision f69863b3039fc621ff4250e262d2a024d5e79ec8
1872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes/* 2872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Copyright (C) 2008 The Android Open Source Project 3872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * 4872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Licensed under the Apache License, Version 2.0 (the "License"); 5872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * you may not use this file except in compliance with the License. 6872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * You may obtain a copy of the License at 7872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * 8872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 9872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * 10872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Unless required by applicable law or agreed to in writing, software 11872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 12872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * See the License for the specific language governing permissions and 14872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * limitations under the License. 15872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 16872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 17872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes/* 18872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Dalvik-specific side of debugger support. (The JDWP code is intended to 19872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * be relatively generic.) 20872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 21fc0e3219edc9a5bf81b166e82fd5db2796eb6a0dBrian Carlstrom#ifndef ART_RUNTIME_DEBUGGER_H_ 22fc0e3219edc9a5bf81b166e82fd5db2796eb6a0dBrian Carlstrom#define ART_RUNTIME_DEBUGGER_H_ 23872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 24872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes#include <pthread.h> 25872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 263bb81563481d02b5a6349b8ed918392454e761d8Elliott Hughes#include <string> 273bb81563481d02b5a6349b8ed918392454e761d8Elliott Hughes 28872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes#include "jdwp/jdwp.h" 292dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers#include "jni.h" 302dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers#include "jvalue.h" 312dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers#include "root_visitor.h" 32872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 33872d4ec7225444d9400d30f9027247deb91012fdElliott Hughesnamespace art { 342dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogersnamespace mirror { 352dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogersclass AbstractMethod; 362dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogersclass Class; 372dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogersclass Object; 382dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogersclass Throwable; 392dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers} // namespace mirror 40545a064aca775ba801790fced3d713d8a87bfc61Elliott Hughesstruct AllocRecord; 411b09b094a85e03f6ef5f687f58bb91c433273ba1Ian Rogersclass Thread; 4262d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogersclass ThrowLocation; 43872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 44872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes/* 45872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Invoke-during-breakpoint support. 46872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 47872d4ec7225444d9400d30f9027247deb91012fdElliott Hughesstruct DebugInvokeReq { 487b3cdfcca472b779cf8745fb8460935e56229f11Elliott Hughes DebugInvokeReq() 4900f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers : ready(false), invoke_needed_(false), 5000f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers receiver_(NULL), thread_(NULL), class_(NULL), method_(NULL), 5100f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers arg_count_(0), arg_values_(NULL), options_(0), error(JDWP::ERR_NONE), 5200f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers result_tag(JDWP::JT_VOID), exception(0), 539b5aa6f2029d3dae305009ac72e44ca97ca7b638jeffhao lock_("a DebugInvokeReq lock", kBreakpointInvokeLock), 54c604d731730b43231f63040c8db1d58304da0cf3Ian Rogers cond_("a DebugInvokeReq condition variable", lock_) { 55475fc23a4a7f35d1be87ea0b06c80df317a720acElliott Hughes } 56475fc23a4a7f35d1be87ea0b06c80df317a720acElliott Hughes 57872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes /* boolean; only set when we're in the tail end of an event handler */ 58872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes bool ready; 59872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 60872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes /* boolean; set if the JDWP thread wants this thread to do work */ 61d07986fad0d08cdf05505cf9230714a2cf0dd9aeElliott Hughes bool invoke_needed_; 62872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 63872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes /* request */ 642dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers mirror::Object* receiver_; /* not used for ClassType.InvokeMethod */ 652dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers mirror::Object* thread_; 662dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers mirror::Class* class_; 672dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers mirror::AbstractMethod* method_; 6845651fde99f52546e71241bb0e8a10d16a9f216aElliott Hughes uint32_t arg_count_; 6945651fde99f52546e71241bb0e8a10d16a9f216aElliott Hughes uint64_t* arg_values_; /* will be NULL if arg_count_ == 0 */ 70d07986fad0d08cdf05505cf9230714a2cf0dd9aeElliott Hughes uint32_t options_; 71872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 72872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes /* result */ 73475fc23a4a7f35d1be87ea0b06c80df317a720acElliott Hughes JDWP::JdwpError error; 74d07986fad0d08cdf05505cf9230714a2cf0dd9aeElliott Hughes JDWP::JdwpTag result_tag; 75475fc23a4a7f35d1be87ea0b06c80df317a720acElliott Hughes JValue result_value; 76475fc23a4a7f35d1be87ea0b06c80df317a720acElliott Hughes JDWP::ObjectId exception; 77872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 78872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes /* condition variable to wait on while the method executes */ 79c604d731730b43231f63040c8db1d58304da0cf3Ian Rogers Mutex lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; 80c604d731730b43231f63040c8db1d58304da0cf3Ian Rogers ConditionVariable cond_ GUARDED_BY(lock_); 81872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes}; 82872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 83872d4ec7225444d9400d30f9027247deb91012fdElliott Hughesclass Dbg { 84ff17f1fd3ff32f93e45588eb2b158832d73f9afaElliott Hughes public: 853bb81563481d02b5a6349b8ed918392454e761d8Elliott Hughes static bool ParseJdwpOptions(const std::string& options); 864ffd31315bc0d00ec278e85feed15985de5ac3dcElliott Hughes static void SetJdwpAllowed(bool allowed); 874ffd31315bc0d00ec278e85feed15985de5ac3dcElliott Hughes 88d1cc8363d4f4bbac7568b1d02a5ca481cd10830fElliott Hughes static void StartJdwp(); 89d1cc8363d4f4bbac7568b1d02a5ca481cd10830fElliott Hughes static void StopJdwp(); 90d1cc8363d4f4bbac7568b1d02a5ca481cd10830fElliott Hughes 91767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes // Invoked by the GC in case we need to keep DDMS informed. 92b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers static void GcDidFinish() LOCKS_EXCLUDED(Locks::mutator_lock_); 93767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes 94872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes // Return the DebugInvokeReq for the current thread. 95872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes static DebugInvokeReq* GetInvokeReq(); 96872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 97475fc23a4a7f35d1be87ea0b06c80df317a720acElliott Hughes static Thread* GetDebugThread(); 98475fc23a4a7f35d1be87ea0b06c80df317a720acElliott Hughes static void ClearWaitForEventThread(); 99475fc23a4a7f35d1be87ea0b06c80df317a720acElliott Hughes 100872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes /* 101872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Enable/disable breakpoints and step modes. Used to provide a heads-up 102872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * when the debugger attaches. 103872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 104872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes static void Connected(); 10562d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers static void GoActive() LOCKS_EXCLUDED(Locks::breakpoint_lock_, Locks::mutator_lock_); 10662d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers static void Disconnected() LOCKS_EXCLUDED(Locks::mutator_lock_); 1078696433d1b3d8ba15288483b777edd888de69135Elliott Hughes static void Disposed(); 108872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 109c0f0933249cf516b37717faa766e1e9808f7c1f8Elliott Hughes // Returns true if we're actually debugging with a real debugger, false if it's 110c0f0933249cf516b37717faa766e1e9808f7c1f8Elliott Hughes // just DDMS (or nothing at all). 111c0f0933249cf516b37717faa766e1e9808f7c1f8Elliott Hughes static bool IsDebuggerActive(); 112872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 113c0f0933249cf516b37717faa766e1e9808f7c1f8Elliott Hughes // Returns true if we had -Xrunjdwp or -agentlib:jdwp= on the command line. 114c0f0933249cf516b37717faa766e1e9808f7c1f8Elliott Hughes static bool IsJdwpConfigured(); 115872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 1168696433d1b3d8ba15288483b777edd888de69135Elliott Hughes static bool IsDisposed(); 1178696433d1b3d8ba15288483b777edd888de69135Elliott Hughes 118872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes /* 119872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Time, in milliseconds, since the last debugger activity. Does not 120872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * include DDMS activity. Returns -1 if there has been no activity. 121872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Returns 0 if we're in the middle of handling a debugger request. 122872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 123872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes static int64_t LastDebuggerActivity(); 124872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 125872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes static void UndoDebuggerSuspensions(); 126872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 127872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes /* 128872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Class, Object, Array 129872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 13000f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static std::string GetClassName(JDWP::RefTypeId id) 131b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 13288d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError GetClassObject(JDWP::RefTypeId id, JDWP::ObjectId& class_object_id) 133b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 13488d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError GetSuperclass(JDWP::RefTypeId id, JDWP::RefTypeId& superclass_id) 135b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 13600f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static JDWP::JdwpError GetClassLoader(JDWP::RefTypeId id, JDWP::ExpandBuf* pReply) 137b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 13800f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static JDWP::JdwpError GetModifiers(JDWP::RefTypeId id, JDWP::ExpandBuf* pReply) 139b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 14088d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError GetReflectedType(JDWP::RefTypeId class_id, JDWP::ExpandBuf* pReply) 141b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 14200f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static void GetClassList(std::vector<JDWP::RefTypeId>& classes) 143b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 14488d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError GetClassInfo(JDWP::RefTypeId class_id, JDWP::JdwpTypeTag* pTypeTag, 14500f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers uint32_t* pStatus, std::string* pDescriptor) 146b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 14700f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static void FindLoadedClassBySignature(const char* descriptor, std::vector<JDWP::RefTypeId>& ids) 148b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 14964f574f474aa77c72778640ab21f8cfa72546812Elliott Hughes static JDWP::JdwpError GetReferenceType(JDWP::ObjectId object_id, JDWP::ExpandBuf* pReply) 15064f574f474aa77c72778640ab21f8cfa72546812Elliott Hughes SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 15188d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError GetSignature(JDWP::RefTypeId ref_type_id, std::string& signature) 152b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 15388d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError GetSourceFile(JDWP::RefTypeId ref_type_id, std::string& source_file) 154b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 15588d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError GetObjectTag(JDWP::ObjectId object_id, uint8_t& tag) 156b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 157aed4be94da51b4fbb54c728151f0daf11535f6abElliott Hughes static size_t GetTagWidth(JDWP::JdwpTag tag); 158872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 15988d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError GetArrayLength(JDWP::ObjectId array_id, int& length) 160b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 16188d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError OutputArray(JDWP::ObjectId array_id, int offset, int count, 16200f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::ExpandBuf* pReply) 163b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 16488d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError SetArrayElements(JDWP::ObjectId array_id, int offset, int count, 1654b9702c6912c6f8745a77f5b5af56e7fe196e7c2Elliott Hughes JDWP::Request& request) 166b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 16700f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers 16800f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static JDWP::ObjectId CreateString(const std::string& str) 169b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 17088d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError CreateObject(JDWP::RefTypeId class_id, JDWP::ObjectId& new_object) 171b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 17288d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError CreateArrayObject(JDWP::RefTypeId array_class_id, uint32_t length, 17300f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::ObjectId& new_array) 174b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 17500f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers 17688d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static bool MatchType(JDWP::RefTypeId instance_class_id, JDWP::RefTypeId class_id) 177b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 178872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 179ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes // 180ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes // Monitors. 181ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes // 182ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes static JDWP::JdwpError GetMonitorInfo(JDWP::ObjectId object_id, JDWP::ExpandBuf* reply) 183ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 184ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes static JDWP::JdwpError GetOwnedMonitors(JDWP::ObjectId thread_id, 185ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes std::vector<JDWP::ObjectId>& monitors, 186ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes std::vector<uint32_t>& stack_depths) 187ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 188ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes static JDWP::JdwpError GetContendedMonitor(JDWP::ObjectId thread_id, JDWP::ObjectId& contended_monitor) 189ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 190ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes 191ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes // 192ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes // Heap. 193ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes // 194ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes static JDWP::JdwpError GetInstanceCounts(const std::vector<JDWP::RefTypeId>& class_ids, 195ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes std::vector<uint64_t>& counts) 196ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 1973b78c949ab839d21454bc6f18c7640d2ae8c22f3Elliott Hughes static JDWP::JdwpError GetInstances(JDWP::RefTypeId class_id, int32_t max_count, 1983b78c949ab839d21454bc6f18c7640d2ae8c22f3Elliott Hughes std::vector<JDWP::ObjectId>& instances) 1993b78c949ab839d21454bc6f18c7640d2ae8c22f3Elliott Hughes SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 2000cbaff584244ee767027aff35cd3c625aaee2994Elliott Hughes static JDWP::JdwpError GetReferringObjects(JDWP::ObjectId object_id, int32_t max_count, 2010cbaff584244ee767027aff35cd3c625aaee2994Elliott Hughes std::vector<JDWP::ObjectId>& referring_objects) 2020cbaff584244ee767027aff35cd3c625aaee2994Elliott Hughes SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 20364f574f474aa77c72778640ab21f8cfa72546812Elliott Hughes static JDWP::JdwpError DisableCollection(JDWP::ObjectId object_id) 20464f574f474aa77c72778640ab21f8cfa72546812Elliott Hughes SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 20564f574f474aa77c72778640ab21f8cfa72546812Elliott Hughes static JDWP::JdwpError EnableCollection(JDWP::ObjectId object_id) 20664f574f474aa77c72778640ab21f8cfa72546812Elliott Hughes SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 20764f574f474aa77c72778640ab21f8cfa72546812Elliott Hughes static JDWP::JdwpError IsCollected(JDWP::ObjectId object_id, bool& is_collected) 20864f574f474aa77c72778640ab21f8cfa72546812Elliott Hughes SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 20964f574f474aa77c72778640ab21f8cfa72546812Elliott Hughes static void DisposeObject(JDWP::ObjectId object_id, uint32_t reference_count) 21064f574f474aa77c72778640ab21f8cfa72546812Elliott Hughes SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 211ec0f83d95e2174c97e93279ffa71642be7e12b60Elliott Hughes 2129777ba230c83a0edcbda2cf7b208339e77bf171bElliott Hughes // 2139777ba230c83a0edcbda2cf7b208339e77bf171bElliott Hughes // Methods and fields. 2149777ba230c83a0edcbda2cf7b208339e77bf171bElliott Hughes // 215a96836a4115ad08762567c10bd4d198c5b644985Elliott Hughes static std::string GetMethodName(JDWP::MethodId method_id) 216b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 21788d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError OutputDeclaredFields(JDWP::RefTypeId ref_type_id, bool with_generic, 21800f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::ExpandBuf* pReply) 219b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 22088d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError OutputDeclaredMethods(JDWP::RefTypeId ref_type_id, bool with_generic, 22100f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::ExpandBuf* pReply) 222b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 22388d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError OutputDeclaredInterfaces(JDWP::RefTypeId ref_type_id, 22400f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::ExpandBuf* pReply) 225b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 22688d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static void OutputLineTable(JDWP::RefTypeId ref_type_id, JDWP::MethodId method_id, 22700f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::ExpandBuf* pReply) 228b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 22988d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static void OutputVariableTable(JDWP::RefTypeId ref_type_id, JDWP::MethodId id, bool with_generic, 23000f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::ExpandBuf* pReply) 231b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 2329777ba230c83a0edcbda2cf7b208339e77bf171bElliott Hughes static JDWP::JdwpError GetBytecodes(JDWP::RefTypeId class_id, JDWP::MethodId method_id, 2339777ba230c83a0edcbda2cf7b208339e77bf171bElliott Hughes std::vector<uint8_t>& bytecodes) 2349777ba230c83a0edcbda2cf7b208339e77bf171bElliott Hughes SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 23500f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers 236a96836a4115ad08762567c10bd4d198c5b644985Elliott Hughes static std::string GetFieldName(JDWP::FieldId field_id) 237a96836a4115ad08762567c10bd4d198c5b644985Elliott Hughes SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 23888d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpTag GetFieldBasicTag(JDWP::FieldId field_id) 239b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 24088d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpTag GetStaticFieldBasicTag(JDWP::FieldId field_id) 241f69863b3039fc621ff4250e262d2a024d5e79ec8Brian Carlstrom SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 24288d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError GetFieldValue(JDWP::ObjectId object_id, JDWP::FieldId field_id, 24300f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::ExpandBuf* pReply) 244b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 24588d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError SetFieldValue(JDWP::ObjectId object_id, JDWP::FieldId field_id, 24600f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers uint64_t value, int width) 247b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 24888d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError GetStaticFieldValue(JDWP::RefTypeId ref_type_id, JDWP::FieldId field_id, 24900f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::ExpandBuf* pReply) 250b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 25188d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError SetStaticFieldValue(JDWP::FieldId field_id, uint64_t value, int width) 252b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 25300f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers 25488d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static std::string StringToUtf8(JDWP::ObjectId string_id) 255b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 256872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 257872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes /* 258872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Thread, ThreadGroup, Frame 259872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 26088d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError GetThreadName(JDWP::ObjectId thread_id, std::string& name) 261b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) 262b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers LOCKS_EXCLUDED(Locks::thread_list_lock_); 26388d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError GetThreadGroup(JDWP::ObjectId thread_id, JDWP::ExpandBuf* pReply); 26488d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static std::string GetThreadGroupName(JDWP::ObjectId thread_group_id); 26588d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::ObjectId GetThreadGroupParent(JDWP::ObjectId thread_group_id) 266b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 26700f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static JDWP::ObjectId GetSystemThreadGroupId() 268b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 269872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes static JDWP::ObjectId GetMainThreadGroupId(); 270872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 27188d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError GetThreadStatus(JDWP::ObjectId thread_id, JDWP::JdwpThreadStatus* pThreadStatus, JDWP::JdwpSuspendStatus* pSuspendStatus); 27288d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError GetThreadDebugSuspendCount(JDWP::ObjectId thread_id, JDWP::ExpandBuf* pReply); 27388d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes //static void WaitForSuspend(JDWP::ObjectId thread_id); 274caf7654a0e6c76c7489970b1a246fccf220f9982Elliott Hughes 275026b14660723c2b25a4f3ef6394f43a4fe64ba92Elliott Hughes // Fills 'thread_ids' with the threads in the given thread group. If thread_group_id == 0, 276caf7654a0e6c76c7489970b1a246fccf220f9982Elliott Hughes // returns all threads. 27700f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static void GetThreads(JDWP::ObjectId thread_group_id, std::vector<JDWP::ObjectId>& thread_ids) 278b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers LOCKS_EXCLUDED(Locks::thread_list_lock_) 279b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 280caf7654a0e6c76c7489970b1a246fccf220f9982Elliott Hughes static void GetChildThreadGroups(JDWP::ObjectId thread_group_id, std::vector<JDWP::ObjectId>& child_thread_group_ids); 281caf7654a0e6c76c7489970b1a246fccf220f9982Elliott Hughes 28288d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError GetThreadFrameCount(JDWP::ObjectId thread_id, size_t& result); 28300f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static JDWP::JdwpError GetThreadFrames(JDWP::ObjectId thread_id, size_t start_frame, 28400f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers size_t frame_count, JDWP::ExpandBuf* buf) 285b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 28600f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers 28700f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static JDWP::ObjectId GetThreadSelfId() 288b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 28900f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static void SuspendVM() 290b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers LOCKS_EXCLUDED(Locks::thread_list_lock_, 291b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers Locks::thread_suspend_count_lock_); 292872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes static void ResumeVM(); 29388d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError SuspendThread(JDWP::ObjectId thread_id, bool request_suspension = true) 294b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers LOCKS_EXCLUDED(Locks::mutator_lock_, 295b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers Locks::thread_list_lock_, 296b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers Locks::thread_suspend_count_lock_); 29700f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers 29888d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static void ResumeThread(JDWP::ObjectId thread_id) 299b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers LOCKS_EXCLUDED(Locks::thread_list_lock_, 300b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers Locks::thread_suspend_count_lock_) 301b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 302872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes static void SuspendSelf(); 303872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 30400f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static JDWP::JdwpError GetThisObject(JDWP::ObjectId thread_id, JDWP::FrameId frame_id, 30500f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::ObjectId* result) 306b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers LOCKS_EXCLUDED(Locks::thread_list_lock_, 307b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers Locks::thread_suspend_count_lock_) 308b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 30988d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static void GetLocalValue(JDWP::ObjectId thread_id, JDWP::FrameId frame_id, int slot, 31000f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::JdwpTag tag, uint8_t* buf, size_t expectedLen) 311b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 31288d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static void SetLocalValue(JDWP::ObjectId thread_id, JDWP::FrameId frame_id, int slot, 31300f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::JdwpTag tag, uint64_t value, size_t width) 314b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 315872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 316f9501700f51586cb6ba7cc0ffcb5a920bd64adf1Elliott Hughes static JDWP::JdwpError Interrupt(JDWP::ObjectId thread_id); 317f9501700f51586cb6ba7cc0ffcb5a920bd64adf1Elliott Hughes 318872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes /* 319872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Debugger notification 320872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 321872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes enum { 3228696433d1b3d8ba15288483b777edd888de69135Elliott Hughes kBreakpoint = 0x01, 323872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes kSingleStep = 0x02, 324872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes kMethodEntry = 0x04, 325872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes kMethodExit = 0x08, 326872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes }; 3272dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers static void PostLocationEvent(const mirror::AbstractMethod* method, int pcOffset, 3282dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers mirror::Object* thisPtr, int eventFlags) 329b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 33062d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers static void PostException(Thread* thread, const ThrowLocation& throw_location, 33162d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers mirror::AbstractMethod* catch_method, 3322dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers uint32_t catch_dex_pc, mirror::Throwable* exception) 333b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 33400f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static void PostThreadStart(Thread* t) 335b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 33600f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static void PostThreadDeath(Thread* t) 337b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 3382dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers static void PostClassPrepare(mirror::Class* c) 339b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 34000f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers 34162d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers static void UpdateDebugger(Thread* thread, mirror::Object* this_object, 34262d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers const mirror::AbstractMethod* method, uint32_t new_dex_pc) 34309bfc6a50bdc9366b13ac3ab479d9278c853d90ajeffhao LOCKS_EXCLUDED(Locks::breakpoint_lock_) 344b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 34500f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers 34600f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static void WatchLocation(const JDWP::JdwpLocation* pLoc) 34709bfc6a50bdc9366b13ac3ab479d9278c853d90ajeffhao LOCKS_EXCLUDED(Locks::breakpoint_lock_) 348b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 34900f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static void UnwatchLocation(const JDWP::JdwpLocation* pLoc) 35009bfc6a50bdc9366b13ac3ab479d9278c853d90ajeffhao LOCKS_EXCLUDED(Locks::breakpoint_lock_) 351b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 35288d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError ConfigureStep(JDWP::ObjectId thread_id, JDWP::JdwpStepSize size, 35300f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::JdwpStepDepth depth) 35409bfc6a50bdc9366b13ac3ab479d9278c853d90ajeffhao LOCKS_EXCLUDED(Locks::breakpoint_lock_) 355b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 35688d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static void UnconfigureStep(JDWP::ObjectId thread_id) LOCKS_EXCLUDED(Locks::breakpoint_lock_); 357872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 35888d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes static JDWP::JdwpError InvokeMethod(JDWP::ObjectId thread_id, JDWP::ObjectId object_id, 35988d630950cb5c6a1cb6457ce03a17c074ae13628Elliott Hughes JDWP::RefTypeId class_id, JDWP::MethodId method_id, 36000f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers uint32_t arg_count, uint64_t* arg_values, 36100f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::JdwpTag* arg_types, uint32_t options, 36200f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::JdwpTag* pResultTag, uint64_t* pResultValue, 36300f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers JDWP::ObjectId* pExceptObj) 364b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers LOCKS_EXCLUDED(Locks::thread_list_lock_, 365b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers Locks::thread_suspend_count_lock_) 366b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 367872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes static void ExecuteMethod(DebugInvokeReq* pReq); 368872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 369872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes /* 370872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * DDM support. 371872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 37200f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static void DdmSendThreadNotification(Thread* t, uint32_t type) 373b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 37447fce01c0f27dba716fa6b97242562fbc5c26eeaElliott Hughes static void DdmSetThreadNotification(bool enable); 3754b9702c6912c6f8745a77f5b5af56e7fe196e7c2Elliott Hughes static bool DdmHandlePacket(JDWP::Request& request, uint8_t** pReplyBuf, int* pReplyLen); 376b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers static void DdmConnected() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 377b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers static void DdmDisconnected() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 37800f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static void DdmSendChunk(uint32_t type, const std::vector<uint8_t>& bytes) 379b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 38000f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static void DdmSendChunk(uint32_t type, size_t len, const uint8_t* buf) 381b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 38200f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static void DdmSendChunkV(uint32_t type, const iovec* iov, int iov_count) 383b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 384767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes 385545a064aca775ba801790fced3d713d8a87bfc61Elliott Hughes /* 386545a064aca775ba801790fced3d713d8a87bfc61Elliott Hughes * Recent allocation tracking support. 387545a064aca775ba801790fced3d713d8a87bfc61Elliott Hughes */ 3882dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers static void RecordAllocation(mirror::Class* type, size_t byte_count) 389b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 390545a064aca775ba801790fced3d713d8a87bfc61Elliott Hughes static void SetAllocTrackingEnabled(bool enabled); 391545a064aca775ba801790fced3d713d8a87bfc61Elliott Hughes static inline bool IsAllocTrackingEnabled() { return recent_allocation_records_ != NULL; } 3922dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers static jbyteArray GetRecentAllocations() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 393545a064aca775ba801790fced3d713d8a87bfc61Elliott Hughes static void DumpRecentAllocations(); 394545a064aca775ba801790fced3d713d8a87bfc61Elliott Hughes 395767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes enum HpifWhen { 396767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes HPIF_WHEN_NEVER = 0, 397767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes HPIF_WHEN_NOW = 1, 398767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes HPIF_WHEN_NEXT_GC = 2, 399767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes HPIF_WHEN_EVERY_GC = 3 400767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes }; 40100f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static int DdmHandleHpifChunk(HpifWhen when) 402b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 403767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes 404767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes enum HpsgWhen { 405767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes HPSG_WHEN_NEVER = 0, 406767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes HPSG_WHEN_EVERY_GC = 1, 407767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes }; 408767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes enum HpsgWhat { 409767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes HPSG_WHAT_MERGED_OBJECTS = 0, 410767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes HPSG_WHAT_DISTINCT_OBJECTS = 1, 411767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes }; 412767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes static bool DdmHandleHpsgNhsgChunk(HpsgWhen when, HpsgWhat what, bool native); 413767a147529da3ee8240f3ce4cd3af22ae454be64Elliott Hughes 41400f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static void DdmSendHeapInfo(HpifWhen reason) 415b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 41600f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static void DdmSendHeapSegments(bool native) 417b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 418545a064aca775ba801790fced3d713d8a87bfc61Elliott Hughes 419545a064aca775ba801790fced3d713d8a87bfc61Elliott Hughes private: 420b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers static void DdmBroadcast(bool) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 42100f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers static void PostThreadStartOrStop(Thread*, uint32_t) 422b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 423a215526d5c789cbef0f81a1f9aba22541a841ccaElliott Hughes 424545a064aca775ba801790fced3d713d8a87bfc61Elliott Hughes static AllocRecord* recent_allocation_records_; 425872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes}; 426872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 427872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes#define CHUNK_TYPE(_name) \ 4288218847294600bbfcdc041a46c2b579b6e70cf3bElliott Hughes static_cast<uint32_t>((_name)[0] << 24 | (_name)[1] << 16 | (_name)[2] << 8 | (_name)[3]) 429872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 430872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes} // namespace art 431872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 432fc0e3219edc9a5bf81b166e82fd5db2796eb6a0dBrian Carlstrom#endif // ART_RUNTIME_DEBUGGER_H_ 433