* Dalvik-specific side of debugger support. (The JDWP code is intended to
* be relatively generic.)
*/
-#ifndef _DALVIK_DEBUGGER
-#define _DALVIK_DEBUGGER
+#ifndef DALVIK_DEBUGGER_H_
+#define DALVIK_DEBUGGER_H_
+#include <pthread.h>
#include "Common.h"
#include "Misc.h"
#include "jdwp/Jdwp.h"
-#include <pthread.h>
/* fwd decl */
struct Object;
struct Method;
struct Thread;
-#define DEBUGGER_ACTIVE (gDvm.interpBreak & kSubModeDebuggerActive)
-
/*
* Used by StepControl to track a set of addresses associated with
* a single line.
*/
-typedef struct AddressSet {
+struct AddressSet {
u4 setSize;
u1 set[1];
-} AddressSet;
+};
INLINE void dvmAddressSetSet(AddressSet *pSet, u4 toSet)
{
/*
* Single-step management.
*/
-typedef struct StepControl {
+struct StepControl {
/* request */
- enum JdwpStepSize size;
- enum JdwpStepDepth depth;
- struct Thread* thread; /* don't deref; for comparison only */
+ JdwpStepSize size;
+ JdwpStepDepth depth;
+ Thread* thread; /* don't deref; for comparison only */
/* current state */
- bool active;
- const struct Method* method;
- int line; /* line #; could be -1 */
- const AddressSet* pAddressSet; /* if non-null, address set for line */
- int frameDepth;
-} StepControl;
+ bool active;
+ const Method* method;
+ int line; /* line #; could be -1 */
+ const AddressSet* pAddressSet; /* if non-null, address set for line */
+ int frameDepth;
+};
/*
* Invoke-during-breakpoint support.
*/
-typedef struct DebugInvokeReq {
+struct DebugInvokeReq {
/* boolean; only set when we're in the tail end of an event handler */
bool ready;
bool invokeNeeded;
/* request */
- struct Object* obj; /* not used for ClassType.InvokeMethod */
- struct Object* thread;
- struct ClassObject* clazz;
- struct Method* method;
- u4 numArgs;
- u8* argArray; /* will be NULL if numArgs==0 */
- u4 options;
+ Object* obj; /* not used for ClassType.InvokeMethod */
+ Object* thread;
+ ClassObject* clazz;
+ Method* method;
+ u4 numArgs;
+ u8* argArray; /* will be NULL if numArgs==0 */
+ u4 options;
/* result */
- JdwpError err;
- u1 resultTag;
- JValue resultValue;
- ObjectId exceptObj;
+ JdwpError err;
+ u1 resultTag;
+ JValue resultValue;
+ ObjectId exceptObj;
/* condition variable to wait on while the method executes */
- pthread_mutex_t lock;
- pthread_cond_t cv;
-} DebugInvokeReq;
+ pthread_mutex_t lock;
+ pthread_cond_t cv;
+};
/* system init/shutdown */
bool dvmDebuggerStartup(void);
void dvmDbgGetVisibleClassList(ObjectId classLoaderId, u4* pNumClasses,
RefTypeId** pClassRefBuf);
void dvmDbgGetClassInfo(RefTypeId classId, u1* pTypeTag, u4* pStatus,
- char** pSignature);
+ const char** pSignature);
bool dvmDbgFindLoadedClassBySignature(const char* classDescriptor,
RefTypeId* pRefTypeId);
void dvmDbgGetObjectType(ObjectId objectId, u1* pRefTypeTag,
RefTypeId* pRefTypeId);
u1 dvmDbgGetClassObjectType(RefTypeId refTypeId);
-char* dvmDbgGetSignature(RefTypeId refTypeId);
+const char* dvmDbgGetSignature(RefTypeId refTypeId);
const char* dvmDbgGetSourceFile(RefTypeId refTypeId);
-char* dvmDbgGetObjectTypeName(ObjectId objectId);
-int dvmDbgGetSignatureTag(const char* signature);
-int dvmDbgGetObjectTag(ObjectId objectId, const char* type);
+const char* dvmDbgGetObjectTypeName(ObjectId objectId);
+u1 dvmDbgGetObjectTag(ObjectId objectId);
int dvmDbgGetTagWidth(int tag);
int dvmDbgGetArrayLength(ObjectId arrayId);
-int dvmDbgGetArrayElementTag(ObjectId arrayId);
+u1 dvmDbgGetArrayElementTag(ObjectId arrayId);
bool dvmDbgOutputArray(ObjectId arrayId, int firstIndex, int count,
ExpandBuf* pReply);
bool dvmDbgSetArrayElements(ObjectId arrayId, int firstIndex, int count,
void dvmDbgOutputVariableTable(RefTypeId refTypeId, MethodId id,
bool withGeneric, ExpandBuf* pReply);
-int dvmDbgGetFieldTag(ObjectId objId, FieldId fieldId);
-int dvmDbgGetStaticFieldTag(RefTypeId refTypeId, FieldId fieldId);
-void dvmDbgGetFieldValue(ObjectId objId, FieldId fieldId, u1* ptr, int width);
+u1 dvmDbgGetFieldBasicTag(ObjectId objId, FieldId fieldId);
+u1 dvmDbgGetStaticFieldBasicTag(RefTypeId refTypeId, FieldId fieldId);
+void dvmDbgGetFieldValue(ObjectId objectId, FieldId fieldId, ExpandBuf* pReply);
void dvmDbgSetFieldValue(ObjectId objectId, FieldId fieldId, u8 value,
int width);
-void dvmDbgGetStaticFieldValue(RefTypeId refTypeId, FieldId fieldId, u1* ptr,
- int width);
+void dvmDbgGetStaticFieldValue(RefTypeId refTypeId, FieldId fieldId,
+ ExpandBuf* pReply);
void dvmDbgSetStaticFieldValue(RefTypeId refTypeId, FieldId fieldId,
u8 rawValue, int width);
/*
* Debugger notification
*/
-void dvmDbgPostLocationEvent(const struct Method* method, int pcOffset,
- struct Object* thisPtr, int eventFlags);
+void dvmDbgPostLocationEvent(const Method* method, int pcOffset,
+ Object* thisPtr, int eventFlags);
void dvmDbgPostException(void* throwFp, int throwRelPc, void* catchFp,
- int catchRelPc, struct Object* exception);
-void dvmDbgPostThreadStart(struct Thread* thread);
-void dvmDbgPostThreadDeath(struct Thread* thread);
-void dvmDbgPostClassPrepare(struct ClassObject* clazz);
-// FieldAccess, FieldModification
+ int catchRelPc, Object* exception);
+void dvmDbgPostThreadStart(Thread* thread);
+void dvmDbgPostThreadDeath(Thread* thread);
+void dvmDbgPostClassPrepare(ClassObject* clazz);
/* for "eventFlags" */
enum {
bool dvmDbgWatchLocation(const JdwpLocation* pLoc);
void dvmDbgUnwatchLocation(const JdwpLocation* pLoc);
-bool dvmDbgConfigureStep(ObjectId threadId, enum JdwpStepSize size,
- enum JdwpStepDepth depth);
+bool dvmDbgConfigureStep(ObjectId threadId, JdwpStepSize size,
+ JdwpStepDepth depth);
void dvmDbgUnconfigureStep(ObjectId threadId);
JdwpError dvmDbgInvokeMethod(ObjectId threadId, ObjectId objectId,
void dvmDbgExecuteMethod(DebugInvokeReq* pReq);
/* Make an AddressSet for a line, for single stepping */
-const AddressSet *dvmAddressSetForLine(const struct Method* method, int line);
+const AddressSet *dvmAddressSetForLine(const Method* method, int line);
/* perform "late registration" of an object ID */
void dvmDbgRegisterObjectId(ObjectId id);
#define CHUNK_TYPE(_name) \
((_name)[0] << 24 | (_name)[1] << 16 | (_name)[2] << 8 | (_name)[3])
-#endif /*_DALVIK_DEBUGGER*/
+#endif // DALVIK_DEBUGGER_H_