Commit 7b8cce77 authored by Z Nguyen-Huu's avatar Z Nguyen-Huu Committed by Commit Bot

[v8windbg] Cast resource as ExternalStringResourceBase*

Cast resource field in ExternalString as

v8: :String::ExternalStringResourceBase* would give us more info.
Change-Id: Iae97b477f400f58365e2381b7230d2226d490aa7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2388742
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarSeth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#69734}
parent bc4174cc
...@@ -437,7 +437,7 @@ class ReadStringVisitor : public TqObjectVisitor { ...@@ -437,7 +437,7 @@ class ReadStringVisitor : public TqObjectVisitor {
class AddInfoVisitor : public TqObjectVisitor { class AddInfoVisitor : public TqObjectVisitor {
public: public:
// Returns a descriptive string and a list of properties for the given object. // Returns a descriptive string and a list of properties for the given object.
// Both may be empty, and are meant as an addition to, not a replacement for, // Both may be empty, and are meant as an addition or a replacement for,
// the Torque-generated data about the object. // the Torque-generated data about the object.
static std::pair<std::string, std::vector<std::unique_ptr<ObjectProperty>>> static std::pair<std::string, std::vector<std::unique_ptr<ObjectProperty>>>
Visit(const TqObject* object, d::MemoryAccessor accessor, Visit(const TqObject* object, d::MemoryAccessor accessor,
...@@ -454,6 +454,22 @@ class AddInfoVisitor : public TqObjectVisitor { ...@@ -454,6 +454,22 @@ class AddInfoVisitor : public TqObjectVisitor {
} }
} }
void VisitExternalString(const TqExternalString* object) override {
VisitString(object);
// Cast resource field to v8::String::ExternalStringResourceBase* would add
// more info.
properties_.push_back(std::make_unique<ObjectProperty>(
"resource",
CheckTypeName<v8::String::ExternalStringResourceBase*>(
"v8::String::ExternalStringResourceBase*"),
CheckTypeName<v8::String::ExternalStringResourceBase*>(
"v8::String::ExternalStringResourceBase*"),
object->GetResourceAddress(), 1,
sizeof(v8::String::ExternalStringResourceBase*),
std::vector<std::unique_ptr<StructProperty>>(),
d::PropertyKind::kSingle));
}
void VisitJSObject(const TqJSObject* object) override { void VisitJSObject(const TqJSObject* object) override {
// JSObject and its subclasses can be followed directly by an array of // JSObject and its subclasses can be followed directly by an array of
// property values. The start and end offsets of those values are described // property values. The start and end offsets of those values are described
...@@ -524,8 +540,21 @@ std::unique_ptr<ObjectPropertiesResult> GetHeapObjectPropertiesNotCompressed( ...@@ -524,8 +540,21 @@ std::unique_ptr<ObjectPropertiesResult> GetHeapObjectPropertiesNotCompressed(
auto extra_info = auto extra_info =
AddInfoVisitor::Visit(typed.object.get(), accessor, heap_addresses); AddInfoVisitor::Visit(typed.object.get(), accessor, heap_addresses);
brief = JoinWithSpace(brief, extra_info.first); brief = JoinWithSpace(brief, extra_info.first);
props.insert(props.end(), std::make_move_iterator(extra_info.second.begin()),
std::make_move_iterator(extra_info.second.end())); // Overwrite existing properties if they have the same name.
for (size_t i = 0; i < extra_info.second.size(); i++) {
bool overwrite = false;
for (size_t j = 0; j < props.size(); j++) {
if (strcmp(props[j]->GetPublicView()->name,
extra_info.second[i]->GetPublicView()->name) == 0) {
props[j] = std::move(extra_info.second[i]);
overwrite = true;
break;
}
}
if (overwrite) continue;
props.push_back(std::move(extra_info.second[i]));
}
brief = AppendAddressAndType(brief, address, typed.object->GetName()); brief = AppendAddressAndType(brief, address, typed.object->GetName());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment