diff --git a/tools/debug_helper/get-object-properties.cc b/tools/debug_helper/get-object-properties.cc index 659a138462..27da84dd58 100644 --- a/tools/debug_helper/get-object-properties.cc +++ b/tools/debug_helper/get-object-properties.cc @@ -244,11 +244,11 @@ class ReadStringVisitor : public TqObjectVisitor { return std::string(result.data(), write_index); } - template - Value ReadCharacter(uintptr_t data_address, int32_t index) { - TChar value{}; + template + Value ReadValue(uintptr_t data_address, int32_t index = 0) { + T value{}; d::MemoryAccessResult validity = - accessor_(data_address + index * sizeof(TChar), + accessor_(data_address + index * sizeof(T), reinterpret_cast(&value), sizeof(value)); return {validity, value}; } @@ -259,7 +259,7 @@ class ReadStringVisitor : public TqObjectVisitor { for (; index_ < length && index_ < limit_ && !done_; ++index_) { static_assert(sizeof(TChar) <= sizeof(char16_t)); char16_t c = static_cast( - GetOrFinish(ReadCharacter(data_address, index_))); + GetOrFinish(ReadValue(data_address, index_))); if (!done_) AddCharacter(c); } } @@ -350,13 +350,22 @@ class ReadStringVisitor : public TqObjectVisitor { ExternalPointer_t resource_data = GetOrFinish(object->GetResourceDataValue(accessor_)); #ifdef V8_ENABLE_SANDBOX - Isolate* isolate = GetIsolateForSandbox( - HeapObject::unchecked_cast(Object(heap_addresses_.any_heap_pointer))); - ExternalPointerHandle handle = - static_cast(resource_data); - uintptr_t data_address = - static_cast(isolate->shared_external_pointer_table().Get( - handle, kExternalStringResourceDataTag)); + Address memory_chunk = + BasicMemoryChunk::BaseAddress(object->GetMapAddress()); + Address heap = GetOrFinish( + ReadValue
(memory_chunk + BasicMemoryChunk::kHeapOffset)); + Isolate* isolate = Isolate::FromHeap(reinterpret_cast(heap)); + Address external_pointer_table_address_address = + isolate->shared_external_pointer_table_address_address(); + Address external_pointer_table_address = GetOrFinish( + ReadValue
(external_pointer_table_address_address)); + Address external_pointer_table = + GetOrFinish(ReadValue
(external_pointer_table_address)); + int32_t index = + static_cast(resource_data >> kExternalPointerIndexShift); + Address tagged_data = + GetOrFinish(ReadValue
(external_pointer_table, index)); + Address data_address = tagged_data & ~kExternalStringResourceDataTag; #else uintptr_t data_address = static_cast(resource_data); #endif // V8_ENABLE_SANDBOX