diff options
-rw-r--r-- | src/debugger.cc | 16 | ||||
-rw-r--r-- | src/jdwp/jdwp.h | 20 | ||||
-rw-r--r-- | src/jdwp/jdwp_adb.cc | 14 | ||||
-rw-r--r-- | src/jdwp/jdwp_bits.h | 26 | ||||
-rw-r--r-- | src/jdwp/jdwp_event.cc | 24 | ||||
-rw-r--r-- | src/jdwp/jdwp_expand_buf.cc | 8 | ||||
-rw-r--r-- | src/jdwp/jdwp_handler.cc | 96 | ||||
-rw-r--r-- | src/jdwp/jdwp_socket.cc | 26 | ||||
-rw-r--r-- | src/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc | 18 |
9 files changed, 124 insertions, 124 deletions
diff --git a/src/debugger.cc b/src/debugger.cc index bff410e..f7e80d3 100644 --- a/src/debugger.cc +++ b/src/debugger.cc @@ -687,8 +687,8 @@ bool Dbg::DdmHandlePacket(const uint8_t* buf, int dataLen, uint8_t** pReplyBuf, // Run through and find all chunks. [Currently just find the first.] ScopedByteArrayRO contents(env, dataArray); - jint type = JDWP::get4BE(reinterpret_cast<const uint8_t*>(&contents[0])); - jint length = JDWP::get4BE(reinterpret_cast<const uint8_t*>(&contents[4])); + jint type = JDWP::Get4BE(reinterpret_cast<const uint8_t*>(&contents[0])); + jint length = JDWP::Get4BE(reinterpret_cast<const uint8_t*>(&contents[4])); jint offset = kChunkHdrLen; if (offset + length > dataLen) { LOG(WARNING) << StringPrintf("bad chunk found (len=%u pktLen=%d)", length, dataLen); @@ -741,8 +741,8 @@ bool Dbg::DdmHandlePacket(const uint8_t* buf, int dataLen, uint8_t** pReplyBuf, LOG(WARNING) << "malloc failed: " << (length + kChunkHdrLen); return false; } - JDWP::set4BE(reply + 0, type); - JDWP::set4BE(reply + 4, length); + JDWP::Set4BE(reply + 0, type); + JDWP::Set4BE(reply + 4, length); env->GetByteArrayRegion(replyData, offset, length, reinterpret_cast<jbyte*>(reply + kChunkHdrLen)); *pReplyBuf = reply; @@ -799,20 +799,20 @@ void DdmSendThreadNotification(Thread* t, bool started) { size_t byte_count = char_count*2 + sizeof(uint32_t)*2; std::vector<uint8_t> buf(byte_count); - JDWP::set4BE(&buf[0], t->GetThinLockId()); - JDWP::set4BE(&buf[4], char_count); + JDWP::Set4BE(&buf[0], t->GetThinLockId()); + JDWP::Set4BE(&buf[4], char_count); if (char_count > 0) { // Copy the UTF-16 string, transforming to big-endian. const jchar* src = name->GetCharArray()->GetData(); jchar* dst = reinterpret_cast<jchar*>(&buf[8]); while (char_count--) { - JDWP::set2BE(reinterpret_cast<uint8_t*>(dst++), *src++); + JDWP::Set2BE(reinterpret_cast<uint8_t*>(dst++), *src++); } } Dbg::DdmSendChunk(CHUNK_TYPE("THCR"), buf.size(), &buf[0]); } else { uint8_t buf[4]; - JDWP::set4BE(&buf[0], t->GetThinLockId()); + JDWP::Set4BE(&buf[0], t->GetThinLockId()); Dbg::DdmSendChunk(CHUNK_TYPE("THDE"), 4, buf); } } diff --git a/src/jdwp/jdwp.h b/src/jdwp/jdwp.h index a590c27..2eae216 100644 --- a/src/jdwp/jdwp.h +++ b/src/jdwp/jdwp.h @@ -50,16 +50,16 @@ typedef uint64_t FrameId; /* short-lived stack frame ID */ * Match these with the type sizes. This way we don't have to pass * a value and a length. */ -static inline FieldId ReadFieldId(const uint8_t** pBuf) { return read4BE(pBuf); } -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 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); } -static inline void SetRefTypeId(uint8_t* buf, RefTypeId val) { return set8BE(buf, val); } -static inline void SetFrameId(uint8_t* buf, FrameId val) { return set8BE(buf, val); } +static inline FieldId ReadFieldId(const uint8_t** pBuf) { return Read4BE(pBuf); } +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 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); } +static inline void SetRefTypeId(uint8_t* buf, RefTypeId val) { return Set8BE(buf, val); } +static inline void SetFrameId(uint8_t* buf, FrameId val) { return Set8BE(buf, val); } static inline void expandBufAddFieldId(ExpandBuf* pReply, FieldId id) { expandBufAdd4BE(pReply, id); } static inline void expandBufAddMethodId(ExpandBuf* pReply, MethodId id) { expandBufAdd4BE(pReply, id); } static inline void expandBufAddObjectId(ExpandBuf* pReply, ObjectId id) { expandBufAdd8BE(pReply, id); } diff --git a/src/jdwp/jdwp_adb.cc b/src/jdwp/jdwp_adb.cc index bd5e6e6..5570b53 100644 --- a/src/jdwp/jdwp_adb.cc +++ b/src/jdwp/jdwp_adb.cc @@ -385,7 +385,7 @@ static bool haveFullPacket(JdwpNetState* netState) { if (netState->inputCount < 4) { return false; } - long length = get4BE(netState->inputBuffer); + long length = Get4BE(netState->inputBuffer); return (netState->inputCount >= length); } @@ -423,16 +423,16 @@ static bool handlePacket(JdwpState* state) { cmd = cmdSet = 0; // shut up gcc - length = read4BE(&buf); - id = read4BE(&buf); - flags = read1(&buf); + length = Read4BE(&buf); + id = Read4BE(&buf); + flags = Read1(&buf); if ((flags & kJDWPFlagReply) != 0) { reply = true; - error = read2BE(&buf); + error = Read2BE(&buf); } else { reply = false; - cmdSet = read1(&buf); - cmd = read1(&buf); + cmdSet = Read1(&buf); + cmd = Read1(&buf); } CHECK_LE((int) length, netState->inputCount); diff --git a/src/jdwp/jdwp_bits.h b/src/jdwp/jdwp_bits.h index b0041f1..59ece03 100644 --- a/src/jdwp/jdwp_bits.h +++ b/src/jdwp/jdwp_bits.h @@ -26,21 +26,21 @@ namespace art { namespace JDWP { -static inline uint32_t get4BE(unsigned char const* pSrc) { +static inline uint32_t Get4BE(unsigned char const* pSrc) { return (pSrc[0] << 24) | (pSrc[1] << 16) | (pSrc[2] << 8) | pSrc[3]; } -static inline uint8_t read1(unsigned const char** ppSrc) { +static inline uint8_t Read1(unsigned const char** ppSrc) { return *(*ppSrc)++; } -static inline uint16_t read2BE(unsigned char const** ppSrc) { +static inline uint16_t Read2BE(unsigned char const** ppSrc) { const unsigned char* pSrc = *ppSrc; *ppSrc = pSrc + 2; return pSrc[0] << 8 | pSrc[1]; } -static inline uint32_t read4BE(unsigned char const** ppSrc) { +static inline uint32_t Read4BE(unsigned char const** ppSrc) { const unsigned char* pSrc = *ppSrc; uint32_t result = pSrc[0] << 24; result |= pSrc[1] << 16; @@ -50,7 +50,7 @@ static inline uint32_t read4BE(unsigned char const** ppSrc) { return result; } -static inline uint64_t read8BE(unsigned char const** ppSrc) { +static inline uint64_t Read8BE(unsigned char const** ppSrc) { const unsigned char* pSrc = *ppSrc; uint32_t high = pSrc[0]; high = (high << 8) | pSrc[1]; @@ -70,8 +70,8 @@ static inline uint64_t read8BE(unsigned char const** ppSrc) { * Returns the string and its length. (The latter is probably unnecessary * for the way we're using UTF8.) */ -static inline char* readNewUtf8String(unsigned char const** ppSrc, size_t* pLength) { - uint32_t length = read4BE(ppSrc); +static inline char* ReadNewUtf8String(unsigned char const** ppSrc, size_t* pLength) { + uint32_t length = Read4BE(ppSrc); char* buf = (char*) malloc(length+1); memcpy(buf, *ppSrc, length); buf[length] = '\0'; @@ -80,23 +80,23 @@ static inline char* readNewUtf8String(unsigned char const** ppSrc, size_t* pLeng return buf; } -static inline void set1(uint8_t* buf, uint8_t val) { +static inline void Set1(uint8_t* buf, uint8_t val) { *buf = (uint8_t)(val); } -static inline void set2BE(uint8_t* buf, uint16_t val) { +static inline void Set2BE(uint8_t* buf, uint16_t val) { *buf++ = (uint8_t)(val >> 8); *buf = (uint8_t)(val); } -static inline void set4BE(uint8_t* buf, uint32_t val) { +static inline void Set4BE(uint8_t* buf, uint32_t val) { *buf++ = (uint8_t)(val >> 24); *buf++ = (uint8_t)(val >> 16); *buf++ = (uint8_t)(val >> 8); *buf = (uint8_t)(val); } -static inline void set8BE(uint8_t* buf, uint64_t val) { +static inline void Set8BE(uint8_t* buf, uint64_t val) { *buf++ = (uint8_t)(val >> 56); *buf++ = (uint8_t)(val >> 48); *buf++ = (uint8_t)(val >> 40); @@ -110,9 +110,9 @@ static inline void set8BE(uint8_t* buf, uint64_t val) { /* * Stuff a UTF-8 string into the buffer. */ -static inline void setUtf8String(uint8_t* buf, const uint8_t* str) { +static inline void SetUtf8String(uint8_t* buf, const uint8_t* str) { uint32_t strLen = strlen((const char*)str); - set4BE(buf, strLen); + Set4BE(buf, strLen); memcpy(buf + sizeof(uint32_t), str, strLen); } diff --git a/src/jdwp/jdwp_event.cc b/src/jdwp/jdwp_event.cc index 2c05713..7d341d8 100644 --- a/src/jdwp/jdwp_event.cc +++ b/src/jdwp/jdwp_event.cc @@ -667,11 +667,11 @@ static ExpandBuf* eventPrep() { static void eventFinish(JdwpState* state, ExpandBuf* pReq) { uint8_t* buf = expandBufGetBuffer(pReq); - set4BE(buf, expandBufGetLength(pReq)); - set4BE(buf+4, state->NextRequestSerial()); - set1(buf+8, 0); /* flags */ - set1(buf+9, kJdwpEventCommandSet); - set1(buf+10, kJdwpCompositeCommand); + Set4BE(buf, expandBufGetLength(pReq)); + Set4BE(buf+4, state->NextRequestSerial()); + Set1(buf+8, 0); /* flags */ + Set1(buf+9, kJdwpEventCommandSet); + Set1(buf+10, kJdwpCompositeCommand); state->SendRequest(pReq); @@ -1165,13 +1165,13 @@ void JdwpState::DdmSendChunkV(int type, const iovec* iov, int iovcnt) { } /* form the header (JDWP plus DDMS) */ - set4BE(header, sizeof(header) + dataLen); - set4BE(header+4, NextRequestSerial()); - set1(header+8, 0); /* flags */ - set1(header+9, kJDWPDdmCmdSet); - set1(header+10, kJDWPDdmCmd); - set4BE(header+11, type); - set4BE(header+15, dataLen); + Set4BE(header, sizeof(header) + dataLen); + Set4BE(header+4, NextRequestSerial()); + Set1(header+8, 0); /* flags */ + Set1(header+9, kJDWPDdmCmdSet); + Set1(header+10, kJDWPDdmCmd); + Set4BE(header+11, type); + Set4BE(header+15, dataLen); wrapiov[0].iov_base = header; wrapiov[0].iov_len = sizeof(header); diff --git a/src/jdwp/jdwp_expand_buf.cc b/src/jdwp/jdwp_expand_buf.cc index f1675fd..71931e1 100644 --- a/src/jdwp/jdwp_expand_buf.cc +++ b/src/jdwp/jdwp_expand_buf.cc @@ -131,7 +131,7 @@ void expandBufAdd1(ExpandBuf* pBuf, uint8_t val) { */ void expandBufAdd2BE(ExpandBuf* pBuf, uint16_t val) { ensureSpace(pBuf, sizeof(val)); - set2BE(pBuf->storage + pBuf->curLen, val); + Set2BE(pBuf->storage + pBuf->curLen, val); pBuf->curLen += sizeof(val); } @@ -140,7 +140,7 @@ void expandBufAdd2BE(ExpandBuf* pBuf, uint16_t val) { */ void expandBufAdd4BE(ExpandBuf* pBuf, uint32_t val) { ensureSpace(pBuf, sizeof(val)); - set4BE(pBuf->storage + pBuf->curLen, val); + Set4BE(pBuf->storage + pBuf->curLen, val); pBuf->curLen += sizeof(val); } @@ -149,7 +149,7 @@ void expandBufAdd4BE(ExpandBuf* pBuf, uint32_t val) { */ void expandBufAdd8BE(ExpandBuf* pBuf, uint64_t val) { ensureSpace(pBuf, sizeof(val)); - set8BE(pBuf->storage + pBuf->curLen, val); + Set8BE(pBuf->storage + pBuf->curLen, val); pBuf->curLen += sizeof(val); } @@ -165,7 +165,7 @@ void expandBufAddUtf8String(ExpandBuf* pBuf, const uint8_t* str) { int strLen = strlen((const char*)str); ensureSpace(pBuf, sizeof(uint32_t) + strLen); - setUtf8String(pBuf->storage + pBuf->curLen, str); + SetUtf8String(pBuf->storage + pBuf->curLen, str); pBuf->curLen += sizeof(uint32_t) + strLen; } diff --git a/src/jdwp/jdwp_handler.cc b/src/jdwp/jdwp_handler.cc index 7003151..f408c54 100644 --- a/src/jdwp/jdwp_handler.cc +++ b/src/jdwp/jdwp_handler.cc @@ -49,10 +49,10 @@ namespace JDWP { */ static void jdwpReadLocation(const uint8_t** pBuf, JdwpLocation* pLoc) { memset(pLoc, 0, sizeof(*pLoc)); /* allows memcmp() later */ - pLoc->typeTag = read1(pBuf); + pLoc->typeTag = Read1(pBuf); pLoc->classId = ReadObjectId(pBuf); pLoc->methodId = ReadMethodId(pBuf); - pLoc->idx = read8BE(pBuf); + pLoc->idx = Read8BE(pBuf); } /* @@ -71,10 +71,10 @@ void AddLocation(ExpandBuf* pReply, const JdwpLocation* pLoc) { static uint64_t jdwpReadValue(const uint8_t** pBuf, int width) { uint64_t value = -1; switch (width) { - case 1: value = read1(pBuf); break; - case 2: value = read2BE(pBuf); break; - case 4: value = read4BE(pBuf); break; - case 8: value = read8BE(pBuf); break; + case 1: value = Read1(pBuf); break; + case 2: value = Read2BE(pBuf); break; + case 4: value = Read4BE(pBuf); break; + case 8: value = Read8BE(pBuf); break; default: LOG(FATAL) << width; break; } return value; @@ -106,7 +106,7 @@ static JdwpError finishInvoke(JdwpState* state, { CHECK(!isConstructor || objectId != 0); - uint32_t numArgs = read4BE(&buf); + uint32_t numArgs = Read4BE(&buf); LOG(VERBOSE) << StringPrintf(" --> threadId=%llx objectId=%llx", threadId, objectId); LOG(VERBOSE) << StringPrintf(" classId=%llx methodId=%x %s.%s", classId, methodId, Dbg::GetClassDescriptor(classId), Dbg::GetMethodName(classId, methodId)); @@ -118,7 +118,7 @@ static JdwpError finishInvoke(JdwpState* state, } for (uint32_t i = 0; i < numArgs; i++) { - uint8_t typeTag = read1(&buf); + uint8_t typeTag = Read1(&buf); int width = Dbg::GetTagWidth(typeTag); uint64_t value = jdwpReadValue(&buf, width); @@ -126,7 +126,7 @@ static JdwpError finishInvoke(JdwpState* state, argArray[i] = value; } - uint32_t options = read4BE(&buf); /* enum InvokeOptions bit flags */ + 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; @@ -197,7 +197,7 @@ static JdwpError handleVM_Version(JdwpState* state, const uint8_t* buf, int data */ static JdwpError handleVM_ClassesBySignature(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) { size_t strLen; - char* classDescriptor = readNewUtf8String(&buf, &strLen); + char* classDescriptor = ReadNewUtf8String(&buf, &strLen); LOG(VERBOSE) << " Req for class by signature '" << classDescriptor << "'"; /* @@ -326,7 +326,7 @@ static JdwpError handleVM_Resume(JdwpState* state, const uint8_t* buf, int dataL * The debugger wants the entire VM to exit. */ static JdwpError handleVM_Exit(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) { - uint32_t exitCode = get4BE(buf); + uint32_t exitCode = Get4BE(buf); LOG(WARNING) << "Debugger is telling the VM to exit with code=" << exitCode; @@ -342,7 +342,7 @@ static JdwpError handleVM_Exit(JdwpState* state, const uint8_t* buf, int dataLen */ static JdwpError handleVM_CreateString(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) { size_t strLen; - char* str = readNewUtf8String(&buf, &strLen); + char* str = ReadNewUtf8String(&buf, &strLen); LOG(VERBOSE) << " Req to create string '" << str << "'"; @@ -498,7 +498,7 @@ static JdwpError handleRT_Modifiers(JdwpState* state, const uint8_t* buf, int da */ static JdwpError handleRT_GetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) { RefTypeId refTypeId = ReadRefTypeId(&buf); - uint32_t numFields = read4BE(&buf); + uint32_t numFields = Read4BE(&buf); LOG(VERBOSE) << " RT_GetValues " << numFields << ":"; @@ -656,7 +656,7 @@ static JdwpError handleCT_Superclass(JdwpState* state, const uint8_t* buf, int d */ static JdwpError handleCT_SetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) { RefTypeId classId = ReadRefTypeId(&buf); - uint32_t values = read4BE(&buf); + uint32_t values = Read4BE(&buf); LOG(VERBOSE) << StringPrintf(" Req to set %d values in classId=%llx", values, classId); @@ -712,7 +712,7 @@ static JdwpError handleCT_NewInstance(JdwpState* state, const uint8_t* buf, int */ static JdwpError handleAT_newInstance(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) { RefTypeId arrayTypeId = ReadRefTypeId(&buf); - uint32_t length = read4BE(&buf); + uint32_t length = Read4BE(&buf); LOG(VERBOSE) << StringPrintf("Creating array %s[%u]", Dbg::GetClassDescriptor(arrayTypeId), length); ObjectId objectId = Dbg::CreateArrayObject(arrayTypeId, length); @@ -786,7 +786,7 @@ static JdwpError handleOR_ReferenceType(JdwpState* state, const uint8_t* buf, in */ static JdwpError handleOR_GetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) { ObjectId objectId = ReadObjectId(&buf); - uint32_t numFields = read4BE(&buf); + uint32_t numFields = Read4BE(&buf); LOG(VERBOSE) << StringPrintf(" Req for %d fields from objectId=0x%llx", numFields, objectId); @@ -805,7 +805,7 @@ static JdwpError handleOR_GetValues(JdwpState* state, const uint8_t* buf, int da */ static JdwpError handleOR_SetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) { ObjectId objectId = ReadObjectId(&buf); - uint32_t numFields = read4BE(&buf); + uint32_t numFields = Read4BE(&buf); LOG(VERBOSE) << StringPrintf(" Req to set %d fields in objectId=0x%llx", numFields, objectId); @@ -983,8 +983,8 @@ static JdwpError handleTR_ThreadGroup(JdwpState* state, const uint8_t* buf, int */ static JdwpError handleTR_Frames(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) { ObjectId threadId = ReadObjectId(&buf); - uint32_t startFrame = read4BE(&buf); - uint32_t length = read4BE(&buf); + uint32_t startFrame = Read4BE(&buf); + uint32_t length = Read4BE(&buf); if (!Dbg::ThreadExists(threadId)) { return ERR_INVALID_THREAD; @@ -1165,8 +1165,8 @@ static JdwpError handleAR_Length(JdwpState* state, const uint8_t* buf, int dataL */ static JdwpError handleAR_GetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) { ObjectId arrayId = ReadObjectId(&buf); - uint32_t firstIndex = read4BE(&buf); - uint32_t length = read4BE(&buf); + uint32_t firstIndex = Read4BE(&buf); + uint32_t length = Read4BE(&buf); uint8_t tag = Dbg::GetArrayElementTag(arrayId); LOG(VERBOSE) << StringPrintf(" Req for array values 0x%llx first=%d len=%d (elem tag=%c)", arrayId, firstIndex, length, tag); @@ -1186,8 +1186,8 @@ static JdwpError handleAR_GetValues(JdwpState* state, const uint8_t* buf, int da */ static JdwpError handleAR_SetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) { ObjectId arrayId = ReadObjectId(&buf); - uint32_t firstIndex = read4BE(&buf); - uint32_t values = read4BE(&buf); + uint32_t firstIndex = Read4BE(&buf); + uint32_t values = Read4BE(&buf); LOG(VERBOSE) << StringPrintf(" Req to set array values 0x%llx first=%d count=%d", arrayId, firstIndex, values); @@ -1258,9 +1258,9 @@ char* dvmDotToSlash(const char* str) { static JdwpError handleER_Set(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) { const uint8_t* origBuf = buf; - uint8_t eventKind = read1(&buf); - uint8_t suspendPolicy = read1(&buf); - uint32_t modifierCount = read4BE(&buf); + uint8_t eventKind = Read1(&buf); + uint8_t suspendPolicy = Read1(&buf); + uint32_t modifierCount = Read4BE(&buf); LOG(VERBOSE) << " Set(kind=" << JdwpEventKind(eventKind) << " suspend=" << JdwpSuspendPolicy(suspendPolicy) @@ -1278,14 +1278,14 @@ static JdwpError handleER_Set(JdwpState* state, const uint8_t* buf, int dataLen, * mods in JDWP doc). */ for (uint32_t idx = 0; idx < modifierCount; idx++) { - uint8_t modKind = read1(&buf); + uint8_t modKind = Read1(&buf); pEvent->mods[idx].modKind = modKind; switch (modKind) { case MK_COUNT: /* report once, when "--count" reaches 0 */ { - uint32_t count = read4BE(&buf); + uint32_t count = Read4BE(&buf); LOG(VERBOSE) << " Count: " << count; if (count == 0) { return ERR_INVALID_COUNT; @@ -1295,7 +1295,7 @@ static JdwpError handleER_Set(JdwpState* state, const uint8_t* buf, int dataLen, break; case MK_CONDITIONAL: /* conditional on expression) */ { - uint32_t exprId = read4BE(&buf); + uint32_t exprId = Read4BE(&buf); LOG(VERBOSE) << " Conditional: " << exprId; pEvent->mods[idx].conditional.exprId = exprId; } @@ -1319,7 +1319,7 @@ static JdwpError handleER_Set(JdwpState* state, const uint8_t* buf, int dataLen, char* pattern; size_t strLen; - pattern = readNewUtf8String(&buf, &strLen); + pattern = ReadNewUtf8String(&buf, &strLen); LOG(VERBOSE) << StringPrintf(" ClassMatch: '%s'", pattern); /* pattern is "java.foo.*", we want "java/foo/ *" */ pEvent->mods[idx].classMatch.classPattern = dvmDotToSlash(pattern); @@ -1331,7 +1331,7 @@ static JdwpError handleER_Set(JdwpState* state, const uint8_t* buf, int dataLen, char* pattern; size_t strLen; - pattern = readNewUtf8String(&buf, &strLen); + pattern = ReadNewUtf8String(&buf, &strLen); LOG(VERBOSE) << StringPrintf(" ClassExclude: '%s'", pattern); pEvent->mods[idx].classExclude.classPattern = dvmDotToSlash(pattern); free(pattern); @@ -1353,8 +1353,8 @@ static JdwpError handleER_Set(JdwpState* state, const uint8_t* buf, int dataLen, uint8_t caught, uncaught; exceptionOrNull = ReadRefTypeId(&buf); - caught = read1(&buf); - uncaught = read1(&buf); + caught = Read1(&buf); + uncaught = Read1(&buf); LOG(VERBOSE) << StringPrintf(" ExceptionOnly: type=%llx(%s) caught=%d uncaught=%d", exceptionOrNull, (exceptionOrNull == 0) ? "null" : Dbg::GetClassDescriptor(exceptionOrNull), caught, uncaught); @@ -1378,8 +1378,8 @@ static JdwpError handleER_Set(JdwpState* state, const uint8_t* buf, int dataLen, uint32_t size, depth; threadId = ReadObjectId(&buf); - size = read4BE(&buf); - depth = read4BE(&buf); + size = Read4BE(&buf); + depth = Read4BE(&buf); LOG(VERBOSE) << StringPrintf(" Step: thread=%llx", threadId) << " size=" << JdwpStepSize(size) << " depth=" << JdwpStepDepth(depth); @@ -1435,8 +1435,8 @@ static JdwpError handleER_Set(JdwpState* state, const uint8_t* buf, int dataLen, */ static JdwpError handleER_Clear(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) { uint8_t eventKind; - eventKind = read1(&buf); - uint32_t requestId = read4BE(&buf); + eventKind = Read1(&buf); + uint32_t requestId = Read4BE(&buf); LOG(VERBOSE) << StringPrintf(" Req to clear eventKind=%d requestId=%#x", eventKind, requestId); @@ -1451,14 +1451,14 @@ static JdwpError handleER_Clear(JdwpState* state, const uint8_t* buf, int dataLe static JdwpError handleSF_GetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) { ObjectId threadId = ReadObjectId(&buf); FrameId frameId = ReadFrameId(&buf); - uint32_t slots = read4BE(&buf); + uint32_t slots = Read4BE(&buf); LOG(VERBOSE) << StringPrintf(" Req for %d slots in threadId=%llx frameId=%llx", slots, threadId, frameId); expandBufAdd4BE(pReply, slots); /* "int values" */ for (uint32_t i = 0; i < slots; i++) { - uint32_t slot = read4BE(&buf); - uint8_t reqSigByte = read1(&buf); + uint32_t slot = Read4BE(&buf); + uint8_t reqSigByte = Read1(&buf); LOG(VERBOSE) << StringPrintf(" --> slot %d '%c'", slot, reqSigByte); @@ -1476,13 +1476,13 @@ static JdwpError handleSF_GetValues(JdwpState* state, const uint8_t* buf, int da static JdwpError handleSF_SetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) { ObjectId threadId = ReadObjectId(&buf); FrameId frameId = ReadFrameId(&buf); - uint32_t slots = read4BE(&buf); + uint32_t slots = Read4BE(&buf); LOG(VERBOSE) << StringPrintf(" Req to set %d slots in threadId=%llx frameId=%llx", slots, threadId, frameId); for (uint32_t i = 0; i < slots; i++) { - uint32_t slot = read4BE(&buf); - uint8_t sigByte = read1(&buf); + uint32_t slot = Read4BE(&buf); + uint8_t sigByte = Read1(&buf); int width = Dbg::GetTagWidth(sigByte); uint64_t value = jdwpReadValue(&buf, width); @@ -1784,13 +1784,13 @@ void JdwpState::ProcessRequest(const JdwpReqHeader* pHeader, const uint8_t* buf, * If we encountered an error, only send the header back. */ uint8_t* replyBuf = expandBufGetBuffer(pReply); - set4BE(replyBuf + 4, pHeader->id); - set1(replyBuf + 8, kJDWPFlagReply); - set2BE(replyBuf + 9, result); + Set4BE(replyBuf + 4, pHeader->id); + Set1(replyBuf + 8, kJDWPFlagReply); + Set2BE(replyBuf + 9, result); if (result == ERR_NONE) { - set4BE(replyBuf + 0, expandBufGetLength(pReply)); + Set4BE(replyBuf + 0, expandBufGetLength(pReply)); } else { - set4BE(replyBuf + 0, kJDWPHeaderLen); + Set4BE(replyBuf + 0, kJDWPHeaderLen); } respLen = expandBufGetLength(pReply) - kJDWPHeaderLen; diff --git a/src/jdwp/jdwp_socket.cc b/src/jdwp/jdwp_socket.cc index 28786ed..aba893d 100644 --- a/src/jdwp/jdwp_socket.cc +++ b/src/jdwp/jdwp_socket.cc @@ -494,7 +494,7 @@ static bool haveFullPacket(JdwpNetState* netState) { if (netState->inputCount < 4) { return false; } - long length = get4BE(netState->inputBuffer); + long length = Get4BE(netState->inputBuffer); return (netState->inputCount >= length); } @@ -531,16 +531,16 @@ static void dumpPacket(const unsigned char* packetBuf) { cmd = cmdSet = 0xcc; - length = read4BE(&buf); - id = read4BE(&buf); - flags = read1(&buf); + length = Read4BE(&buf); + id = Read4BE(&buf); + flags = Read1(&buf); if ((flags & kJDWPFlagReply) != 0) { reply = true; - error = read2BE(&buf); + error = Read2BE(&buf); } else { reply = false; - cmdSet = read1(&buf); - cmd = read1(&buf); + cmdSet = Read1(&buf); + cmd = Read1(&buf); } dataLen = length - (buf - packetBuf); @@ -570,16 +570,16 @@ static bool handlePacket(JdwpState* state) { /*dumpPacket(netState->inputBuffer);*/ - length = read4BE(&buf); - id = read4BE(&buf); - flags = read1(&buf); + length = Read4BE(&buf); + id = Read4BE(&buf); + flags = Read1(&buf); if ((flags & kJDWPFlagReply) != 0) { reply = true; - error = read2BE(&buf); + error = Read2BE(&buf); } else { reply = false; - cmdSet = read1(&buf); - cmd = read1(&buf); + cmdSet = Read1(&buf); + cmd = Read1(&buf); } CHECK_LE((int) length, netState->inputCount); diff --git a/src/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc b/src/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc index 4f06e68..f423e38 100644 --- a/src/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc +++ b/src/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc @@ -119,12 +119,12 @@ static void ThreadStatsGetterCallback(Thread* t, void* context) { int utime, stime, task_cpu; GetTaskStats(t->GetTid(), utime, stime, task_cpu); - JDWP::set4BE(buf+0, t->GetThinLockId()); - JDWP::set1(buf+4, t->GetState()); - JDWP::set4BE(buf+5, t->GetTid()); - JDWP::set4BE(buf+9, utime); - JDWP::set4BE(buf+13, stime); - JDWP::set1(buf+17, t->IsDaemon()); + JDWP::Set4BE(buf+0, t->GetThinLockId()); + JDWP::Set1(buf+4, t->GetState()); + JDWP::Set4BE(buf+5, t->GetTid()); + JDWP::Set4BE(buf+9, utime); + JDWP::Set4BE(buf+13, stime); + JDWP::Set1(buf+17, t->IsDaemon()); *ptr += kThstBytesPerEntry; } @@ -140,9 +140,9 @@ static jbyteArray DdmVmInternal_getThreadStats(JNIEnv* env, jclass) { bytes.resize(kThstHeaderLen + thread_count * kThstBytesPerEntry); - JDWP::set1(&bytes[0], kThstHeaderLen); - JDWP::set1(&bytes[1], kThstBytesPerEntry); - JDWP::set2BE(&bytes[2], thread_count); + JDWP::Set1(&bytes[0], kThstHeaderLen); + JDWP::Set1(&bytes[1], kThstBytesPerEntry); + JDWP::Set2BE(&bytes[2], thread_count); uint8_t* ptr = &bytes[kThstHeaderLen]; thread_list->ForEach(ThreadStatsGetterCallback, &ptr); |