summaryrefslogtreecommitdiffstats
path: root/runtime/jdwp
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2015-04-10 14:23:35 -0700
committerMathieu Chartier <mathieuc@google.com>2015-04-13 16:15:22 -0700
commitd3ed9a320a89cb9b91b2361892c043ab7e112717 (patch)
tree94d2b646e8ff9b28e0bef735804ce17a6a8be729 /runtime/jdwp
parent4b5673b7387804947a1605a906deee132ab28f14 (diff)
downloadart-d3ed9a320a89cb9b91b2361892c043ab7e112717.tar.gz
art-d3ed9a320a89cb9b91b2361892c043ab7e112717.tar.bz2
art-d3ed9a320a89cb9b91b2361892c043ab7e112717.zip
Fix DCHECK failures from Class::VisitFieldRoots
We now use GetDeclaringClassUnchecked when marking roots to fix flaky test failures. Fixed a race condition in root marking where we could have non zero field array length with a null pointer. Fixed a race condition where we could be marking roots before FixupTemporaryDeclaringClass had finished. The solution is to only do the declaring class CHECK if we are at least resolved. Fixed JDWP tests by changing FieldId / MethodId to be 64 bits. Also some cleanup. Change-Id: Ibac09519860d93c3f68a5cc964bbc91dc10a279a
Diffstat (limited to 'runtime/jdwp')
-rw-r--r--runtime/jdwp/jdwp.h14
-rw-r--r--runtime/jdwp/jdwp_event.cc2
-rw-r--r--runtime/jdwp/jdwp_handler.cc10
-rw-r--r--runtime/jdwp/jdwp_request.cc4
4 files changed, 15 insertions, 15 deletions
diff --git a/runtime/jdwp/jdwp.h b/runtime/jdwp/jdwp.h
index a503b17e87..8dffee606c 100644
--- a/runtime/jdwp/jdwp.h
+++ b/runtime/jdwp/jdwp.h
@@ -51,22 +51,24 @@ namespace JDWP {
* Fundamental types.
*
* ObjectId and RefTypeId must be the same size.
+ * Its OK to change MethodId and FieldId sizes as long as the size is <= 8 bytes.
+ * Note that ArtFields are 64 bit pointers on 64 bit targets. So this one must remain 8 bytes.
*/
-typedef uint32_t FieldId; /* static or instance field */
-typedef uint32_t MethodId; /* any kind of method, including constructors */
+typedef uint64_t FieldId; /* static or instance field */
+typedef uint64_t MethodId; /* any kind of method, including constructors */
typedef uint64_t ObjectId; /* any object (threadID, stringID, arrayID, etc) */
typedef uint64_t RefTypeId; /* like ObjectID, but unique for Class objects */
typedef uint64_t FrameId; /* short-lived stack frame ID */
ObjectId ReadObjectId(const uint8_t** 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 SetFieldId(uint8_t* buf, FieldId val) { return Set8BE(buf, val); }
+static inline void SetMethodId(uint8_t* buf, MethodId val) { return Set8BE(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 expandBufAddFieldId(ExpandBuf* pReply, FieldId id) { expandBufAdd8BE(pReply, id); }
+static inline void expandBufAddMethodId(ExpandBuf* pReply, MethodId id) { expandBufAdd8BE(pReply, id); }
static inline void expandBufAddObjectId(ExpandBuf* pReply, ObjectId id) { expandBufAdd8BE(pReply, id); }
static inline void expandBufAddRefTypeId(ExpandBuf* pReply, RefTypeId id) { expandBufAdd8BE(pReply, id); }
static inline void expandBufAddFrameId(ExpandBuf* pReply, FrameId id) { expandBufAdd8BE(pReply, id); }
diff --git a/runtime/jdwp/jdwp_event.cc b/runtime/jdwp/jdwp_event.cc
index ccf8bffba3..1ec800fce6 100644
--- a/runtime/jdwp/jdwp_event.cc
+++ b/runtime/jdwp/jdwp_event.cc
@@ -957,7 +957,7 @@ void JdwpState::PostFieldEvent(const EventLocation* pLoc, ArtField* field,
VLOG(jdwp) << StringPrintf(" this=%#" PRIx64, instance_id);
VLOG(jdwp) << StringPrintf(" type=%#" PRIx64, field_type_id) << " "
<< Dbg::GetClassName(field_id);
- VLOG(jdwp) << StringPrintf(" field=%#" PRIx32, field_id) << " "
+ VLOG(jdwp) << StringPrintf(" field=%#" PRIx64, field_id) << " "
<< Dbg::GetFieldName(field_id);
VLOG(jdwp) << " suspend_policy=" << suspend_policy;
}
diff --git a/runtime/jdwp/jdwp_handler.cc b/runtime/jdwp/jdwp_handler.cc
index d0ca214ee4..2457f1452c 100644
--- a/runtime/jdwp/jdwp_handler.cc
+++ b/runtime/jdwp/jdwp_handler.cc
@@ -38,11 +38,11 @@ namespace art {
namespace JDWP {
std::string DescribeField(const FieldId& field_id) {
- return StringPrintf("%#x (%s)", field_id, Dbg::GetFieldName(field_id).c_str());
+ return StringPrintf("%#" PRIx64 " (%s)", field_id, Dbg::GetFieldName(field_id).c_str());
}
std::string DescribeMethod(const MethodId& method_id) {
- return StringPrintf("%#x (%s)", method_id, Dbg::GetMethodName(method_id).c_str());
+ return StringPrintf("%#" PRIx64 " (%s)", method_id, Dbg::GetMethodName(method_id).c_str());
}
std::string DescribeRefTypeId(const RefTypeId& ref_type_id) {
@@ -101,8 +101,8 @@ static JdwpError RequestInvoke(JdwpState*, Request* request, ExpandBuf* pReply,
VLOG(jdwp) << StringPrintf(" --> thread_id=%#" PRIx64 " object_id=%#" PRIx64,
thread_id, object_id);
- VLOG(jdwp) << StringPrintf(" class_id=%#" PRIx64 " method_id=%x %s.%s", class_id,
- method_id, Dbg::GetClassName(class_id).c_str(),
+ VLOG(jdwp) << StringPrintf(" class_id=%#" PRIx64 " method_id=%#" PRIx64 " %s.%s",
+ class_id, method_id, Dbg::GetClassName(class_id).c_str(),
Dbg::GetMethodName(method_id).c_str());
VLOG(jdwp) << StringPrintf(" %d args:", arg_count);
@@ -256,8 +256,6 @@ static JdwpError VM_TopLevelThreadGroups(JdwpState*, Request*, ExpandBuf* pReply
/*
* Respond with the sizes of the basic debugger types.
- *
- * All IDs are 8 bytes.
*/
static JdwpError VM_IDSizes(JdwpState*, Request*, ExpandBuf* pReply)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
diff --git a/runtime/jdwp/jdwp_request.cc b/runtime/jdwp/jdwp_request.cc
index 7b15d6de11..18f40a143c 100644
--- a/runtime/jdwp/jdwp_request.cc
+++ b/runtime/jdwp/jdwp_request.cc
@@ -87,13 +87,13 @@ uint32_t Request::ReadUnsigned32(const char* what) {
}
FieldId Request::ReadFieldId() {
- FieldId id = Read4BE();
+ FieldId id = Read8BE();
VLOG(jdwp) << " field id " << DescribeField(id);
return id;
}
MethodId Request::ReadMethodId() {
- MethodId id = Read4BE();
+ MethodId id = Read8BE();
VLOG(jdwp) << " method id " << DescribeMethod(id);
return id;
}