blob: 5d0315e9a19213e07bd2387222d61daa923bd109 [file] [log] [blame]
Elliott Hughes872d4ec2011-10-21 17:07:15 -07001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * Dalvik-specific side of debugger support. (The JDWP code is intended to
19 * be relatively generic.)
20 */
Brian Carlstromfc0e3212013-07-17 14:40:12 -070021#ifndef ART_RUNTIME_DEBUGGER_H_
22#define ART_RUNTIME_DEBUGGER_H_
Elliott Hughes872d4ec2011-10-21 17:07:15 -070023
24#include <pthread.h>
25
Sebastien Hertz61b7f1b2013-11-15 15:59:30 +010026#include <set>
Elliott Hughes3bb81562011-10-21 18:52:59 -070027#include <string>
Sebastien Hertz4d25df32014-03-21 17:44:46 +010028#include <vector>
Elliott Hughes3bb81562011-10-21 18:52:59 -070029
Mathieu Chartiere34fa1d2015-01-14 14:55:47 -080030#include "gc_root.h"
Elliott Hughes872d4ec2011-10-21 17:07:15 -070031#include "jdwp/jdwp.h"
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080032#include "jni.h"
33#include "jvalue.h"
Mathieu Chartier3398c782016-09-30 10:27:43 -070034#include "obj_ptr.h"
Mingyao Yang99170c62015-07-06 11:10:37 -070035#include "thread.h"
Jeff Hao920af3e2013-08-28 15:46:38 -070036#include "thread_state.h"
Elliott Hughes872d4ec2011-10-21 17:07:15 -070037
38namespace art {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080039namespace mirror {
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080040class Class;
41class Object;
42class Throwable;
43} // namespace mirror
Mathieu Chartierc7853442015-03-27 14:35:38 -070044class ArtField;
Mathieu Chartiere401d142015-04-22 13:56:20 -070045class ArtMethod;
Sebastien Hertz6995c602014-09-09 12:10:13 +020046class ObjectRegistry;
Sebastien Hertzcbc50642015-06-01 17:33:12 +020047class ScopedObjectAccess;
Sebastien Hertz6995c602014-09-09 12:10:13 +020048class ScopedObjectAccessUnchecked;
Sebastien Hertz8009f392014-09-01 17:07:11 +020049class StackVisitor;
Ian Rogers1b09b092012-08-20 15:35:52 -070050class Thread;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070051
52/*
53 * Invoke-during-breakpoint support.
54 */
55struct DebugInvokeReq {
Sebastien Hertzcbc50642015-06-01 17:33:12 +020056 DebugInvokeReq(uint32_t invoke_request_id, JDWP::ObjectId invoke_thread_id,
57 mirror::Object* invoke_receiver, mirror::Class* invoke_class,
Mathieu Chartiere401d142015-04-22 13:56:20 -070058 ArtMethod* invoke_method, uint32_t invoke_options,
Sebastien Hertzcbc50642015-06-01 17:33:12 +020059 uint64_t args[], uint32_t args_count)
60 : request_id(invoke_request_id), thread_id(invoke_thread_id), receiver(invoke_receiver),
61 klass(invoke_class), method(invoke_method), arg_count(args_count), arg_values(args),
62 options(invoke_options), reply(JDWP::expandBufAlloc()) {
Elliott Hughes475fc232011-10-25 15:00:35 -070063 }
64
Sebastien Hertzcbc50642015-06-01 17:33:12 +020065 ~DebugInvokeReq() {
66 JDWP::expandBufFree(reply);
67 }
68
69 // Request
70 const uint32_t request_id;
71 const JDWP::ObjectId thread_id;
72 GcRoot<mirror::Object> receiver; // not used for ClassType.InvokeMethod.
Sebastien Hertz1558b572015-02-25 15:05:59 +010073 GcRoot<mirror::Class> klass;
Sebastien Hertzcbc50642015-06-01 17:33:12 +020074 ArtMethod* const method;
Sebastien Hertz1558b572015-02-25 15:05:59 +010075 const uint32_t arg_count;
Sebastien Hertzcbc50642015-06-01 17:33:12 +020076 std::unique_ptr<uint64_t[]> arg_values; // will be null if arg_count_ == 0. We take ownership
77 // of this array so we must delete it upon destruction.
Sebastien Hertz1558b572015-02-25 15:05:59 +010078 const uint32_t options;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070079
Sebastien Hertzcbc50642015-06-01 17:33:12 +020080 // Reply
81 JDWP::ExpandBuf* const reply;
Sebastien Hertz61b7f1b2013-11-15 15:59:30 +010082
Mathieu Chartierbb87e0f2015-04-03 11:21:55 -070083 void VisitRoots(RootVisitor* visitor, const RootInfo& root_info)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -070084 REQUIRES_SHARED(Locks::mutator_lock_);
Mathieu Chartier3b05e9b2014-03-25 09:29:43 -070085
Sebastien Hertz61b7f1b2013-11-15 15:59:30 +010086 private:
87 DISALLOW_COPY_AND_ASSIGN(DebugInvokeReq);
88};
89
90// Thread local data-structure that holds fields for controlling single-stepping.
Sebastien Hertz597c4f02015-01-26 17:37:14 +010091class SingleStepControl {
92 public:
93 SingleStepControl(JDWP::JdwpStepSize step_size, JDWP::JdwpStepDepth step_depth,
Mathieu Chartiere401d142015-04-22 13:56:20 -070094 int stack_depth, ArtMethod* method)
Sebastien Hertz597c4f02015-01-26 17:37:14 +010095 : step_size_(step_size), step_depth_(step_depth),
96 stack_depth_(stack_depth), method_(method) {
Sebastien Hertz61b7f1b2013-11-15 15:59:30 +010097 }
98
Sebastien Hertz597c4f02015-01-26 17:37:14 +010099 JDWP::JdwpStepSize GetStepSize() const {
100 return step_size_;
101 }
Sebastien Hertz61b7f1b2013-11-15 15:59:30 +0100102
Sebastien Hertz597c4f02015-01-26 17:37:14 +0100103 JDWP::JdwpStepDepth GetStepDepth() const {
104 return step_depth_;
105 }
106
107 int GetStackDepth() const {
108 return stack_depth_;
109 }
110
Mathieu Chartiere401d142015-04-22 13:56:20 -0700111 ArtMethod* GetMethod() const {
112 return method_;
Sebastien Hertz597c4f02015-01-26 17:37:14 +0100113 }
114
115 const std::set<uint32_t>& GetDexPcs() const {
116 return dex_pcs_;
117 }
118
Sebastien Hertz597c4f02015-01-26 17:37:14 +0100119 void AddDexPc(uint32_t dex_pc);
120
121 bool ContainsDexPc(uint32_t dex_pc) const;
122
123 private:
Sebastien Hertz61b7f1b2013-11-15 15:59:30 +0100124 // See JdwpStepSize and JdwpStepDepth for details.
Sebastien Hertz597c4f02015-01-26 17:37:14 +0100125 const JDWP::JdwpStepSize step_size_;
126 const JDWP::JdwpStepDepth step_depth_;
127
128 // The stack depth when this single-step was initiated. This is used to support SD_OVER and SD_OUT
129 // single-step depth.
130 const int stack_depth_;
Sebastien Hertz61b7f1b2013-11-15 15:59:30 +0100131
132 // The location this single-step was initiated from.
133 // A single-step is initiated in a suspended thread. We save here the current method and the
134 // set of DEX pcs associated to the source line number where the suspension occurred.
135 // This is used to support SD_INTO and SD_OVER single-step depths so we detect when a single-step
136 // causes the execution of an instruction in a different method or at a different line number.
Mathieu Chartiere401d142015-04-22 13:56:20 -0700137 ArtMethod* method_;
138
Sebastien Hertz597c4f02015-01-26 17:37:14 +0100139 std::set<uint32_t> dex_pcs_;
Sebastien Hertz61b7f1b2013-11-15 15:59:30 +0100140
Sebastien Hertz61b7f1b2013-11-15 15:59:30 +0100141 DISALLOW_COPY_AND_ASSIGN(SingleStepControl);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700142};
143
Sebastien Hertz42cd43f2014-05-13 14:15:41 +0200144// TODO rename to InstrumentationRequest.
Hiroshi Yamauchi0ec17d22014-07-07 13:07:08 -0700145class DeoptimizationRequest {
146 public:
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100147 enum Kind {
148 kNothing, // no action.
Sebastien Hertz42cd43f2014-05-13 14:15:41 +0200149 kRegisterForEvent, // start listening for instrumentation event.
150 kUnregisterForEvent, // stop listening for instrumentation event.
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100151 kFullDeoptimization, // deoptimize everything.
152 kFullUndeoptimization, // undeoptimize everything.
153 kSelectiveDeoptimization, // deoptimize one method.
154 kSelectiveUndeoptimization // undeoptimize one method.
155 };
156
Hiroshi Yamauchi0ec17d22014-07-07 13:07:08 -0700157 DeoptimizationRequest() : kind_(kNothing), instrumentation_event_(0), method_(nullptr) {}
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100158
Hiroshi Yamauchi0ec17d22014-07-07 13:07:08 -0700159 DeoptimizationRequest(const DeoptimizationRequest& other)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700160 REQUIRES_SHARED(Locks::mutator_lock_)
Hiroshi Yamauchi0ec17d22014-07-07 13:07:08 -0700161 : kind_(other.kind_), instrumentation_event_(other.instrumentation_event_) {
162 // Create a new JNI global reference for the method.
163 SetMethod(other.Method());
164 }
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100165
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700166 ArtMethod* Method() const REQUIRES_SHARED(Locks::mutator_lock_);
Hiroshi Yamauchi0ec17d22014-07-07 13:07:08 -0700167
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700168 void SetMethod(ArtMethod* m) REQUIRES_SHARED(Locks::mutator_lock_);
Hiroshi Yamauchi0ec17d22014-07-07 13:07:08 -0700169
170 // Name 'Kind()' would collide with the above enum name.
171 Kind GetKind() const {
172 return kind_;
173 }
174
175 void SetKind(Kind kind) {
176 kind_ = kind;
177 }
178
179 uint32_t InstrumentationEvent() const {
180 return instrumentation_event_;
181 }
182
183 void SetInstrumentationEvent(uint32_t instrumentation_event) {
184 instrumentation_event_ = instrumentation_event;
185 }
186
187 private:
188 Kind kind_;
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100189
Sebastien Hertz42cd43f2014-05-13 14:15:41 +0200190 // TODO we could use a union to hold the instrumentation_event and the method since they
191 // respectively have sense only for kRegisterForEvent/kUnregisterForEvent and
192 // kSelectiveDeoptimization/kSelectiveUndeoptimization.
193
194 // Event to start or stop listening to. Only for kRegisterForEvent and kUnregisterForEvent.
Hiroshi Yamauchi0ec17d22014-07-07 13:07:08 -0700195 uint32_t instrumentation_event_;
Sebastien Hertz42cd43f2014-05-13 14:15:41 +0200196
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100197 // Method for selective deoptimization.
Hiroshi Yamauchi0ec17d22014-07-07 13:07:08 -0700198 jmethodID method_;
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100199};
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700200std::ostream& operator<<(std::ostream& os, const DeoptimizationRequest::Kind& rhs);
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100201
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700202class Dbg {
Elliott Hughesff17f1f2012-01-24 18:12:29 -0800203 public:
Elliott Hughes4ffd3132011-10-24 12:06:42 -0700204 static void SetJdwpAllowed(bool allowed);
205
Sebastien Hertzb3b173b2015-02-06 09:16:32 +0100206 static void StartJdwp();
Elliott Hughesd1cc8362011-10-24 16:58:50 -0700207 static void StopJdwp();
208
Elliott Hughes767a1472011-10-26 18:49:02 -0700209 // Invoked by the GC in case we need to keep DDMS informed.
Mathieu Chartier90443472015-07-16 20:32:27 -0700210 static void GcDidFinish() REQUIRES(!Locks::mutator_lock_);
Elliott Hughes767a1472011-10-26 18:49:02 -0700211
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700212 // Return the DebugInvokeReq for the current thread.
213 static DebugInvokeReq* GetInvokeReq();
214
Elliott Hughes475fc232011-10-25 15:00:35 -0700215 static Thread* GetDebugThread();
216 static void ClearWaitForEventThread();
217
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700218 /*
219 * Enable/disable breakpoints and step modes. Used to provide a heads-up
220 * when the debugger attaches.
221 */
222 static void Connected();
Sebastien Hertz138dbfc2013-12-04 18:15:25 +0100223 static void GoActive()
Mathieu Chartier90443472015-07-16 20:32:27 -0700224 REQUIRES(!Locks::breakpoint_lock_, !Locks::deoptimization_lock_, !Locks::mutator_lock_);
225 static void Disconnected() REQUIRES(!Locks::deoptimization_lock_, !Locks::mutator_lock_);
Sebastien Hertz4e5b2082015-03-24 19:03:40 +0100226 static void Dispose() {
227 gDisposed = true;
228 }
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700229
Elliott Hughesc0f09332012-03-26 13:27:06 -0700230 // Returns true if we're actually debugging with a real debugger, false if it's
231 // just DDMS (or nothing at all).
Daniel Mihalyieb076692014-08-22 17:33:31 +0200232 static bool IsDebuggerActive() {
233 return gDebuggerActive;
234 }
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700235
Sebastien Hertzb3b173b2015-02-06 09:16:32 +0100236 // Configures JDWP with parsed command-line options.
237 static void ConfigureJdwp(const JDWP::JdwpOptions& jdwp_options);
238
Elliott Hughesc0f09332012-03-26 13:27:06 -0700239 // Returns true if we had -Xrunjdwp or -agentlib:jdwp= on the command line.
240 static bool IsJdwpConfigured();
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700241
Mathieu Chartierd8565452015-03-26 09:41:50 -0700242 // Returns true if a method has any breakpoints.
Mathieu Chartiere401d142015-04-22 13:56:20 -0700243 static bool MethodHasAnyBreakpoints(ArtMethod* method)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700244 REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Locks::breakpoint_lock_);
Mathieu Chartierd8565452015-03-26 09:41:50 -0700245
Sebastien Hertz4e5b2082015-03-24 19:03:40 +0100246 static bool IsDisposed() {
247 return gDisposed;
248 }
Elliott Hughes86964332012-02-15 19:37:42 -0800249
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700250 /*
251 * Time, in milliseconds, since the last debugger activity. Does not
252 * include DDMS activity. Returns -1 if there has been no activity.
253 * Returns 0 if we're in the middle of handling a debugger request.
254 */
255 static int64_t LastDebuggerActivity();
256
Sebastien Hertz253fa552014-10-14 17:27:15 +0200257 static void UndoDebuggerSuspensions()
Mathieu Chartier90443472015-07-16 20:32:27 -0700258 REQUIRES(!Locks::thread_list_lock_, !Locks::thread_suspend_count_lock_);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700259
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700260 /*
261 * Class, Object, Array
262 */
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700263 static std::string GetClassName(JDWP::RefTypeId id)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700264 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz6995c602014-09-09 12:10:13 +0200265 static std::string GetClassName(mirror::Class* klass)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700266 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogersc0542af2014-09-03 16:16:56 -0700267 static JDWP::JdwpError GetClassObject(JDWP::RefTypeId id, JDWP::ObjectId* class_object_id)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700268 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogersc0542af2014-09-03 16:16:56 -0700269 static JDWP::JdwpError GetSuperclass(JDWP::RefTypeId id, JDWP::RefTypeId* superclass_id)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700270 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700271 static JDWP::JdwpError GetClassLoader(JDWP::RefTypeId id, JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700272 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700273 static JDWP::JdwpError GetModifiers(JDWP::RefTypeId id, JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700274 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800275 static JDWP::JdwpError GetReflectedType(JDWP::RefTypeId class_id, JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700276 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogersc0542af2014-09-03 16:16:56 -0700277 static void GetClassList(std::vector<JDWP::RefTypeId>* classes)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700278 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800279 static JDWP::JdwpError GetClassInfo(JDWP::RefTypeId class_id, JDWP::JdwpTypeTag* pTypeTag,
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700280 uint32_t* pStatus, std::string* pDescriptor)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700281 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogersc0542af2014-09-03 16:16:56 -0700282 static void FindLoadedClassBySignature(const char* descriptor, std::vector<JDWP::RefTypeId>* ids)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700283 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes64f574f2013-02-20 14:57:12 -0800284 static JDWP::JdwpError GetReferenceType(JDWP::ObjectId object_id, JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700285 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogersfc0e94b2013-09-23 23:51:32 -0700286 static JDWP::JdwpError GetSignature(JDWP::RefTypeId ref_type_id, std::string* signature)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700287 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogersc0542af2014-09-03 16:16:56 -0700288 static JDWP::JdwpError GetSourceFile(JDWP::RefTypeId ref_type_id, std::string* source_file)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700289 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogersc0542af2014-09-03 16:16:56 -0700290 static JDWP::JdwpError GetObjectTag(JDWP::ObjectId object_id, uint8_t* tag)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700291 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughesaed4be92011-12-02 16:16:23 -0800292 static size_t GetTagWidth(JDWP::JdwpTag tag);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700293
Ian Rogersc0542af2014-09-03 16:16:56 -0700294 static JDWP::JdwpError GetArrayLength(JDWP::ObjectId array_id, int32_t* length)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700295 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800296 static JDWP::JdwpError OutputArray(JDWP::ObjectId array_id, int offset, int count,
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700297 JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700298 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800299 static JDWP::JdwpError SetArrayElements(JDWP::ObjectId array_id, int offset, int count,
Ian Rogersc0542af2014-09-03 16:16:56 -0700300 JDWP::Request* request)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700301 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700302
Sebastien Hertz2c3e77a2015-04-02 16:26:48 +0200303 static JDWP::JdwpError CreateString(const std::string& str, JDWP::ObjectId* new_string_id)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700304 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz2c3e77a2015-04-02 16:26:48 +0200305 static JDWP::JdwpError CreateObject(JDWP::RefTypeId class_id, JDWP::ObjectId* new_object_id)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700306 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800307 static JDWP::JdwpError CreateArrayObject(JDWP::RefTypeId array_class_id, uint32_t length,
Sebastien Hertz2c3e77a2015-04-02 16:26:48 +0200308 JDWP::ObjectId* new_array_id)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700309 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700310
Sebastien Hertz6995c602014-09-09 12:10:13 +0200311 //
312 // Event filtering.
313 //
314 static bool MatchThread(JDWP::ObjectId expected_thread_id, Thread* event_thread)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700315 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz6995c602014-09-09 12:10:13 +0200316
317 static bool MatchLocation(const JDWP::JdwpLocation& expected_location,
318 const JDWP::EventLocation& event_location)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700319 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz6995c602014-09-09 12:10:13 +0200320
Mathieu Chartier3398c782016-09-30 10:27:43 -0700321 static bool MatchType(ObjPtr<mirror::Class> event_class, JDWP::RefTypeId class_id)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700322 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz6995c602014-09-09 12:10:13 +0200323
324 static bool MatchField(JDWP::RefTypeId expected_type_id, JDWP::FieldId expected_field_id,
Mathieu Chartierc7853442015-03-27 14:35:38 -0700325 ArtField* event_field)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700326 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz6995c602014-09-09 12:10:13 +0200327
328 static bool MatchInstance(JDWP::ObjectId expected_instance_id, mirror::Object* event_instance)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700329 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700330
Elliott Hughesec0f83d2013-01-15 16:54:08 -0800331 //
332 // Monitors.
333 //
334 static JDWP::JdwpError GetMonitorInfo(JDWP::ObjectId object_id, JDWP::ExpandBuf* reply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700335 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughesec0f83d2013-01-15 16:54:08 -0800336 static JDWP::JdwpError GetOwnedMonitors(JDWP::ObjectId thread_id,
Ian Rogersc0542af2014-09-03 16:16:56 -0700337 std::vector<JDWP::ObjectId>* monitors,
338 std::vector<uint32_t>* stack_depths)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700339 REQUIRES(!Locks::thread_list_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz52d131d2014-03-13 16:17:40 +0100340 static JDWP::JdwpError GetContendedMonitor(JDWP::ObjectId thread_id,
Ian Rogersc0542af2014-09-03 16:16:56 -0700341 JDWP::ObjectId* contended_monitor)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700342 REQUIRES(!Locks::thread_list_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughesec0f83d2013-01-15 16:54:08 -0800343
344 //
345 // Heap.
346 //
347 static JDWP::JdwpError GetInstanceCounts(const std::vector<JDWP::RefTypeId>& class_ids,
Ian Rogersc0542af2014-09-03 16:16:56 -0700348 std::vector<uint64_t>* counts)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700349 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes3b78c942013-01-15 17:35:41 -0800350 static JDWP::JdwpError GetInstances(JDWP::RefTypeId class_id, int32_t max_count,
Ian Rogersc0542af2014-09-03 16:16:56 -0700351 std::vector<JDWP::ObjectId>* instances)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700352 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes0cbaff52013-01-16 15:28:01 -0800353 static JDWP::JdwpError GetReferringObjects(JDWP::ObjectId object_id, int32_t max_count,
Ian Rogersc0542af2014-09-03 16:16:56 -0700354 std::vector<JDWP::ObjectId>* referring_objects)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700355 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes64f574f2013-02-20 14:57:12 -0800356 static JDWP::JdwpError DisableCollection(JDWP::ObjectId object_id)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700357 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes64f574f2013-02-20 14:57:12 -0800358 static JDWP::JdwpError EnableCollection(JDWP::ObjectId object_id)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700359 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogersc0542af2014-09-03 16:16:56 -0700360 static JDWP::JdwpError IsCollected(JDWP::ObjectId object_id, bool* is_collected)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700361 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes64f574f2013-02-20 14:57:12 -0800362 static void DisposeObject(JDWP::ObjectId object_id, uint32_t reference_count)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700363 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughesec0f83d2013-01-15 16:54:08 -0800364
Elliott Hughes9777ba22013-01-17 09:04:19 -0800365 //
366 // Methods and fields.
367 //
Elliott Hughesa96836a2013-01-17 12:27:49 -0800368 static std::string GetMethodName(JDWP::MethodId method_id)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700369 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800370 static JDWP::JdwpError OutputDeclaredFields(JDWP::RefTypeId ref_type_id, bool with_generic,
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700371 JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700372 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800373 static JDWP::JdwpError OutputDeclaredMethods(JDWP::RefTypeId ref_type_id, bool with_generic,
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700374 JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700375 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800376 static JDWP::JdwpError OutputDeclaredInterfaces(JDWP::RefTypeId ref_type_id,
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700377 JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700378 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800379 static void OutputLineTable(JDWP::RefTypeId ref_type_id, JDWP::MethodId method_id,
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700380 JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700381 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800382 static void OutputVariableTable(JDWP::RefTypeId ref_type_id, JDWP::MethodId id, bool with_generic,
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700383 JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700384 REQUIRES_SHARED(Locks::mutator_lock_);
Jeff Hao579b0242013-11-18 13:16:49 -0800385 static void OutputMethodReturnValue(JDWP::MethodId method_id, const JValue* return_value,
386 JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700387 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz3f52eaf2014-04-04 17:50:18 +0200388 static void OutputFieldValue(JDWP::FieldId field_id, const JValue* field_value,
389 JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700390 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes9777ba22013-01-17 09:04:19 -0800391 static JDWP::JdwpError GetBytecodes(JDWP::RefTypeId class_id, JDWP::MethodId method_id,
Ian Rogersc0542af2014-09-03 16:16:56 -0700392 std::vector<uint8_t>* bytecodes)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700393 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700394
Elliott Hughesa96836a2013-01-17 12:27:49 -0800395 static std::string GetFieldName(JDWP::FieldId field_id)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700396 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800397 static JDWP::JdwpTag GetFieldBasicTag(JDWP::FieldId field_id)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700398 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800399 static JDWP::JdwpTag GetStaticFieldBasicTag(JDWP::FieldId field_id)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700400 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800401 static JDWP::JdwpError GetFieldValue(JDWP::ObjectId object_id, JDWP::FieldId field_id,
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700402 JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700403 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800404 static JDWP::JdwpError SetFieldValue(JDWP::ObjectId object_id, JDWP::FieldId field_id,
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700405 uint64_t value, int width)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700406 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800407 static JDWP::JdwpError GetStaticFieldValue(JDWP::RefTypeId ref_type_id, JDWP::FieldId field_id,
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700408 JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700409 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800410 static JDWP::JdwpError SetStaticFieldValue(JDWP::FieldId field_id, uint64_t value, int width)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700411 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700412
Sebastien Hertzb0b0b492014-09-15 11:27:27 +0200413 static JDWP::JdwpError StringToUtf8(JDWP::ObjectId string_id, std::string* str)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700414 REQUIRES_SHARED(Locks::mutator_lock_);
Jeff Hao579b0242013-11-18 13:16:49 -0800415 static void OutputJValue(JDWP::JdwpTag tag, const JValue* return_value, JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700416 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700417
418 /*
419 * Thread, ThreadGroup, Frame
420 */
Ian Rogersc0542af2014-09-03 16:16:56 -0700421 static JDWP::JdwpError GetThreadName(JDWP::ObjectId thread_id, std::string* name)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700422 REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Locks::thread_list_lock_);
Sebastien Hertz52d131d2014-03-13 16:17:40 +0100423 static JDWP::JdwpError GetThreadGroup(JDWP::ObjectId thread_id, JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700424 REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Locks::thread_list_lock_);
Sebastien Hertza06430c2014-09-15 19:21:30 +0200425 static JDWP::JdwpError GetThreadGroupName(JDWP::ObjectId thread_group_id,
426 JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700427 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertza06430c2014-09-15 19:21:30 +0200428 static JDWP::JdwpError GetThreadGroupParent(JDWP::ObjectId thread_group_id,
429 JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700430 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertza06430c2014-09-15 19:21:30 +0200431 static JDWP::JdwpError GetThreadGroupChildren(JDWP::ObjectId thread_group_id,
432 JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700433 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700434 static JDWP::ObjectId GetSystemThreadGroupId()
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700435 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700436
Jeff Hao920af3e2013-08-28 15:46:38 -0700437 static JDWP::JdwpThreadStatus ToJdwpThreadStatus(ThreadState state);
Sebastien Hertz52d131d2014-03-13 16:17:40 +0100438 static JDWP::JdwpError GetThreadStatus(JDWP::ObjectId thread_id,
439 JDWP::JdwpThreadStatus* pThreadStatus,
440 JDWP::JdwpSuspendStatus* pSuspendStatus)
Mathieu Chartier90443472015-07-16 20:32:27 -0700441 REQUIRES(!Locks::thread_list_lock_);
Sebastien Hertz52d131d2014-03-13 16:17:40 +0100442 static JDWP::JdwpError GetThreadDebugSuspendCount(JDWP::ObjectId thread_id,
443 JDWP::ExpandBuf* pReply)
Mathieu Chartier90443472015-07-16 20:32:27 -0700444 REQUIRES(!Locks::thread_list_lock_, !Locks::thread_suspend_count_lock_);
Brian Carlstrom7934ac22013-07-26 10:54:15 -0700445 // static void WaitForSuspend(JDWP::ObjectId thread_id);
Elliott Hughescaf76542012-06-28 16:08:22 -0700446
Elliott Hughes026b1462012-06-28 20:43:49 -0700447 // Fills 'thread_ids' with the threads in the given thread group. If thread_group_id == 0,
Elliott Hughescaf76542012-06-28 16:08:22 -0700448 // returns all threads.
Sebastien Hertza06430c2014-09-15 19:21:30 +0200449 static void GetThreads(mirror::Object* thread_group, std::vector<JDWP::ObjectId>* thread_ids)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700450 REQUIRES(!Locks::thread_list_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughescaf76542012-06-28 16:08:22 -0700451
Ian Rogersc0542af2014-09-03 16:16:56 -0700452 static JDWP::JdwpError GetThreadFrameCount(JDWP::ObjectId thread_id, size_t* result)
Mathieu Chartier90443472015-07-16 20:32:27 -0700453 REQUIRES(!Locks::thread_list_lock_);
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700454 static JDWP::JdwpError GetThreadFrames(JDWP::ObjectId thread_id, size_t start_frame,
455 size_t frame_count, JDWP::ExpandBuf* buf)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700456 REQUIRES(!Locks::thread_list_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700457
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700458 static JDWP::ObjectId GetThreadSelfId() REQUIRES_SHARED(Locks::mutator_lock_);
459 static JDWP::ObjectId GetThreadId(Thread* thread) REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz6995c602014-09-09 12:10:13 +0200460
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700461 static void SuspendVM()
Mathieu Chartier90443472015-07-16 20:32:27 -0700462 REQUIRES(!Locks::thread_list_lock_, !Locks::thread_suspend_count_lock_);
Sebastien Hertz253fa552014-10-14 17:27:15 +0200463 static void ResumeVM()
Mathieu Chartier90443472015-07-16 20:32:27 -0700464 REQUIRES(!Locks::thread_list_lock_, !Locks::thread_suspend_count_lock_);
Elliott Hughes88d63092013-01-09 09:55:54 -0800465 static JDWP::JdwpError SuspendThread(JDWP::ObjectId thread_id, bool request_suspension = true)
Mathieu Chartier90443472015-07-16 20:32:27 -0700466 REQUIRES(!Locks::mutator_lock_, !Locks::thread_list_lock_,
467 !Locks::thread_suspend_count_lock_);
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700468
Elliott Hughes88d63092013-01-09 09:55:54 -0800469 static void ResumeThread(JDWP::ObjectId thread_id)
Mathieu Chartier90443472015-07-16 20:32:27 -0700470 REQUIRES(!Locks::thread_list_lock_, !Locks::thread_suspend_count_lock_)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700471 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700472 static void SuspendSelf();
473
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700474 static JDWP::JdwpError GetThisObject(JDWP::ObjectId thread_id, JDWP::FrameId frame_id,
475 JDWP::ObjectId* result)
Mathieu Chartier90443472015-07-16 20:32:27 -0700476 REQUIRES(!Locks::thread_list_lock_, !Locks::thread_suspend_count_lock_)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700477 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz8009f392014-09-01 17:07:11 +0200478 static JDWP::JdwpError GetLocalValues(JDWP::Request* request, JDWP::ExpandBuf* pReply)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700479 REQUIRES(!Locks::thread_list_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz8009f392014-09-01 17:07:11 +0200480 static JDWP::JdwpError SetLocalValues(JDWP::Request* request)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700481 REQUIRES(!Locks::thread_list_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700482
Sebastien Hertz52d131d2014-03-13 16:17:40 +0100483 static JDWP::JdwpError Interrupt(JDWP::ObjectId thread_id)
Mathieu Chartier90443472015-07-16 20:32:27 -0700484 REQUIRES(!Locks::thread_list_lock_);
Elliott Hughesf9501702013-01-11 11:22:27 -0800485
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700486 /*
487 * Debugger notification
488 */
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700489 enum EventFlag {
Elliott Hughes86964332012-02-15 19:37:42 -0800490 kBreakpoint = 0x01,
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700491 kSingleStep = 0x02,
492 kMethodEntry = 0x04,
493 kMethodExit = 0x08,
494 };
Mathieu Chartiere401d142015-04-22 13:56:20 -0700495 static void PostFieldAccessEvent(ArtMethod* m, int dex_pc, mirror::Object* this_object,
Mathieu Chartierc7853442015-03-27 14:35:38 -0700496 ArtField* f)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700497 REQUIRES_SHARED(Locks::mutator_lock_);
Mathieu Chartiere401d142015-04-22 13:56:20 -0700498 static void PostFieldModificationEvent(ArtMethod* m, int dex_pc,
Mathieu Chartierc7853442015-03-27 14:35:38 -0700499 mirror::Object* this_object, ArtField* f,
Sebastien Hertz3f52eaf2014-04-04 17:50:18 +0200500 const JValue* field_value)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700501 REQUIRES_SHARED(Locks::mutator_lock_);
Nicolas Geoffray14691c52015-03-05 10:40:17 +0000502 static void PostException(mirror::Throwable* exception)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700503 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700504 static void PostThreadStart(Thread* t)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700505 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700506 static void PostThreadDeath(Thread* t)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700507 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogers2dd0e2c2013-01-24 12:42:14 -0800508 static void PostClassPrepare(mirror::Class* c)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700509 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700510
Ian Rogers62d6c772013-02-27 08:32:07 -0800511 static void UpdateDebugger(Thread* thread, mirror::Object* this_object,
Mathieu Chartiere401d142015-04-22 13:56:20 -0700512 ArtMethod* method, uint32_t new_dex_pc,
Sebastien Hertz8379b222014-02-24 17:38:15 +0100513 int event_flags, const JValue* return_value)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700514 REQUIRES(!Locks::breakpoint_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes91bf6cd2012-02-14 17:27:48 -0800515
Sebastien Hertzf3928792014-11-17 19:00:37 +0100516 // Indicates whether we need deoptimization for debugging.
517 static bool RequiresDeoptimization();
518
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100519 // Records deoptimization request in the queue.
520 static void RequestDeoptimization(const DeoptimizationRequest& req)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700521 REQUIRES(!Locks::deoptimization_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz138dbfc2013-12-04 18:15:25 +0100522
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100523 // Manage deoptimization after updating JDWP events list. Suspends all threads, processes each
524 // request and finally resumes all threads.
Sebastien Hertz138dbfc2013-12-04 18:15:25 +0100525 static void ManageDeoptimization()
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700526 REQUIRES(!Locks::deoptimization_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz138dbfc2013-12-04 18:15:25 +0100527
528 // Breakpoints.
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100529 static void WatchLocation(const JDWP::JdwpLocation* pLoc, DeoptimizationRequest* req)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700530 REQUIRES(!Locks::breakpoint_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100531 static void UnwatchLocation(const JDWP::JdwpLocation* pLoc, DeoptimizationRequest* req)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700532 REQUIRES(!Locks::breakpoint_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz138dbfc2013-12-04 18:15:25 +0100533
Daniel Mihalyieb076692014-08-22 17:33:31 +0200534 /*
535 * Forced interpreter checkers for single-step and continue support.
536 */
537
538 // Indicates whether we need to force the use of interpreter to invoke a method.
539 // This allows to single-step or continue into the called method.
Mathieu Chartiere401d142015-04-22 13:56:20 -0700540 static bool IsForcedInterpreterNeededForCalling(Thread* thread, ArtMethod* m)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700541 REQUIRES_SHARED(Locks::mutator_lock_) {
Daniel Mihalyieb076692014-08-22 17:33:31 +0200542 if (!IsDebuggerActive()) {
543 return false;
544 }
545 return IsForcedInterpreterNeededForCallingImpl(thread, m);
546 }
547
548 // Indicates whether we need to force the use of interpreter entrypoint when calling a
549 // method through the resolution trampoline. This allows to single-step or continue into
550 // the called method.
Mathieu Chartiere401d142015-04-22 13:56:20 -0700551 static bool IsForcedInterpreterNeededForResolution(Thread* thread, ArtMethod* m)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700552 REQUIRES_SHARED(Locks::mutator_lock_) {
Daniel Mihalyieb076692014-08-22 17:33:31 +0200553 if (!IsDebuggerActive()) {
554 return false;
555 }
556 return IsForcedInterpreterNeededForResolutionImpl(thread, m);
557 }
558
559 // Indicates whether we need to force the use of instrumentation entrypoint when calling
560 // a method through the resolution trampoline. This allows to deoptimize the stack for
561 // debugging when we returned from the called method.
Mathieu Chartiere401d142015-04-22 13:56:20 -0700562 static bool IsForcedInstrumentationNeededForResolution(Thread* thread, ArtMethod* m)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700563 REQUIRES_SHARED(Locks::mutator_lock_) {
Daniel Mihalyieb076692014-08-22 17:33:31 +0200564 if (!IsDebuggerActive()) {
565 return false;
566 }
567 return IsForcedInstrumentationNeededForResolutionImpl(thread, m);
568 }
569
570 // Indicates whether we need to force the use of interpreter when returning from the
571 // interpreter into the runtime. This allows to deoptimize the stack and continue
572 // execution with interpreter for debugging.
Mathieu Chartiere401d142015-04-22 13:56:20 -0700573 static bool IsForcedInterpreterNeededForUpcall(Thread* thread, ArtMethod* m)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700574 REQUIRES_SHARED(Locks::mutator_lock_) {
Mingyao Yang99170c62015-07-06 11:10:37 -0700575 if (!IsDebuggerActive() && !thread->HasDebuggerShadowFrames()) {
Daniel Mihalyieb076692014-08-22 17:33:31 +0200576 return false;
577 }
578 return IsForcedInterpreterNeededForUpcallImpl(thread, m);
579 }
580
Sebastien Hertz520633b2015-09-08 17:03:36 +0200581 // Indicates whether we need to force the use of interpreter when handling an
582 // exception. This allows to deoptimize the stack and continue execution with
583 // the interpreter.
584 // Note: the interpreter will start by handling the exception when executing
585 // the deoptimized frames.
586 static bool IsForcedInterpreterNeededForException(Thread* thread)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700587 REQUIRES_SHARED(Locks::mutator_lock_) {
Mingyao Yang99170c62015-07-06 11:10:37 -0700588 if (!IsDebuggerActive() && !thread->HasDebuggerShadowFrames()) {
Sebastien Hertz520633b2015-09-08 17:03:36 +0200589 return false;
590 }
591 return IsForcedInterpreterNeededForExceptionImpl(thread);
592 }
593
Sebastien Hertz138dbfc2013-12-04 18:15:25 +0100594 // Single-stepping.
Elliott Hughes88d63092013-01-09 09:55:54 -0800595 static JDWP::JdwpError ConfigureStep(JDWP::ObjectId thread_id, JDWP::JdwpStepSize size,
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700596 JDWP::JdwpStepDepth depth)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700597 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz61b7f1b2013-11-15 15:59:30 +0100598 static void UnconfigureStep(JDWP::ObjectId thread_id)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700599 REQUIRES(!Locks::thread_list_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700600
Sebastien Hertzcbc50642015-06-01 17:33:12 +0200601 /*
602 * Invoke support
603 */
604
605 // Called by the JDWP thread to prepare invocation in the event thread (suspended on an event).
606 // If the information sent by the debugger is incorrect, it will send a reply with the
607 // appropriate error code. Otherwise, it will attach a DebugInvokeReq object to the event thread
608 // and resume it (and possibly other threads depending on the invoke options).
609 // Unlike other commands, the JDWP thread will not send the reply to the debugger (see
610 // JdwpState::ProcessRequest). The reply will be sent by the event thread itself after method
611 // invocation completes (see FinishInvokeMethod). This is required to allow the JDWP thread to
612 // process incoming commands from the debugger while the invocation is still in progress in the
613 // event thread, especially if it gets suspended by a debug event occurring in another thread.
614 static JDWP::JdwpError PrepareInvokeMethod(uint32_t request_id, JDWP::ObjectId thread_id,
615 JDWP::ObjectId object_id, JDWP::RefTypeId class_id,
616 JDWP::MethodId method_id, uint32_t arg_count,
617 uint64_t arg_values[], JDWP::JdwpTag* arg_types,
618 uint32_t options)
Mathieu Chartier90443472015-07-16 20:32:27 -0700619 REQUIRES(!Locks::thread_list_lock_, !Locks::thread_suspend_count_lock_)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700620 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertzcbc50642015-06-01 17:33:12 +0200621
622 // Called by the event thread to execute a method prepared by the JDWP thread in the given
623 // DebugInvokeReq object. Once the invocation completes, the event thread attaches a reply
624 // to that DebugInvokeReq object so it can be sent to the debugger only when the event thread
625 // is ready to suspend (see FinishInvokeMethod).
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700626 static void ExecuteMethod(DebugInvokeReq* pReq);
627
Sebastien Hertzcbc50642015-06-01 17:33:12 +0200628 // Called by the event thread to send the reply of the invoke (created in ExecuteMethod)
629 // before suspending itself. This is to ensure the thread is ready to suspend before the
630 // debugger receives the reply.
631 static void FinishInvokeMethod(DebugInvokeReq* pReq);
632
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700633 /*
634 * DDM support.
635 */
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700636 static void DdmSendThreadNotification(Thread* t, uint32_t type)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700637 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz52d131d2014-03-13 16:17:40 +0100638 static void DdmSetThreadNotification(bool enable)
Mathieu Chartier90443472015-07-16 20:32:27 -0700639 REQUIRES(!Locks::thread_list_lock_);
Ian Rogersc0542af2014-09-03 16:16:56 -0700640 static bool DdmHandlePacket(JDWP::Request* request, uint8_t** pReplyBuf, int* pReplyLen);
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700641 static void DdmConnected() REQUIRES_SHARED(Locks::mutator_lock_);
642 static void DdmDisconnected() REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700643 static void DdmSendChunk(uint32_t type, const std::vector<uint8_t>& bytes)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700644 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700645 static void DdmSendChunk(uint32_t type, size_t len, const uint8_t* buf)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700646 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700647 static void DdmSendChunkV(uint32_t type, const iovec* iov, int iov_count)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700648 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes767a1472011-10-26 18:49:02 -0700649
Mathieu Chartiera6b1ead2015-10-06 10:32:38 -0700650 // Visit breakpoint roots, used to prevent unloading of methods with breakpoints.
Mathieu Chartierbb87e0f2015-04-03 11:21:55 -0700651 static void VisitRoots(RootVisitor* visitor)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700652 REQUIRES_SHARED(Locks::mutator_lock_);
Mathieu Chartier3b05e9b2014-03-25 09:29:43 -0700653
Elliott Hughes545a0642011-11-08 19:10:03 -0800654 /*
Man Cao8c2ff642015-05-27 17:25:30 -0700655 * Allocation tracking support.
Elliott Hughes545a0642011-11-08 19:10:03 -0800656 */
Mathieu Chartier90443472015-07-16 20:32:27 -0700657 static void SetAllocTrackingEnabled(bool enabled) REQUIRES(!Locks::alloc_tracker_lock_);
Sebastien Hertz52d131d2014-03-13 16:17:40 +0100658 static jbyteArray GetRecentAllocations()
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700659 REQUIRES(!Locks::alloc_tracker_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Mathieu Chartier90443472015-07-16 20:32:27 -0700660 static void DumpRecentAllocations() REQUIRES(!Locks::alloc_tracker_lock_);
Elliott Hughes545a0642011-11-08 19:10:03 -0800661
Elliott Hughes767a1472011-10-26 18:49:02 -0700662 enum HpifWhen {
663 HPIF_WHEN_NEVER = 0,
664 HPIF_WHEN_NOW = 1,
665 HPIF_WHEN_NEXT_GC = 2,
666 HPIF_WHEN_EVERY_GC = 3
667 };
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700668 static int DdmHandleHpifChunk(HpifWhen when)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700669 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes767a1472011-10-26 18:49:02 -0700670
671 enum HpsgWhen {
672 HPSG_WHEN_NEVER = 0,
673 HPSG_WHEN_EVERY_GC = 1,
674 };
675 enum HpsgWhat {
676 HPSG_WHAT_MERGED_OBJECTS = 0,
677 HPSG_WHAT_DISTINCT_OBJECTS = 1,
678 };
679 static bool DdmHandleHpsgNhsgChunk(HpsgWhen when, HpsgWhat what, bool native);
680
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700681 static void DdmSendHeapInfo(HpifWhen reason)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700682 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700683 static void DdmSendHeapSegments(bool native)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700684 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes545a0642011-11-08 19:10:03 -0800685
Sebastien Hertz6995c602014-09-09 12:10:13 +0200686 static ObjectRegistry* GetObjectRegistry() {
687 return gRegistry;
688 }
689
690 static JDWP::JdwpTag TagFromObject(const ScopedObjectAccessUnchecked& soa, mirror::Object* o)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700691 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz6995c602014-09-09 12:10:13 +0200692
Mathieu Chartier3398c782016-09-30 10:27:43 -0700693 static JDWP::JdwpTypeTag GetTypeTag(ObjPtr<mirror::Class> klass)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700694 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz6995c602014-09-09 12:10:13 +0200695
Mathieu Chartierc7853442015-03-27 14:35:38 -0700696 static JDWP::FieldId ToFieldId(const ArtField* f)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700697 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz6995c602014-09-09 12:10:13 +0200698
Mathieu Chartiere401d142015-04-22 13:56:20 -0700699 static void SetJdwpLocation(JDWP::JdwpLocation* location, ArtMethod* m, uint32_t dex_pc)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700700 REQUIRES_SHARED(Locks::mutator_lock_)
Mathieu Chartier90443472015-07-16 20:32:27 -0700701 REQUIRES(!Locks::thread_list_lock_, !Locks::thread_suspend_count_lock_);
Sebastien Hertz6995c602014-09-09 12:10:13 +0200702
Mathieu Chartierad466ad2015-01-08 16:28:08 -0800703 static JDWP::JdwpState* GetJdwpState();
704
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700705 static uint32_t GetInstrumentationEvents() REQUIRES_SHARED(Locks::mutator_lock_) {
Sebastien Hertz9d6bf692015-04-10 12:12:33 +0200706 return instrumentation_events_;
707 }
708
Elliott Hughes545a0642011-11-08 19:10:03 -0800709 private:
Sebastien Hertzcbc50642015-06-01 17:33:12 +0200710 static void ExecuteMethodWithoutPendingException(ScopedObjectAccess& soa, DebugInvokeReq* pReq)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700711 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertzcbc50642015-06-01 17:33:12 +0200712
713 static void BuildInvokeReply(JDWP::ExpandBuf* pReply, uint32_t request_id,
714 JDWP::JdwpTag result_tag, uint64_t result_value,
715 JDWP::ObjectId exception)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700716 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertzcbc50642015-06-01 17:33:12 +0200717
Sebastien Hertz8009f392014-09-01 17:07:11 +0200718 static JDWP::JdwpError GetLocalValue(const StackVisitor& visitor,
719 ScopedObjectAccessUnchecked& soa, int slot,
720 JDWP::JdwpTag tag, uint8_t* buf, size_t width)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700721 REQUIRES(!Locks::thread_list_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Mingyao Yang99170c62015-07-06 11:10:37 -0700722 static JDWP::JdwpError SetLocalValue(Thread* thread, StackVisitor& visitor, int slot,
723 JDWP::JdwpTag tag, uint64_t value, size_t width)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700724 REQUIRES(!Locks::thread_list_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz8009f392014-09-01 17:07:11 +0200725
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700726 static void DdmBroadcast(bool connect) REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogers00f7d0e2012-07-19 15:28:27 -0700727 static void PostThreadStartOrStop(Thread*, uint32_t)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700728 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughesa2155262011-11-16 16:26:58 -0800729
Mathieu Chartiere401d142015-04-22 13:56:20 -0700730 static void PostLocationEvent(ArtMethod* method, int pcOffset,
Sebastien Hertz8379b222014-02-24 17:38:15 +0100731 mirror::Object* thisPtr, int eventFlags,
732 const JValue* return_value)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700733 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz8379b222014-02-24 17:38:15 +0100734
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100735 static void ProcessDeoptimizationRequest(const DeoptimizationRequest& request)
Mathieu Chartieraa516822015-10-02 15:53:37 -0700736 REQUIRES(Locks::mutator_lock_, Roles::uninterruptible_);
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100737
Sebastien Hertz7ec2f1c2014-03-27 20:06:47 +0100738 static void RequestDeoptimizationLocked(const DeoptimizationRequest& req)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700739 REQUIRES(Locks::deoptimization_lock_) REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz7ec2f1c2014-03-27 20:06:47 +0100740
Mathieu Chartiere401d142015-04-22 13:56:20 -0700741 static bool IsForcedInterpreterNeededForCallingImpl(Thread* thread, ArtMethod* m)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700742 REQUIRES_SHARED(Locks::mutator_lock_);
Daniel Mihalyieb076692014-08-22 17:33:31 +0200743
Mathieu Chartiere401d142015-04-22 13:56:20 -0700744 static bool IsForcedInterpreterNeededForResolutionImpl(Thread* thread, ArtMethod* m)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700745 REQUIRES_SHARED(Locks::mutator_lock_);
Daniel Mihalyieb076692014-08-22 17:33:31 +0200746
Mathieu Chartiere401d142015-04-22 13:56:20 -0700747 static bool IsForcedInstrumentationNeededForResolutionImpl(Thread* thread, ArtMethod* m)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700748 REQUIRES_SHARED(Locks::mutator_lock_);
Daniel Mihalyieb076692014-08-22 17:33:31 +0200749
Mathieu Chartiere401d142015-04-22 13:56:20 -0700750 static bool IsForcedInterpreterNeededForUpcallImpl(Thread* thread, ArtMethod* m)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700751 REQUIRES_SHARED(Locks::mutator_lock_);
Daniel Mihalyieb076692014-08-22 17:33:31 +0200752
Sebastien Hertz520633b2015-09-08 17:03:36 +0200753 static bool IsForcedInterpreterNeededForExceptionImpl(Thread* thread)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700754 REQUIRES_SHARED(Locks::mutator_lock_);
Sebastien Hertz520633b2015-09-08 17:03:36 +0200755
Daniel Mihalyieb076692014-08-22 17:33:31 +0200756 // Indicates whether the debugger is making requests.
757 static bool gDebuggerActive;
758
Sebastien Hertz4e5b2082015-03-24 19:03:40 +0100759 // Indicates whether we should drop the JDWP connection because the runtime stops or the
760 // debugger called VirtualMachine.Dispose.
761 static bool gDisposed;
762
Daniel Mihalyieb076692014-08-22 17:33:31 +0200763 // The registry mapping objects to JDWP ids.
Sebastien Hertz6995c602014-09-09 12:10:13 +0200764 static ObjectRegistry* gRegistry;
765
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100766 // Deoptimization requests to be processed each time the event list is updated. This is used when
767 // registering and unregistering events so we do not deoptimize while holding the event list
768 // lock.
Sebastien Hertz42cd43f2014-05-13 14:15:41 +0200769 // TODO rename to instrumentation_requests.
Brian Carlstrom306db812014-09-05 13:01:41 -0700770 static std::vector<DeoptimizationRequest> deoptimization_requests_ GUARDED_BY(Locks::deoptimization_lock_);
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100771
772 // Count the number of events requiring full deoptimization. When the counter is > 0, everything
773 // is deoptimized, otherwise everything is undeoptimized.
774 // Note: we fully deoptimize on the first event only (when the counter is set to 1). We fully
775 // undeoptimize when the last event is unregistered (when the counter is set to 0).
Brian Carlstrom306db812014-09-05 13:01:41 -0700776 static size_t full_deoptimization_event_count_ GUARDED_BY(Locks::deoptimization_lock_);
Sebastien Hertz4d25df32014-03-21 17:44:46 +0100777
Sebastien Hertz42cd43f2014-05-13 14:15:41 +0200778 static size_t* GetReferenceCounterForEvent(uint32_t instrumentation_event);
779
780 // Instrumentation event reference counters.
781 // TODO we could use an array instead of having all these dedicated counters. Instrumentation
782 // events are bits of a mask so we could convert them to array index.
Brian Carlstrom306db812014-09-05 13:01:41 -0700783 static size_t dex_pc_change_event_ref_count_ GUARDED_BY(Locks::deoptimization_lock_);
784 static size_t method_enter_event_ref_count_ GUARDED_BY(Locks::deoptimization_lock_);
785 static size_t method_exit_event_ref_count_ GUARDED_BY(Locks::deoptimization_lock_);
786 static size_t field_read_event_ref_count_ GUARDED_BY(Locks::deoptimization_lock_);
787 static size_t field_write_event_ref_count_ GUARDED_BY(Locks::deoptimization_lock_);
788 static size_t exception_catch_event_ref_count_ GUARDED_BY(Locks::deoptimization_lock_);
Sebastien Hertz42cd43f2014-05-13 14:15:41 +0200789 static uint32_t instrumentation_events_ GUARDED_BY(Locks::mutator_lock_);
790
Ian Rogers719d1a32014-03-06 12:13:39 -0800791 DISALLOW_COPY_AND_ASSIGN(Dbg);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700792};
793
794#define CHUNK_TYPE(_name) \
Elliott Hughes82188472011-11-07 18:11:48 -0800795 static_cast<uint32_t>((_name)[0] << 24 | (_name)[1] << 16 | (_name)[2] << 8 | (_name)[3])
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700796
797} // namespace art
798
Brian Carlstromfc0e3212013-07-17 14:40:12 -0700799#endif // ART_RUNTIME_DEBUGGER_H_