Home | History | Annotate | Download | only in runtime

Lines Matching refs:JDWP

35 #include "jdwp/jdwp_priv.h"
36 #include "jdwp/object_registry.h"
248 // going to be called right after us. To avoid sending JDWP events twice for this location,
256 // sending JDWP events twice for this location, we report the event(s) in MethodExited.
298 // JDWP events in the same packet: METHOD_ENTRY, METHOD_EXIT, BREAKPOINT and/or SINGLE_STEP.
360 // JDWP is allowed unless the Zygote forbids it.
363 // Was there a -Xrunjdwp or -agentlib:jdwp= argument on the command line?
366 // JDWP options for debugging. Only valid if IsJdwpConfigured() is true.
367 static JDWP::JdwpOptions gJdwpOptions;
369 // Runtime JDWP state.
370 static JDWP::JdwpState* gJdwpState = nullptr;
428 VLOG(jdwp) << "Hit breakpoint #" << i << ": " << gBreakpoints[i];
443 static mirror::Array* DecodeNonNullArray(JDWP::RefTypeId id, JDWP::JdwpError* error)
447 *error = JDWP::ERR_INVALID_OBJECT;
451 *error = JDWP::ERR_INVALID_ARRAY;
454 *error = JDWP::ERR_NONE;
458 static mirror::Class* DecodeClass(JDWP::RefTypeId id, JDWP::JdwpError* error)
462 *error = JDWP::ERR_INVALID_OBJECT;
466 *error = JDWP::ERR_INVALID_CLASS;
469 *error = JDWP::ERR_NONE;
473 static Thread* DecodeThread(ScopedObjectAccessUnchecked& soa, JDWP::ObjectId thread_id,
474 JDWP::JdwpError* error)
480 *error = JDWP::ERR_INVALID_OBJECT;
487 *error = JDWP::ERR_INVALID_THREAD;
495 *error = (thread == nullptr) ? JDWP::ERR_THREAD_NOT_ALIVE : JDWP::ERR_NONE;
499 static JDWP::JdwpTag BasicTagFromDescriptor(const char* descriptor) {
500 // JDWP deliberately uses the descriptor characters' ASCII values for its enum.
502 return static_cast<JDWP::JdwpTag>(descriptor[0]);
505 static JDWP::JdwpTag BasicTagFromClass(mirror::Class* klass)
512 static JDWP::JdwpTag TagFromClass(const ScopedObjectAccessUnchecked& soa, mirror::Class* c)
516 return JDWP::JT_ARRAY;
519 return JDWP::JT_STRING;
522 return JDWP::JT_CLASS_OBJECT;
527 return JDWP::JT_THREAD;
534 return JDWP::JT_THREAD_GROUP;
541 return JDWP::JT_CLASS_LOADER;
544 return JDWP::JT_OBJECT;
555 JDWP::JdwpTag Dbg::TagFromObject(const ScopedObjectAccessUnchecked& soa, mirror::Object* o) {
556 return (o == nullptr) ? JDWP::JT_OBJECT : TagFromClass(soa, o->GetClass());
559 static bool IsPrimitiveTag(JDWP::JdwpTag tag) {
561 case JDWP::JT_BOOLEAN:
562 case JDWP::JT_BYTE:
563 case JDWP::JT_CHAR:
564 case JDWP::JT_FLOAT:
565 case JDWP::JT_DOUBLE:
566 case JDWP::JT_INT:
567 case JDWP::JT_LONG:
568 case JDWP::JT_SHORT:
569 case JDWP::JT_VOID:
578 // No JDWP for you!
585 // Init JDWP if the debugger is enabled. This may connect out to a
588 gJdwpState = JDWP::JdwpState::Create(&gJdwpOptions);
605 // Post VM_DEATH event before the JDWP connection is closed (either by the JDWP thread or the
610 // Prevent the JDWP thread from processing JDWP incoming packets after we close the connection.
621 VLOG(jdwp) << "Sending heap info to DDM";
626 VLOG(jdwp) << "Dumping heap to DDM";
631 VLOG(jdwp) << "Dumping native heap to DDM";
654 VLOG(jdwp) << "JDWP has attached";
668 // Only called from the JDWP handler thread.
751 void Dbg::ConfigureJdwp(const JDWP::JdwpOptions& jdwp_options) {
752 CHECK_NE(jdwp_options.transport, JDWP::kJdwpTransportUnknown);
769 std::string Dbg::GetClassName(JDWP::RefTypeId class_id) {
770 JDWP::JdwpError error;
773 if (error == JDWP::ERR_NONE) {
793 JDWP::JdwpError Dbg::GetClassObject(JDWP::RefTypeId id, JDWP::ObjectId* class_object_id) {
794 JDWP::JdwpError status;
801 return JDWP::ERR_NONE;
804 JDWP::JdwpError Dbg::GetSuperclass(JDWP::RefTypeId id, JDWP::RefTypeId* superclass_id) {
805 JDWP::JdwpError status;
817 return JDWP::ERR_NONE;
820 JDWP::JdwpError Dbg::GetClassLoader(JDWP::RefTypeId id, JDWP::ExpandBuf* pReply) {
821 JDWP::JdwpError error;
824 return JDWP::ERR_INVALID_OBJECT;
827 return JDWP::ERR_NONE;
830 JDWP::JdwpError Dbg::GetModifiers(JDWP::RefTypeId id, JDWP::ExpandBuf* pReply) {
831 JDWP::JdwpError error;
841 // Class.getModifiers doesn't return it, but JDWP does, so we set it here.
848 return JDWP::ERR_NONE;
851 JDWP::JdwpError Dbg::GetMonitorInfo(JDWP::ObjectId object_id, JDWP::ExpandBuf* reply) {
852 JDWP::JdwpError error;
855 return JDWP::ERR_INVALID_OBJECT;
879 return JDWP::ERR_NONE;
882 JDWP::JdwpError Dbg::GetOwnedMonitors(JDWP::ObjectId thread_id,
883 std::vector<JDWP::ObjectId>* monitors,
887 std::vector<JDWP::ObjectId>* monitor_vector,
913 std::vector<JDWP::ObjectId>* const monitors;
918 JDWP::JdwpError error;
924 return JDWP::ERR_THREAD_NOT_SUSPENDED;
929 return JDWP::ERR_NONE;
932 JDWP::JdwpError Dbg::GetContendedMonitor(JDWP::ObjectId thread_id,
933 JDWP::ObjectId* contended_monitor) {
936 JDWP::JdwpError error;
942 return JDWP::ERR_THREAD_NOT_SUSPENDED;
948 return JDWP::ERR_NONE;
951 JDWP::JdwpError Dbg::GetInstanceCounts(const std::vector<JDWP::RefTypeId>& class_ids,
958 JDWP::JdwpError error;
967 return JDWP::ERR_NONE;
970 JDWP::JdwpError Dbg::GetInstances(JDWP::RefTypeId class_id, int32_t max_count,
971 std::vector<JDWP::ObjectId>* instances) {
975 JDWP::JdwpError error;
985 return JDWP::ERR_NONE;
988 JDWP::JdwpError Dbg::GetReferringObjects(JDWP::ObjectId object_id, int32_t max_count,
989 std::vector<JDWP::ObjectId>* referring_objects) {
992 JDWP::JdwpError error;
995 return JDWP::ERR_INVALID_OBJECT;
1002 return JDWP::ERR_NONE;
1005 JDWP::JdwpError Dbg::DisableCollection(JDWP::ObjectId object_id) {
1006 JDWP::JdwpError error;
1009 return JDWP::ERR_INVALID_OBJECT;
1012 return JDWP::ERR_NONE;
1015 JDWP::JdwpError Dbg::EnableCollection(JDWP::ObjectId object_id) {
1016 JDWP::JdwpError error;
1018 // Unlike DisableCollection, JDWP specs do not state an invalid object causes an error. The RI
1023 return JDWP::ERR_INVALID_OBJECT;
1026 return JDWP::ERR_NONE;
1029 JDWP::JdwpError Dbg::IsCollected(JDWP::ObjectId object_id, bool* is_collected) {
1033 return JDWP::ERR_INVALID_OBJECT;
1035 // JDWP specs state an INVALID_OBJECT error is returned if the object ID is not valid. However
1037 JDWP::JdwpError error;
1042 return JDWP::ERR_NONE;
1045 void Dbg::DisposeObject(JDWP::ObjectId object_id, uint32_t reference_count) {
1049 JDWP::JdwpTypeTag Dbg::GetTypeTag(mirror::Class* klass) {
1052 return JDWP::TT_ARRAY;
1054 return JDWP::TT_INTERFACE;
1056 return JDWP::TT_CLASS;
1060 JDWP::JdwpError Dbg::GetReflectedType(JDWP::RefTypeId class_id, JDWP::ExpandBuf* pReply) {
1061 JDWP::JdwpError error;
1067 JDWP::JdwpTypeTag type_tag = GetTypeTag(c);
1070 return JDWP::ERR_NONE;
1073 void Dbg::GetClassList(std::vector<JDWP::RefTypeId>* classes) {
1078 explicit ClassListCreator(std::vector<JDWP::RefTypeId>* classes_in) : classes(classes_in) {
1094 std::vector<JDWP::RefTypeId>* const classes;
1102 JDWP::JdwpError Dbg::GetClassInfo(JDWP::RefTypeId class_id, JDWP::JdwpTypeTag* pTypeTag,
1104 JDWP::JdwpError error;
1111 *pStatus = JDWP::CS_VERIFIED | JDWP::CS_PREPARED;
1112 *pTypeTag = JDWP::TT_ARRAY;
1115 *pStatus = JDWP::CS_ERROR;
1117 *pStatus = JDWP::CS_VERIFIED | JDWP::CS_PREPARED | JDWP::CS_INITIALIZED;
1119 *pTypeTag = c->IsInterface() ? JDWP::TT_INTERFACE : JDWP::TT_CLASS;
1126 return JDWP::ERR_NONE;
1129 void Dbg::FindLoadedClassBySignature(const char* descriptor, std::vector<JDWP::RefTypeId>* ids) {
1138 JDWP::JdwpError Dbg::GetReferenceType(JDWP::ObjectId object_id, JDWP::ExpandBuf* pReply) {
1139 JDWP::JdwpError error;
1142 return JDWP::ERR_INVALID_OBJECT;
1145 JDWP::JdwpTypeTag type_tag = GetTypeTag(o->GetClass());
1146 JDWP::RefTypeId type_id = gRegistry->AddRefType(o->GetClass());
1151 return JDWP::ERR_NONE;
1154 JDWP::JdwpError Dbg::GetSignature(JDWP::RefTypeId class_id, std::string* signature) {
1155 JDWP::JdwpError error;
1162 return JDWP::ERR_NONE;
1165 JDWP::JdwpError Dbg::GetSourceFile(JDWP::RefTypeId class_id, std::string* result) {
1166 JDWP::JdwpError error;
1173 return JDWP::ERR_ABSENT_INFORMATION;
1176 return JDWP::ERR_NONE;
1179 JDWP::JdwpError Dbg::GetObjectTag(JDWP::ObjectId object_id, uint8_t* tag) {
1181 JDWP::JdwpError error;
1183 if (error != JDWP::ERR_NONE) {
1184 *tag = JDWP::JT_VOID;
1188 return JDWP::ERR_NONE;
1191 size_t Dbg::GetTagWidth(JDWP::JdwpTag tag) {
1193 case JDWP::JT_VOID:
1195 case JDWP::JT_BYTE:
1196 case JDWP::JT_BOOLEAN:
1198 case JDWP::JT_CHAR:
1199 case JDWP::JT_SHORT:
1201 case JDWP::JT_FLOAT:
1202 case JDWP::JT_INT:
1204 case JDWP::JT_ARRAY:
1205 case JDWP::JT_OBJECT:
1206 case JDWP::JT_STRING:
1207 case JDWP::JT_THREAD:
1208 case JDWP::JT_THREAD_GROUP:
1209 case JDWP::JT_CLASS_LOADER:
1210 case JDWP::JT_CLASS_OBJECT:
1211 return sizeof(JDWP::ObjectId);
1212 case JDWP::JT_DOUBLE:
1213 case JDWP::JT_LONG:
1221 JDWP::JdwpError Dbg::GetArrayLength(JDWP::ObjectId array_id, int32_t* length) {
1222 JDWP::JdwpError error;
1228 return JDWP::ERR_NONE;
1231 JDWP::JdwpError Dbg::OutputArray(JDWP::ObjectId array_id, int offset, int count, JDWP::ExpandBuf* pReply) {
1232 JDWP::JdwpError error;
1240 return JDWP::ERR_INVALID_LENGTH;
1242 JDWP::JdwpTag element_tag = BasicTagFromClass(a->GetClass()->GetComponentType());
1251 for (int i = 0; i < count; ++i) JDWP::Write8BE(&dst, src8[offset + i]);
1254 for (int i = 0; i < count; ++i) JDWP::Write4BE(&dst, src4[offset + i]);
1257 for (int i = 0; i < count; ++i) JDWP::Write2BE(&dst, src2[offset + i]);
1267 JDWP::JdwpTag specific_tag = (element != nullptr) ? TagFromObject(soa, element)
1274 return JDWP::ERR_NONE;
1278 static void CopyArrayData(mirror::Array* a, JDWP::Request* src, int offset, int count)
1289 JDWP::JdwpError Dbg::SetArrayElements(JDWP::ObjectId array_id, int offset, int count,
1290 JDWP::Request* request) {
1291 JDWP::JdwpError error;
1299 return JDWP::ERR_INVALID_LENGTH;
1301 JDWP::JdwpTag element_tag = BasicTagFromClass(dst->GetClass()->GetComponentType());
1317 JDWP::ObjectId id = request->ReadObjectId();
1319 if (error != JDWP::ERR_NONE) {
1326 return JDWP::ERR_NONE;
1329 JDWP::JdwpError Dbg::CreateString(const std::string& str, JDWP::ObjectId* new_string_id) {
1337 return JDWP::ERR_OUT_OF_MEMORY;
1340 return JDWP::ERR_NONE;
1343 JDWP::JdwpError Dbg::CreateObject(JDWP::RefTypeId class_id, JDWP::ObjectId* new_object_id) {
1344 JDWP::JdwpError error;
1357 return JDWP::ERR_OUT_OF_MEMORY;
1360 return JDWP::ERR_NONE;
1366 JDWP::JdwpError Dbg::CreateArrayObject(JDWP::RefTypeId array_class_id, uint32_t length,
1367 JDWP::ObjectId* new_array_id) {
1368 JDWP::JdwpError error;
1384 return JDWP::ERR_OUT_OF_MEMORY;
1387 return JDWP::ERR_NONE;
1390 JDWP::FieldId Dbg::ToFieldId(const ArtField* f) {
1391 return static_cast<JDWP::FieldId>(reinterpret_cast<uintptr_t>(f));
1394 static JDWP::MethodId ToMethodId(const ArtMethod* m)
1396 return static_cast<JDWP::MethodId>(reinterpret_cast<uintptr_t>(m));
1399 static ArtField* FromFieldId(JDWP::FieldId fid)
1404 static ArtMethod* FromMethodId(JDWP::MethodId mid)
1409 bool Dbg::MatchThread(JDWP::ObjectId expected_thread_id, Thread* event_thread) {
1411 JDWP::JdwpError error;
1417 bool Dbg::MatchLocation(const JDWP::JdwpLocation& expected_location,
1418 const JDWP::EventLocation& event_location) {
1426 bool Dbg::MatchType(mirror::Class* event_class, JDWP::RefTypeId class_id) {
1430 JDWP::JdwpError error;
1436 bool Dbg::MatchField(JDWP::RefTypeId expected_type_id, JDWP::FieldId expected_field_id,
1445 bool Dbg::MatchInstance(JDWP::ObjectId expected_instance_id, mirror::Object* event_instance) {
1446 JDWP::JdwpError error;
1451 void Dbg::SetJdwpLocation(JDWP::JdwpLocation* location, ArtMethod* m, uint32_t dex_pc)
1466 std::string Dbg::GetMethodName(JDWP::MethodId method_id) {
1474 std::string Dbg::GetFieldName(JDWP::FieldId field_id) {
1522 static uint16_t DemangleSlot(uint16_t slot, ArtMethod* m, JDWP::JdwpError* error)
1531 *error = JDWP::ERR_NONE;
1538 *error = JDWP::ERR_NONE;
1545 *error = JDWP::ERR_INVALID_SLOT;
1549 JDWP::JdwpError Dbg::OutputDeclaredFields(JDWP::RefTypeId class_id, bool with_generic, JDWP::ExpandBuf* pReply) {
1550 JDWP::JdwpError error;
1572 return JDWP::ERR_NONE;
1575 JDWP::JdwpError Dbg::OutputDeclaredMethods(JDWP::RefTypeId class_id, bool with_generic,
1576 JDWP::ExpandBuf* pReply) {
1577 JDWP::JdwpError error;
1603 return JDWP::ERR_NONE;
1606 JDWP::JdwpError Dbg::OutputDeclaredInterfaces(JDWP::RefTypeId class_id, JDWP::ExpandBuf* pReply) {
1607 JDWP::JdwpError error;
1620 return JDWP::ERR_NONE;
1623 void Dbg::OutputLineTable(JDWP::RefTypeId, JDWP::MethodId method_id, JDWP::ExpandBuf* pReply) {
1626 JDWP::ExpandBuf* pReply;
1665 JDWP::Set4BE(expandBufGetBuffer(pReply) + numLinesOffset, context.numItems);
1668 void Dbg::OutputVariableTable(JDWP::RefTypeId, JDWP::MethodId method_id, bool with_generic,
1669 JDWP::ExpandBuf* pReply) {
1672 JDWP::ExpandBuf* pReply;
1681 VLOG(jdwp) << StringPrintf(" %2zd: %d(%d) '%s' '%s' '%s' actual slot=%d mangled slot=%d",
1724 JDWP::Set4BE(expandBufGetBuffer(pReply) + variable_count_offset, context.variable_count);
1727 void Dbg::OutputMethodReturnValue(JDWP::MethodId method_id, const JValue* return_value,
1728 JDWP::ExpandBuf* pReply) {
1730 JDWP::JdwpTag tag = BasicTagFromDescriptor(m->GetShorty());
1734 void Dbg::OutputFieldValue(JDWP::FieldId field_id, const JValue* field_value,
1735 JDWP::ExpandBuf* pReply) {
1737 JDWP::JdwpTag tag = BasicTagFromDescriptor(f->GetTypeDescriptor());
1741 JDWP::JdwpError Dbg::GetBytecodes(JDWP::RefTypeId, JDWP::MethodId method_id,
1745 return JDWP::ERR_INVALID_METHODID;
1754 return JDWP::ERR_NONE;
1757 JDWP::JdwpTag Dbg::GetFieldBasicTag(JDWP::FieldId field_id) {
1761 JDWP::JdwpTag Dbg::GetStaticFieldBasicTag(JDWP::FieldId field_id) {
1788 // Int and Float must be treated as 32-bit values in JDWP.
1794 // Long and Double must be treated as 64-bit values in JDWP.
1810 static JDWP::JdwpError GetFieldValueImpl(JDWP::RefTypeId ref_type_id, JDWP::ObjectId object_id,
1811 JDWP::FieldId field_id, JDWP::ExpandBuf* pReply,
1814 JDWP::JdwpError error;
1821 if ((!is_static && o == nullptr) || error != JDWP::ERR_NONE) {
1822 return JDWP::ERR_INVALID_OBJECT;
1833 return JDWP::ERR_INVALID_FIELDID;
1840 return JDWP::ERR_INVALID_FIELDID;
1853 JDWP::JdwpTag tag = BasicTagFromDescriptor(f->GetTypeDescriptor());
1855 return JDWP::ERR_NONE;
1858 JDWP::JdwpError Dbg::GetFieldValue(JDWP::ObjectId object_id, JDWP::FieldId field_id,
1859 JDWP::ExpandBuf* pReply) {
1863 JDWP::JdwpError Dbg::GetStaticFieldValue(JDWP::RefTypeId ref_type_id, JDWP::FieldId field_id,
1864 JDWP::ExpandBuf* pReply) {
1868 static JDWP::JdwpError SetArtFieldValue(ArtField* f, mirror::Object* o, uint64_t value, int width)
1877 return JDWP::ERR_NONE;
1882 return JDWP::ERR_NONE;
1887 return JDWP::ERR_NONE;
1892 return JDWP::ERR_NONE;
1897 // Int and Float must be treated as 32-bit values in JDWP.
1899 return JDWP::ERR_NONE;
1904 // Long and Double must be treated as 64-bit values in JDWP.
1906 return JDWP::ERR_NONE;
1909 JDWP::JdwpError error;
1911 if (error != JDWP::ERR_NONE) {
1912 return JDWP::ERR_INVALID_OBJECT;
1923 return JDWP::ERR_INVALID_OBJECT;
1927 return JDWP::ERR_NONE;
1938 static JDWP::JdwpError SetFieldValueImpl(JDWP::ObjectId object_id, JDWP::FieldId field_id,
1941 JDWP::JdwpError error;
1943 if ((!is_static && o == nullptr) || error != JDWP::ERR_NONE) {
1944 return JDWP::ERR_INVALID_OBJECT;
1952 return JDWP::ERR_INVALID_FIELDID;
1966 JDWP::JdwpError Dbg::SetFieldValue(JDWP::ObjectId object_id, JDWP::FieldId field_id, uint64_t value,
1971 JDWP::JdwpError Dbg::SetStaticFieldValue(JDWP::FieldId field_id, uint64_t value, int width) {
1975 JDWP::JdwpError Dbg::StringToUtf8(JDWP::ObjectId string_id, std::string* str) {
1976 JDWP::JdwpError error;
1978 if (error != JDWP::ERR_NONE) {
1982 return JDWP::ERR_INVALID_OBJECT;
1989 return JDWP::ERR_INVALID_STRING;
1993 return JDWP::ERR_NONE;
1996 void Dbg::OutputJValue(JDWP::JdwpTag tag, const JValue* return_value, JDWP::ExpandBuf* pReply) {
1999 if (tag == JDWP::JT_BOOLEAN || tag == JDWP::JT_BYTE) {
2001 } else if (tag == JDWP::JT_CHAR || tag == JDWP::JT_SHORT) {
2003 } else if (tag == JDWP::JT_FLOAT || tag == JDWP::JT_INT) {
2005 } else if (tag == JDWP::JT_DOUBLE || tag == JDWP::JT_LONG) {
2008 CHECK_EQ(tag, JDWP::JT_VOID);
2018 JDWP::JdwpError Dbg::GetThreadName(JDWP::ObjectId thread_id, std::string* name) {
2020 JDWP::JdwpError error;
2023 if (error != JDWP::ERR_NONE && error != JDWP::ERR_THREAD_NOT_ALIVE) {
2037 return JDWP::ERR_NONE;
2040 JDWP::JdwpError Dbg::GetThreadGroup(JDWP::ObjectId thread_id, JDWP::ExpandBuf* pReply) {
2042 JDWP::JdwpError error;
2044 if (error != JDWP::ERR_NONE) {
2045 return JDWP::ERR_INVALID_OBJECT;
2051 if (error == JDWP::ERR_THREAD_NOT_ALIVE) {
2053 expandBufAddObjectId(pReply, JDWP::ObjectId(0));
2054 error = JDWP::ERR_NONE;
2055 } else if (error == JDWP::ERR_NONE) {
2062 JDWP::ObjectId thread_group_id = gRegistry->Add(group);
2069 JDWP::ObjectId thread_group_id, JDWP::JdwpError* error)
2073 if (*error != JDWP::ERR_NONE) {
2077 *error = JDWP::ERR_INVALID_OBJECT;
2084 *error = JDWP::ERR_INVALID_THREAD_GROUP;
2087 *error = JDWP::ERR_NONE;
2091 JDWP::JdwpError Dbg::GetThreadGroupName(JDWP::ObjectId thread_group_id, JDWP::ExpandBuf* pReply) {
2093 JDWP::JdwpError error;
2095 if (error != JDWP::ERR_NONE) {
2105 return JDWP::ERR_NONE;
2108 JDWP::JdwpError Dbg::GetThreadGroupParent(JDWP::ObjectId thread_group_id, JDWP::ExpandBuf* pReply) {
2110 JDWP::JdwpError error;
2112 if (error != JDWP::ERR_NONE) {
2122 JDWP::ObjectId parent_group_id = gRegistry->Add(parent);
2124 return JDWP::ERR_NONE;
2128 std::vector<JDWP::ObjectId>* child_thread_group_ids)
2158 JDWP::JdwpError Dbg::GetThreadGroupChildren(JDWP::ObjectId thread_group_id,
2159 JDWP::ExpandBuf* pReply) {
2161 JDWP::JdwpError error;
2163 if (error != JDWP::ERR_NONE) {
2169 std::vector<JDWP::ObjectId> child_thread_ids;
2172 for (JDWP::ObjectId child_thread_id : child_thread_ids) {
2179 std::vector<JDWP::ObjectId> child_thread_groups_ids;
2182 for (JDWP::ObjectId child_thread_group_id : child_thread_groups_ids) {
2187 return JDWP::ERR_NONE;
2190 JDWP::ObjectId Dbg::GetSystemThreadGroupId() {
2197 JDWP::JdwpThreadStatus Dbg::ToJdwpThreadStatus(ThreadState state) {
2200 return JDWP::TS_MONITOR;
2204 return JDWP::TS_RUNNING;
2206 return JDWP::TS_SLEEPING;
2209 return JDWP::TS_ZOMBIE;
2226 return JDWP::TS_WAIT;
2230 return JDWP::TS_ZOMBIE;
2233 JDWP::JdwpError Dbg::GetThreadStatus(JDWP::ObjectId thread_id, JDWP::JdwpThreadStatus* pThreadStatus,
2234 JDWP::JdwpSuspendStatus* pSuspendStatus) {
2237 *pSuspendStatus = JDWP::SUSPEND_STATUS_NOT_SUSPENDED;
2239 JDWP::JdwpError error;
2241 if (error != JDWP::ERR_NONE) {
2242 if (error == JDWP::ERR_THREAD_NOT_ALIVE) {
2243 *pThreadStatus = JDWP::TS_ZOMBIE;
2244 return JDWP::ERR_NONE;
2250 *pSuspendStatus = JDWP::SUSPEND_STATUS_SUSPENDED;
2254 return JDWP::ERR_NONE;
2257 JDWP::JdwpError Dbg::GetThreadDebugSuspendCount(JDWP::ObjectId thread_id, JDWP::ExpandBuf* pReply) {
2259 JDWP::JdwpError error;
2261 if (error != JDWP::ERR_NONE) {
2266 return JDWP::ERR_NONE;
2269 JDWP::JdwpError Dbg::Interrupt(JDWP::ObjectId thread_id) {
2271 JDWP::JdwpError error;
2273 if (error != JDWP::ERR_NONE) {
2277 return JDWP::ERR_NONE;
2293 void Dbg::GetThreads(mirror::Object* thread_group, std::vector<JDWP::ObjectId>* thread_ids) {
2302 // Skip the JDWP thread. Some debuggers get bent out of shape when they can't suspend and
2348 JDWP::JdwpError Dbg::GetThreadFrameCount(JDWP::ObjectId thread_id, size_t* result) {
2350 JDWP::JdwpError error;
2353 if (error != JDWP::ERR_NONE) {
2357 return JDWP::ERR_THREAD_NOT_SUSPENDED;
2360 return JDWP::ERR_NONE;
2363 JDWP::JdwpError Dbg::GetThreadFrames(JDWP::ObjectId thread_id, size_t start_frame,
2364 size_t frame_count, JDWP::ExpandBuf* buf) {
2368 JDWP::ExpandBuf* buf_in)
2386 JDWP::FrameId frame_id(GetFrameId());
2387 JDWP::JdwpLocation location;
2389 VLOG(jdwp) << StringPrintf(" Frame %3zd: id=%3" PRIu64 " ", depth_, frame_id) << location;
2401 JDWP::ExpandBuf* buf_;
2405 JDWP::JdwpError error;
2407 if (error != JDWP::ERR_NONE) {
2411 return JDWP::ERR_THREAD_NOT_SUSPENDED;
2415 return JDWP::ERR_NONE;
2418 JDWP::ObjectId Dbg::GetThreadSelfId() {
2422 JDWP::ObjectId Dbg::GetThreadId(Thread* thread) {
2435 JDWP::JdwpError Dbg::SuspendThread(JDWP::ObjectId thread_id, bool request_suspension) {
2440 JDWP::JdwpError error;
2444 return JDWP::ERR_THREAD_NOT_ALIVE;
2452 return JDWP::ERR_NONE;
2454 return JDWP::ERR_INTERNAL;
2456 return JDWP::ERR_THREAD_NOT_ALIVE;
2460 void Dbg::ResumeThread(JDWP::ObjectId thread_id) {
2462 JDWP::JdwpError error;
2489 GetThisVisitor(Thread* thread, Context* context, JDWP::FrameId frame_id_in)
2507 JDWP::FrameId frame_id;
2510 JDWP::JdwpError Dbg::GetThisObject(JDWP::ObjectId thread_id, JDWP::FrameId frame_id,
2511 JDWP::ObjectId* result) {
2513 JDWP::JdwpError error;
2515 if (error != JDWP::ERR_NONE) {
2519 return JDWP::ERR_THREAD_NOT_SUSPENDED;
2525 return JDWP::ERR_NONE;
2531 FindFrameVisitor(Thread* thread, Context* context, JDWP::FrameId frame_id)
2535 error_(JDWP::ERR_INVALID_FRAMEID) {}
2546 error_ = JDWP::ERR_OPAQUE_FRAME;
2549 error_ = JDWP::ERR_NONE;
2554 JDWP::JdwpError GetError() const {
2559 const JDWP::FrameId frame_id_;
2560 JDWP::JdwpError error_;
2563 JDWP::JdwpError Dbg::GetLocalValues(JDWP::Request* request, JDWP::ExpandBuf* pReply) {
2564 JDWP::ObjectId thread_id = request->ReadThreadId();
2565 JDWP::FrameId frame_id = request->ReadFrameId();
2568 JDWP::JdwpError error;
2570 if (error != JDWP::ERR_NONE) {
2574 return JDWP::ERR_THREAD_NOT_SUSPENDED;
2580 if (visitor.GetError() != JDWP::ERR_NONE) {
2589 JDWP::JdwpTag reqSigByte = request->ReadTag();
2591 VLOG(jdwp) << " --> slot " << slot << " " << reqSigByte;
2596 if (error != JDWP::ERR_NONE) {
2600 return JDWP::ERR_NONE;
2603 constexpr JDWP::JdwpError kStackFrameLocalAccessError = JDWP::ERR_ABSENT_INFORMATION;
2611 static JDWP::JdwpError FailGetLocalValue(const StackVisitor& visitor, uint16_t vreg,
2612 JDWP::JdwpTag tag)
2619 JDWP::JdwpError Dbg::GetLocalValue(const StackVisitor& visitor, ScopedObjectAccessUnchecked& soa,
2620 int slot, JDWP::JdwpTag tag, uint8_t* buf, size_t width) {
2622 JDWP::JdwpError error = JDWP::ERR_NONE;
2624 if (error != JDWP::ERR_NONE) {
2629 case JDWP::JT_BOOLEAN: {
2635 VLOG(jdwp) << "get boolean local " << vreg << " = " << intVal;
2636 JDWP::Set1(buf + 1, intVal != 0);
2639 case JDWP::JT_BYTE: {
2645 VLOG(jdwp) << "get byte local " << vreg << " = " << intVal;
2646 JDWP::Set1(buf + 1, intVal);
2649 case JDWP::JT_SHORT:
2650 case JDWP::JT_CHAR: {
2656 VLOG(jdwp) << "get short/char local " << vreg << " = " << intVal;
2657 JDWP::Set2BE(buf + 1, intVal);
2660 case JDWP::JT_INT: {
2666 VLOG(jdwp) << "get int local " << vreg << " = " << intVal;
2667 JDWP::Set4BE(buf + 1, intVal);
2670 case JDWP::JT_FLOAT: {
2676 VLOG(jdwp) << "get float local " << vreg << " = " << intVal;
2677 JDWP::Set4BE(buf + 1, intVal);
2680 case JDWP::JT_ARRAY:
2681 case JDWP::JT_CLASS_LOADER:
2682 case JDWP::JT_CLASS_OBJECT:
2683 case JDWP::JT_OBJECT:
2684 case JDWP::JT_STRING:
2685 case JDWP::JT_THREAD:
2686 case JDWP::JT_THREAD_GROUP: {
2687 CHECK_EQ(width, sizeof(JDWP::ObjectId));
2693 VLOG(jdwp) << "get " << tag << " object local " << vreg << " = " << o;
2701 JDWP::SetObjectId(buf + 1, gRegistry->Add(o));
2704 case JDWP::JT_DOUBLE: {
2710 VLOG(jdwp) << "get double local " << vreg << " = " << longVal;
2711 JDWP::Set8BE(buf + 1, longVal);
2714 case JDWP::JT_LONG: {
2720 VLOG(jdwp) << "get long local " << vreg << " = " << longVal;
2721 JDWP::Set8BE(buf + 1, longVal);
2730 JDWP::Set1(buf, tag);
2731 return JDWP::ERR_NONE;
2734 JDWP::JdwpError Dbg::SetLocalValues(JDWP::Request* request) {
2735 JDWP::ObjectId thread_id = request->ReadThreadId();
2736 JDWP::FrameId frame_id = request->ReadFrameId();
2739 JDWP::JdwpError error;
2741 if (error != JDWP::ERR_NONE) {
2745 return JDWP::ERR_THREAD_NOT_SUSPENDED;
2751 if (visitor.GetError() != JDWP::ERR_NONE) {
2759 JDWP::JdwpTag sigByte = request->ReadTag();
2763 VLOG(jdwp) << " --> slot " << slot << " " << sigByte << " " << value;
2765 if (error != JDWP::ERR_NONE) {
2769 return JDWP::ERR_NONE;
2773 static JDWP::JdwpError FailSetLocalValue(const StackVisitor& visitor, uint16_t vreg,
2774 JDWP::JdwpTag tag, T value)
2782 JDWP::JdwpError Dbg::SetLocalValue(StackVisitor& visitor, int slot, JDWP::JdwpTag tag,
2785 JDWP::JdwpError error = JDWP::ERR_NONE;
2787 if (error != JDWP::ERR_NONE) {
2792 case JDWP::JT_BOOLEAN:
2793 case JDWP::JT_BYTE:
2799 case JDWP::JT_SHORT:
2800 case JDWP::JT_CHAR:
2806 case JDWP::JT_INT:
2812 case JDWP::JT_FLOAT:
2818 case JDWP::JT_ARRAY:
2819 case JDWP::JT_CLASS_LOADER:
2820 case JDWP::JT_CLASS_OBJECT:
2821 case JDWP::JT_OBJECT:
2822 case JDWP::JT_STRING:
2823 case JDWP::JT_THREAD:
2824 case JDWP::JT_THREAD_GROUP: {
2825 CHECK_EQ(width, sizeof(JDWP::ObjectId));
2826 mirror::Object* o = gRegistry->Get<mirror::Object*>(static_cast<JDWP::ObjectId>(value),
2828 if (error != JDWP::ERR_NONE) {
2829 VLOG(jdwp) << tag << " object " << o << " is an invalid object";
2830 return JDWP::ERR_INVALID_OBJECT;
2838 case JDWP::JT_DOUBLE: {
2845 case JDWP::JT_LONG: {
2856 return JDWP::ERR_NONE;
2859 static void SetEventLocation(JDWP::EventLocation* location, ArtMethod* m, uint32_t dex_pc)
2877 JDWP::EventLocation location;
2881 // This is required to be able to call JNI functions to create JDWP ids. To achieve this,
2910 JDWP::EventLocation location;
2925 JDWP::EventLocation location;
3027 JDWP::EventLocation exception_throw_location;
3029 JDWP::EventLocation exception_catch_location;
3059 if (single_step_control->GetStepDepth() == JDWP::SD_INTO) {
3065 VLOG(jdwp) << "SS new method";
3066 } else if (single_step_control->GetStepSize() == JDWP::SS_MIN) {
3068 VLOG(jdwp) << "SS new instruction";
3071 VLOG(jdwp) << "SS new line";
3073 } else if (single_step_control->GetStepDepth() == JDWP::SD_OVER) {
3085 VLOG(jdwp) << "SS method pop";
3088 if (single_step_control->GetStepSize() == JDWP::SS_MIN) {
3090 VLOG(jdwp) << "SS new instruction";
3093 VLOG(jdwp) << "SS new line";
3097 CHECK_EQ(single_step_control->GetStepDepth(), JDWP::SD_OUT);
3108 VLOG(jdwp) << "SS method pop";
3147 VLOG(jdwp) << StringPrintf("Add debugger as listener for instrumentation event 0x%x",
3153 VLOG(jdwp) << StringPrintf("Remove debugger as listener for instrumentation event 0x%x",
3160 VLOG(jdwp) << "Deoptimize the world ...";
3162 VLOG(jdwp) << "Deoptimize the world DONE";
3165 VLOG(jdwp) << "Undeoptimize the world ...";
3167 VLOG(jdwp) << "Undeoptimize the world DONE";
3170 VLOG(jdwp) << "Deoptimize method " << PrettyMethod(request.Method()) << " ...";
3172 VLOG(jdwp) << "Deoptimize method " << PrettyMethod(request.Method()) << " DONE";
3175 VLOG(jdwp) << "Undeoptimize method " << PrettyMethod(request.Method()) << " ...";
3177 VLOG(jdwp) << "Undeoptimize method " << PrettyMethod(request.Method()) << " DONE";
3202 VLOG(jdwp) << StringPrintf("Queue request #%zd to start listening to instrumentation event 0x%x",
3216 VLOG(jdwp) << StringPrintf("Queue request #%zd to stop listening to instrumentation event 0x%x",
3225 VLOG(jdwp) << "Queue request #" << deoptimization_requests_.size()
3237 VLOG(jdwp) << "Queue request #" << deoptimization_requests_.size()
3245 VLOG(jdwp) << "Queue request #" << deoptimization_requests_.size()
3252 VLOG(jdwp) << "Queue request #" << deoptimization_requests_.size()
3283 VLOG(jdwp) << "Process deoptimization request #" << req_index++;
3364 VLOG(jdwp) << "No need for deoptimization when fully running with interpreter for method "
3382 VLOG(jdwp) << "Need full deoptimization because of possible inlining of method "
3393 VLOG(jdwp) << "Need full deoptimization because of possible direct code call "
3397 VLOG(jdwp) << "Need selective deoptimization for compiled method " << PrettyMethod(m);
3402 VLOG(jdwp) << "No need for deoptimization for non-compiled method " << PrettyMethod(m);
3409 VLOG(jdwp) << "Breakpoint already set: no deoptimization is required";
3421 void Dbg::WatchLocation(const JDWP::JdwpLocation* location, DeoptimizationRequest* req) {
3449 VLOG(jdwp) << "Set breakpoint #" << (gBreakpoints.size() - 1) << ": "
3456 void Dbg::UnwatchLocation(const JDWP::JdwpLocation* location, DeoptimizationRequest* req) {
3463 VLOG(jdwp) << "Removed breakpoint #" << i << ": " << gBreakpoints[i];
3511 if (ssc->GetStepDepth() == JDWP::SD_INTO) {
3532 if (ssc->GetStepDepth() == JDWP::SD_INTO) {
3540 if (ssc->GetStepDepth() != JDWP::SD_OUT &&
3574 if (ssc->GetStepDepth() == JDWP::SD_OUT &&
3621 ScopedThreadSuspension(Thread* self, JDWP::ObjectId thread_id)
3625 error_(JDWP::ERR_NONE),
3630 if (error_ == JDWP::ERR_NONE) {
3643 error_ = JDWP::ERR_INVALID_THREAD;
3656 JDWP::JdwpError GetError() const {
3668 JDWP::JdwpError error_;
3673 JDWP::JdwpError Dbg::ConfigureStep(JDWP::ObjectId thread_id, JDWP::JdwpStepSize step_size,
3674 JDWP::JdwpStepDepth step_depth) {
3677 if (sts.GetError() != JDWP::ERR_NONE) {
3768 return JDWP::ERR_OUT_OF_MEMORY;
3785 if (VLOG_IS_ON(jdwp)) {
3786 VLOG(jdwp) << "Single-step thread: " << *thread;
3787 VLOG(jdwp) << "Single-step step size: " << single_step_control->GetStepSize();
3788 VLOG(jdwp) << "Single-step step depth: " << single_step_control->GetStepDepth();
3789 VLOG(jdwp) << "Single-step current method: " << PrettyMethod(single_step_control->GetMethod());
3790 VLOG(jdwp) << "Single-step current line: " << line_number;
3791 VLOG(jdwp) << "Single-step current stack depth: " << single_step_control->GetStackDepth();
3792 VLOG(jdwp) << "Single-step dex_pc values:";
3794 VLOG(jdwp) << StringPrintf(" %#x", dex_pc);
3798 return JDWP::ERR_NONE;
3801 void Dbg::UnconfigureStep(JDWP::ObjectId thread_id) {
3803 JDWP::JdwpError error;
3805 if (error == JDWP::ERR_NONE) {
3810 static char JdwpTagToShortyChar(JDWP::JdwpTag tag) {
3813 LOG(FATAL) << "unknown JDWP tag: " << PrintableChar(tag);
3817 case JDWP::JT_BYTE: return 'B';
3818 case JDWP::JT_CHAR: return 'C';
3819 case JDWP::JT_FLOAT: return 'F';
3820 case JDWP::JT_DOUBLE: return 'D';
3821 case JDWP::JT_INT: return 'I';
3822 case JDWP::JT_LONG: return 'J';
3823 case JDWP::JT_SHORT: return 'S';
3824 case JDWP::JT_VOID: return 'V';
3825 case JDWP::JT_BOOLEAN: return 'Z';
3828 case JDWP::JT_ARRAY:
3829 case JDWP::JT_OBJECT:
3830 case JDWP::JT_STRING:
3831 case JDWP::JT_THREAD:
3832 case JDWP::JT_THREAD_GROUP:
3833 case JDWP::JT_CLASS_LOADER:
3834 case JDWP::JT_CLASS_OBJECT:
3839 JDWP::JdwpError Dbg::PrepareInvokeMethod(uint32_t request_id, JDWP::ObjectId thread_id,
3840 JDWP::ObjectId object_id, JDWP::RefTypeId class_id,
3841 JDWP::MethodId method_id, uint32_t arg_count,
3842 uint64_t arg_values[], JDWP::JdwpTag* arg_types,
3845 CHECK_EQ(self, GetDebugThread()) << "This must be called by the JDWP thread";
3851 JDWP::JdwpError error;
3853 if (error != JDWP::ERR_NONE) {
3860 return JDWP::ERR_ALREADY_INVOKING;
3865 return JDWP::ERR_INVALID_THREAD;
3889 return JDWP::ERR_THREAD_SUSPENDED; // Probably not expected here.
3893 if (error != JDWP::ERR_NONE) {
3894 return JDWP::ERR_INVALID_OBJECT;
3898 if (error != JDWP::ERR_NONE) {
3899 return JDWP::ERR_INVALID_OBJECT;
3909 return JDWP::ERR_INVALID_METHODID;
3913 return JDWP::ERR_INVALID_METHODID;
3917 return JDWP::ERR_INVALID_METHODID;
3925 return JDWP::ERR_ILLEGAL_ARGUMENT;
3935 return JDWP::ERR_ILLEGAL_ARGUMENT;
3943 if (error != JDWP::ERR_NONE) {
3944 return JDWP::ERR_INVALID_OBJECT;
3947 return JDWP::ERR_ILLEGAL_ARGUMENT;
3962 return JDWP::ERR_OUT_OF_MEMORY;
3975 if ((options & JDWP::INVOKE_SINGLE_THREADED) == 0) {
3976 VLOG(jdwp) << " Resuming all threads";
3979 VLOG(jdwp) << " Resuming event thread only";
3983 return JDWP::ERR_NONE;
4008 static void WriteValue(JDWP::ExpandBuf* pReply, int width, uint64_t value) {
4034 if ((pReq->options & JDWP::INVOKE_NONVIRTUAL) == 0 && pReq->receiver.Read() != nullptr) {
4038 VLOG(jdwp) << "ExecuteMethod translated " << PrettyMethod(m)
4043 VLOG(jdwp) << "ExecuteMethod " << PrettyMethod(m)
4055 // Prepare JDWP ids for the reply.
4056 JDWP::JdwpTag result_tag = BasicTagFromDescriptor(m->GetShorty());
4057 const bool is_object_result = (result_tag == JDWP::JT_OBJECT);
4069 JDWP::ObjectId exceptionObjectId = gRegistry->Add(exception);
4072 VLOG(jdwp) << " JDWP invocation returning with exception=" << exception.Get()
4077 JDWP::JdwpTag new_tag = TagFromObject(soa, object_result.Get());
4079 VLOG(jdwp) << " JDWP promoted result from " << result_tag << " to " << new_tag;
4095 result_tag = JDWP::JT_OBJECT;
4106 if ((pReq->options & JDWP::INVOKE_SINGLE_THREADED) == 0) {
4108 VLOG(jdwp) << " Suspending all threads";
4113 VLOG(jdwp) << " --> returned " << result_tag
4118 if (result_tag == JDWP::JT_STRING && exceptionObjectId == 0) {
4120 if (VLOG_IS_ON(jdwp)) {
4122 JDWP::JdwpError error = Dbg::StringToUtf8(result_value, &result_string);
4123 CHECK_EQ(error, JDWP::ERR_NONE);
4124 VLOG(jdwp) << " string '" << result_string << "'";
4127 VLOG(jdwp) << " string (null)";
4136 void Dbg::BuildInvokeReply(JDWP::ExpandBuf* pReply, uint32_t request_id, JDWP::JdwpTag result_tag,
4137 uint64_t result_value, JDWP::ObjectId exception) {
4138 // Make room for the JDWP header since we do not know the size of the reply yet.
4139 JDWP::expandBufAddSpace(pReply, kJDWPHeaderLen);
4142 JDWP::expandBufAdd1(pReply, result_tag);
4146 JDWP::expandBufAdd1(pReply, JDWP::JT_OBJECT);
4147 JDWP::expandBufAddObjectId(pReply, exception);
4149 // Now we know the size, we can complete the JDWP header.
4151 JDWP::Set4BE(buf + kJDWPHeaderSizeOffset, expandBufGetLength(pReply));
4152 JDWP::Set4BE(buf + kJDWPHeaderIdOffset, request_id);
4153 JDWP::Set1(buf + kJDWPHeaderFlagsOffset, kJDWPFlagReply); // flags
4154 JDWP::Set2BE(buf + kJDWPHeaderErrorCodeOffset, JDWP::ERR_NONE);
4160 JDWP::ExpandBuf* const pReply = pReq->reply;
4163 // We need to prevent other threads (including JDWP thread) from interacting with the debugger
4164 // while we send the reply but are not yet suspended. The JDWP token will be released just before
4171 VLOG(jdwp) << StringPrintf("REPLY INVOKE id=0x%06x (length=%zu)",
4176 VLOG(jdwp) << "Not sending invoke reply because debugger detached";
4181 * "request" contains a full JDWP packet, possibly with multiple chunks. We
4191 bool Dbg::DdmHandlePacket(JDWP::Request* request, uint8_t** pReplyBuf, int* pReplyLen) {
4239 * integrates the JDWP code more tightly into the rest of the runtime, and doesn't work
4249 VLOG(jdwp) << StringPrintf("DDM reply: type=0x%08x data=%p offset=%d length=%d", type, replyData.get(), offset, length);
4260 JDWP::Set4BE(reply + 0, type);
4261 JDWP::Set4BE(reply + 4, length);
4267 VLOG(jdwp) << StringPrintf("dvmHandleDdm returning type=%.4s %p len=%d", reinterpret_cast<char*>(reply), reply, length);
4272 VLOG(jdwp) << "Broadcasting DDM " << (connect ? "connect" : "disconnect") << "...";
4314 JDWP::Set4BE(&buf[0], t->GetThreadId());
4325 JDWP::Append4BE(bytes, t->GetThreadId());
4326 JDWP::AppendUtf16BE(bytes, chars, char_count);
4385 VLOG(jdwp) << "Debugger thread not active, ignoring DDM send: " << type;
4391 JDWP::JdwpState* Dbg::GetJdwpState() {
4459 JDWP::Append4BE(bytes, heap_count);
4460 JDWP::Append4BE(bytes, 1); // Heap id (bogus; we only have one heap).
4461 JDWP::Append8BE(bytes, MilliTime());
4462 JDWP::Append1BE(bytes, reason);
4463 JDWP::Append4BE(bytes, heap->GetMaxMemory()); // Max allowed heap size in bytes.
4464 JDWP::Append4BE(bytes, heap->GetTotalMemory()); // Current heap size in bytes.
4465 JDWP::Append4BE(bytes, heap->GetBytesAllocated());
4466 JDWP::Append4BE(bytes, heap->GetObjectsAllocated());
4531 JDWP::Write4BE(&p_, 1); // Heap id (bogus; we only have one heap).
4532 JDWP::Write1BE(&p_, 8); // Size of allocation unit, in bytes.
4534 JDWP::Write4BE(&p_, reinterpret_cast<uintptr_t>(chunk_ptr)); // virtual address of segment start.
4535 JDWP::Write4BE(&p_, 0); // offset of this piece (relative to the virtual address).
4539 JDWP::Write4BE(&p_, 0x55555555);
4552 JDWP::Set4BE(pieceLenField_, totalAllocationUnits_);
4749 JDWP::Set4BE(&heap_id[0], 1); // Heap id (bogus; we only have one heap).
5022 JDWP::AppendUtf16BE(bytes, s_utf16.get(), s_len);
5127 JDWP::Append1BE(bytes, kMessageHeaderLen);
5128 JDWP::Append1BE(bytes, kEntryHeaderLen);
5129 JDWP::Append1BE(bytes, kStackFrameLen);
5136 JDWP::Append2BE(bytes, capped_count);
5138 JDWP::Append4BE(bytes, 0); // We'll patch this later...
5139 JDWP::Append2BE(bytes, class_names.Size());
5140 JDWP::Append2BE(bytes, method_names.Size());
5141 JDWP::Append2BE(bytes, filenames.Size());
5155 JDWP::Append4BE(bytes, record->ByteCount());
5156 JDWP::Append2BE(bytes, record->ThinLockId());
5157 JDWP::Append2BE(bytes, allocated_object_class_name_index);
5158 JDWP::Append1BE(bytes, stack_depth);
5170 JDWP::Append2BE(bytes, class_name_index);
5171 JDWP::Append2BE(bytes, method_name_index);
5172 JDWP::Append2BE(bytes, file_name_index);
5173 JDWP::Append2BE(bytes, record->StackElement(stack_frame)->LineNumber());
5181 JDWP::Set4BE(&bytes[string_table_offset], bytes.size());