summaryrefslogtreecommitdiffstats
path: root/src/jdwp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2011-12-02 16:16:23 -0800
committerElliott Hughes <enh@google.com>2011-12-02 16:16:23 -0800
commitaed4be94da51b4fbb54c728151f0daf11535f6ab (patch)
tree75b2d9b28862b1aa8529199964bf91a4b3df4c9d /src/jdwp
parentf03b8f66511a2d8cb78d306f36feb51392232a5e (diff)
downloadart-aed4be94da51b4fbb54c728151f0daf11535f6ab.zip
art-aed4be94da51b4fbb54c728151f0daf11535f6ab.tar.gz
art-aed4be94da51b4fbb54c728151f0daf11535f6ab.tar.bz2
Implement field getting and setting.
This lets you use "dump" and "set <object>.<field> = <value>". Change-Id: I47aee563b26e04f4931ac1cf3de2cd2e38db35a7
Diffstat (limited to 'src/jdwp')
-rw-r--r--src/jdwp/jdwp.h1
-rw-r--r--src/jdwp/jdwp_handler.cc12
2 files changed, 7 insertions, 6 deletions
diff --git a/src/jdwp/jdwp.h b/src/jdwp/jdwp.h
index 1b766bd..f138880 100644
--- a/src/jdwp/jdwp.h
+++ b/src/jdwp/jdwp.h
@@ -55,6 +55,7 @@ static inline MethodId ReadMethodId(const uint8_t** pBuf) { return Read4BE(pBuf)
static inline ObjectId ReadObjectId(const uint8_t** pBuf) { return Read8BE(pBuf); }
static inline RefTypeId ReadRefTypeId(const uint8_t** pBuf) { return Read8BE(pBuf); }
static inline FrameId ReadFrameId(const uint8_t** pBuf) { return Read8BE(pBuf); }
+static inline JdwpTag ReadTag(const uint8_t** pBuf) { return static_cast<JdwpTag>(Read1(pBuf)); }
static inline void SetFieldId(uint8_t* buf, FieldId val) { return Set4BE(buf, val); }
static inline void SetMethodId(uint8_t* buf, MethodId val) { return Set4BE(buf, val); }
static inline void SetObjectId(uint8_t* buf, ObjectId val) { return Set8BE(buf, val); }
diff --git a/src/jdwp/jdwp_handler.cc b/src/jdwp/jdwp_handler.cc
index c0a44e0..65b645d 100644
--- a/src/jdwp/jdwp_handler.cc
+++ b/src/jdwp/jdwp_handler.cc
@@ -118,7 +118,7 @@ static JdwpError finishInvoke(JdwpState* state,
}
for (uint32_t i = 0; i < numArgs; i++) {
- uint8_t typeTag = Read1(&buf);
+ JDWP::JdwpTag typeTag = ReadTag(&buf);
size_t width = Dbg::GetTagWidth(typeTag);
uint64_t value = jdwpReadValue(&buf, width);
@@ -129,7 +129,7 @@ static JdwpError finishInvoke(JdwpState* state,
uint32_t options = Read4BE(&buf); /* enum InvokeOptions bit flags */
LOG(VERBOSE) << StringPrintf(" options=0x%04x%s%s", options, (options & INVOKE_SINGLE_THREADED) ? " (SINGLE_THREADED)" : "", (options & INVOKE_NONVIRTUAL) ? " (NONVIRTUAL)" : "");
- uint8_t resultTag;
+ JDWP::JdwpTag resultTag;
uint64_t resultValue;
ObjectId exceptObjId;
JdwpError err = Dbg::InvokeMethod(threadId, objectId, classId, methodId, numArgs, argArray, options, &resultTag, &resultValue, &exceptObjId);
@@ -657,7 +657,7 @@ static JdwpError handleCT_SetValues(JdwpState* state, const uint8_t* buf, int da
for (uint32_t i = 0; i < values; i++) {
FieldId fieldId = ReadFieldId(&buf);
- uint8_t fieldTag = Dbg::GetStaticFieldBasicTag(classId, fieldId);
+ JDWP::JdwpTag fieldTag = Dbg::GetStaticFieldBasicTag(fieldId);
size_t width = Dbg::GetTagWidth(fieldTag);
uint64_t value = jdwpReadValue(&buf, width);
@@ -805,7 +805,7 @@ static JdwpError handleOR_SetValues(JdwpState* state, const uint8_t* buf, int da
for (uint32_t i = 0; i < numFields; i++) {
FieldId fieldId = ReadFieldId(&buf);
- uint8_t fieldTag = Dbg::GetFieldBasicTag(objectId, fieldId);
+ JDWP::JdwpTag fieldTag = Dbg::GetFieldBasicTag(fieldId);
size_t width = Dbg::GetTagWidth(fieldTag);
uint64_t value = jdwpReadValue(&buf, width);
@@ -1443,7 +1443,7 @@ static JdwpError handleSF_GetValues(JdwpState* state, const uint8_t* buf, int da
expandBufAdd4BE(pReply, slots); /* "int values" */
for (uint32_t i = 0; i < slots; i++) {
uint32_t slot = Read4BE(&buf);
- JDWP::JdwpTag reqSigByte = static_cast<JDWP::JdwpTag>(Read1(&buf));
+ JDWP::JdwpTag reqSigByte = ReadTag(&buf);
LOG(VERBOSE) << StringPrintf(" --> slot %d '%c'", slot, reqSigByte);
@@ -1467,7 +1467,7 @@ static JdwpError handleSF_SetValues(JdwpState* state, const uint8_t* buf, int da
for (uint32_t i = 0; i < slots; i++) {
uint32_t slot = Read4BE(&buf);
- JDWP::JdwpTag sigByte = static_cast<JDWP::JdwpTag>(Read1(&buf));
+ JDWP::JdwpTag sigByte = ReadTag(&buf);
size_t width = Dbg::GetTagWidth(sigByte);
uint64_t value = jdwpReadValue(&buf, width);