debugger.h revision 4ffd31315bc0d00ec278e85feed15985de5ac3dc
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 */
21872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes#ifndef ART_DEBUGGER_H_
22872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes#define ART_DEBUGGER_H_
23872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
24872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes#include <pthread.h>
25872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
263bb81563481d02b5a6349b8ed918392454e761d8Elliott Hughes#include <string>
273bb81563481d02b5a6349b8ed918392454e761d8Elliott Hughes
28872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes#include "jdwp/jdwp.h"
293bb81563481d02b5a6349b8ed918392454e761d8Elliott Hughes#include "object.h"
30872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
31872d4ec7225444d9400d30f9027247deb91012fdElliott Hughesnamespace art {
32872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
33872d4ec7225444d9400d30f9027247deb91012fdElliott Hughesstruct Thread;
34872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
35872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes/*
36872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Invoke-during-breakpoint support.
37872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */
38872d4ec7225444d9400d30f9027247deb91012fdElliott Hughesstruct DebugInvokeReq {
39872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  /* boolean; only set when we're in the tail end of an event handler */
40872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  bool ready;
41872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
42872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  /* boolean; set if the JDWP thread wants this thread to do work */
43872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  bool invokeNeeded;
44872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
45872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  /* request */
46872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  Object* obj;        /* not used for ClassType.InvokeMethod */
47872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  Object* thread;
48872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  Class* class_;
49872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  Method* method;
50872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  uint32_t numArgs;
51872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  uint64_t* argArray;   /* will be NULL if numArgs==0 */
52872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  uint32_t options;
53872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
54872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  /* result */
55872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  JDWP::JdwpError err;
56872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  uint8_t resultTag;
57872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  JValue resultValue;
58872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  JDWP::ObjectId exceptObj;
59872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
60872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  /* condition variable to wait on while the method executes */
61872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  Mutex lock_;
62872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  ConditionVariable cond_;
63872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes};
64872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
65872d4ec7225444d9400d30f9027247deb91012fdElliott Hughesclass Dbg {
66872d4ec7225444d9400d30f9027247deb91012fdElliott Hughespublic:
673bb81563481d02b5a6349b8ed918392454e761d8Elliott Hughes  static bool ParseJdwpOptions(const std::string& options);
68872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool DebuggerStartup();
69872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void DebuggerShutdown();
70872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
714ffd31315bc0d00ec278e85feed15985de5ac3dcElliott Hughes  static void SetJdwpAllowed(bool allowed);
724ffd31315bc0d00ec278e85feed15985de5ac3dcElliott Hughes
73872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  // Return the DebugInvokeReq for the current thread.
74872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static DebugInvokeReq* GetInvokeReq();
75872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
76872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  /*
77872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   * Enable/disable breakpoints and step modes.  Used to provide a heads-up
78872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   * when the debugger attaches.
79872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   */
80872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void Connected();
81872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void Active();
82872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void Disconnected();
83872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
84872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  /*
85872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   * Returns "true" if a debugger is connected.  Returns "false" if it's
86872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   * just DDM.
87872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   */
88872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool IsDebuggerConnected();
89872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
90872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool IsDebuggingEnabled();
91872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
92872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  /*
93872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   * Time, in milliseconds, since the last debugger activity.  Does not
94872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   * include DDMS activity.  Returns -1 if there has been no activity.
95872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   * Returns 0 if we're in the middle of handling a debugger request.
96872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   */
97872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static int64_t LastDebuggerActivity();
98872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
99872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  /*
100872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   * Block/allow GC depending on what we're doing.  These return the old
101872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   * status, which can be fed to ThreadContinuing() to restore the previous
102872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   * mode.
103872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   */
104872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static int ThreadRunning();
105872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static int ThreadWaiting();
106872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static int ThreadContinuing(int status);
107872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
108872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void UndoDebuggerSuspensions();
109872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
110872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  // The debugger wants the VM to exit.
111872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void Exit(int status);
112872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
113872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  /*
114872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   * Class, Object, Array
115872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   */
116872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static const char* GetClassDescriptor(JDWP::RefTypeId id);
117872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static JDWP::ObjectId GetClassObject(JDWP::RefTypeId id);
118872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static JDWP::RefTypeId GetSuperclass(JDWP::RefTypeId id);
119872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static JDWP::ObjectId GetClassLoader(JDWP::RefTypeId id);
120872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static uint32_t GetAccessFlags(JDWP::RefTypeId id);
121872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool IsInterface(JDWP::RefTypeId id);
122872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void GetClassList(uint32_t* pNumClasses, JDWP::RefTypeId** pClassRefBuf);
123872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void GetVisibleClassList(JDWP::ObjectId classLoaderId, uint32_t* pNumClasses, JDWP::RefTypeId** pClassRefBuf);
124872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void GetClassInfo(JDWP::RefTypeId classId, uint8_t* pTypeTag, uint32_t* pStatus, const char** pSignature);
125872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool FindLoadedClassBySignature(const char* classDescriptor, JDWP::RefTypeId* pRefTypeId);
126872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void GetObjectType(JDWP::ObjectId objectId, uint8_t* pRefTypeTag, JDWP::RefTypeId* pRefTypeId);
127872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static uint8_t GetClassObjectType(JDWP::RefTypeId refTypeId);
128872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static const char* GetSignature(JDWP::RefTypeId refTypeId);
129872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static const char* GetSourceFile(JDWP::RefTypeId refTypeId);
130872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static const char* GetObjectTypeName(JDWP::ObjectId objectId);
131872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static uint8_t GetObjectTag(JDWP::ObjectId objectId);
132872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static int GetTagWidth(int tag);
133872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
134872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static int GetArrayLength(JDWP::ObjectId arrayId);
135872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static uint8_t GetArrayElementTag(JDWP::ObjectId arrayId);
136872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool OutputArray(JDWP::ObjectId arrayId, int firstIndex, int count, JDWP::ExpandBuf* pReply);
137872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool SetArrayElements(JDWP::ObjectId arrayId, int firstIndex, int count, const uint8_t* buf);
138872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
139872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static JDWP::ObjectId CreateString(const char* str);
140872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static JDWP::ObjectId CreateObject(JDWP::RefTypeId classId);
141872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static JDWP::ObjectId CreateArrayObject(JDWP::RefTypeId arrayTypeId, uint32_t length);
142872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
143872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool MatchType(JDWP::RefTypeId instClassId, JDWP::RefTypeId classId);
144872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
145872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  /*
146872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   * Method and Field
147872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   */
148872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static const char* GetMethodName(JDWP::RefTypeId refTypeId, JDWP::MethodId id);
149872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void OutputAllFields(JDWP::RefTypeId refTypeId, bool withGeneric, JDWP::ExpandBuf* pReply);
150872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void OutputAllMethods(JDWP::RefTypeId refTypeId, bool withGeneric, JDWP::ExpandBuf* pReply);
151872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void OutputAllInterfaces(JDWP::RefTypeId refTypeId, JDWP::ExpandBuf* pReply);
152872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void OutputLineTable(JDWP::RefTypeId refTypeId, JDWP::MethodId methodId, JDWP::ExpandBuf* pReply);
153872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void OutputVariableTable(JDWP::RefTypeId refTypeId, JDWP::MethodId id, bool withGeneric, JDWP::ExpandBuf* pReply);
154872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
155872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static uint8_t GetFieldBasicTag(JDWP::ObjectId objId, JDWP::FieldId fieldId);
156872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static uint8_t GetStaticFieldBasicTag(JDWP::RefTypeId refTypeId, JDWP::FieldId fieldId);
157872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void GetFieldValue(JDWP::ObjectId objectId, JDWP::FieldId fieldId, JDWP::ExpandBuf* pReply);
158872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void SetFieldValue(JDWP::ObjectId objectId, JDWP::FieldId fieldId, uint64_t value, int width);
159872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void GetStaticFieldValue(JDWP::RefTypeId refTypeId, JDWP::FieldId fieldId, JDWP::ExpandBuf* pReply);
160872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void SetStaticFieldValue(JDWP::RefTypeId refTypeId, JDWP::FieldId fieldId, uint64_t rawValue, int width);
161872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
162872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static char* StringToUtf8(JDWP::ObjectId strId);
163872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
164872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  /*
165872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   * Thread, ThreadGroup, Frame
166872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   */
167872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static char* GetThreadName(JDWP::ObjectId threadId);
168872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static JDWP::ObjectId GetThreadGroup(JDWP::ObjectId threadId);
169872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static char* GetThreadGroupName(JDWP::ObjectId threadGroupId);
170872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static JDWP::ObjectId GetThreadGroupParent(JDWP::ObjectId threadGroupId);
171872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static JDWP::ObjectId GetSystemThreadGroupId();
172872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static JDWP::ObjectId GetMainThreadGroupId();
173872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
174872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool GetThreadStatus(JDWP::ObjectId threadId, uint32_t* threadStatus, uint32_t* suspendStatus);
175872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static uint32_t GetThreadSuspendCount(JDWP::ObjectId threadId);
176872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool ThreadExists(JDWP::ObjectId threadId);
177872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool IsSuspended(JDWP::ObjectId threadId);
178872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  //static void WaitForSuspend(JDWP::ObjectId threadId);
179872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void GetThreadGroupThreads(JDWP::ObjectId threadGroupId, JDWP::ObjectId** ppThreadIds, uint32_t* pThreadCount);
180872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void GetAllThreads(JDWP::ObjectId** ppThreadIds, uint32_t* pThreadCount);
181872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static int GetThreadFrameCount(JDWP::ObjectId threadId);
182872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool GetThreadFrame(JDWP::ObjectId threadId, int num, JDWP::FrameId* pFrameId, JDWP::JdwpLocation* pLoc);
183872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
184872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static JDWP::ObjectId GetThreadSelfId();
185872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void SuspendVM(bool isEvent);
186872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void ResumeVM();
187872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void SuspendThread(JDWP::ObjectId threadId);
188872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void ResumeThread(JDWP::ObjectId threadId);
189872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void SuspendSelf();
190872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
191872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool GetThisObject(JDWP::ObjectId threadId, JDWP::FrameId frameId, JDWP::ObjectId* pThisId);
192872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void GetLocalValue(JDWP::ObjectId threadId, JDWP::FrameId frameId, int slot, uint8_t tag, uint8_t* buf, int expectedLen);
193872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void SetLocalValue(JDWP::ObjectId threadId, JDWP::FrameId frameId, int slot, uint8_t tag, uint64_t value, int width);
194872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
195872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  /*
196872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   * Debugger notification
197872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   */
198872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  enum {
199872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes    kBreakPoint     = 0x01,
200872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes    kSingleStep     = 0x02,
201872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes    kMethodEntry    = 0x04,
202872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes    kMethodExit     = 0x08,
203872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  };
204872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void PostLocationEvent(const Method* method, int pcOffset, Object* thisPtr, int eventFlags);
205872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void PostException(void* throwFp, int throwRelPc, void* catchFp, int catchRelPc, Object* exception);
206872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void PostThreadStart(Thread* t);
207872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void PostThreadDeath(Thread* t);
208872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void PostClassPrepare(Class* c);
209872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
210872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool WatchLocation(const JDWP::JdwpLocation* pLoc);
211872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void UnwatchLocation(const JDWP::JdwpLocation* pLoc);
212872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool ConfigureStep(JDWP::ObjectId threadId, JDWP::JdwpStepSize size, JDWP::JdwpStepDepth depth);
213872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void UnconfigureStep(JDWP::ObjectId threadId);
214872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
215872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static JDWP::JdwpError InvokeMethod(JDWP::ObjectId threadId, JDWP::ObjectId objectId, JDWP::RefTypeId classId, JDWP::MethodId methodId, uint32_t numArgs, uint64_t* argArray, uint32_t options, uint8_t* pResultTag, uint64_t* pResultValue, JDWP::ObjectId* pExceptObj);
216872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void ExecuteMethod(DebugInvokeReq* pReq);
217872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
218872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  /* perform "late registration" of an object ID */
219872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void RegisterObjectId(JDWP::ObjectId id);
220872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
221872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  /*
222872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   * DDM support.
223872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes   */
224872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static bool DdmHandlePacket(const uint8_t* buf, int dataLen, uint8_t** pReplyBuf, int* pReplyLen);
225872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void DdmConnected();
226872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void DdmDisconnected();
227872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void DdmSendChunk(int type, size_t len, const uint8_t* buf);
228872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes  static void DdmSendChunkV(int type, const struct iovec* iov, int iovcnt);
229872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes};
230872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
231872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes#define CHUNK_TYPE(_name) \
232872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes    ((_name)[0] << 24 | (_name)[1] << 16 | (_name)[2] << 8 | (_name)[3])
233872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
234872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes}  // namespace art
235872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes
236872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes#endif  // ART_DEBUGGER_H_
237