Implement enough JDWP functionality that we can attach jdb.
You can also try "classes" and "classpath", though anything else
deadlocks because we're suspended but jdb thinks we aren't. I don't
think that's a new bug with this patch, though, so I'll look at that
next.
Change-Id: I54456b6a7fe72642be696c66aa485dc0c8a7f913
diff --git a/src/jdwp/jdwp_expand_buf.cc b/src/jdwp/jdwp_expand_buf.cc
index f5e24b2..30ebf00 100644
--- a/src/jdwp/jdwp_expand_buf.cc
+++ b/src/jdwp/jdwp_expand_buf.cc
@@ -153,8 +153,7 @@
pBuf->curLen += sizeof(val);
}
-static void SetUtf8String(uint8_t* buf, const uint8_t* str) {
- uint32_t strLen = strlen((const char*)str);
+static void SetUtf8String(uint8_t* buf, const char* str, size_t strLen) {
Set4BE(buf, strLen);
memcpy(buf + sizeof(uint32_t), str, strLen);
}
@@ -167,11 +166,11 @@
* they can be null-terminated (either they don't have null bytes or they
* have stored null bytes in a multi-byte encoding).
*/
-void expandBufAddUtf8String(ExpandBuf* pBuf, const uint8_t* str) {
- int strLen = strlen((const char*)str);
+void expandBufAddUtf8String(ExpandBuf* pBuf, const char* str) {
+ int strLen = strlen(str);
ensureSpace(pBuf, sizeof(uint32_t) + strLen);
- SetUtf8String(pBuf->storage + pBuf->curLen, str);
+ SetUtf8String(pBuf->storage + pBuf->curLen, str, strLen);
pBuf->curLen += sizeof(uint32_t) + strLen;
}