Commit d4482c07 authored by Jakob Linke's avatar Jakob Linke Committed by V8 LUCI CQ

[maglev] Add NodeBase::Print() for GDB

.. where we sometimes want to inspect Node contents. With this CL, for
a human-readable print in gdb:

 print node->Print()

Note: Since we use an adhoc-created graph labeller, the output can't
properly identify input nodes and instead prints them as 'unregistered
node'.

Bug: v8:7700
Change-Id: Icba458ac1a5c43a09b815e12582443aca4e19380
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3890914
Auto-Submit: Jakob Linke <jgruber@chromium.org>
Commit-Queue: Jakob Linke <jgruber@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83151}
parent 933e3d8b
......@@ -37,7 +37,7 @@ class MaglevGraphLabeller {
auto node_id_it = node_ids_.find(node);
if (node_id_it == node_ids_.end()) {
os << "<invalid node " << node << ">";
os << "<unregistered node " << node << ">";
return;
}
......
......@@ -345,6 +345,12 @@ void NodeBase::Print(std::ostream& os, MaglevGraphLabeller* graph_labeller,
UNREACHABLE();
}
void NodeBase::Print() const {
MaglevGraphLabeller labeller;
Print(std::cout, &labeller);
std::cout << std::endl;
}
namespace {
size_t GetInputLocationsArraySize(const MaglevCompilationUnit& compilation_unit,
const CheckpointedInterpreterState& state) {
......
......@@ -871,6 +871,9 @@ class NodeBase : public ZoneObject {
void Print(std::ostream& os, MaglevGraphLabeller*,
bool skip_targets = false) const;
// For GDB: Print any Node with `print node->Print()`.
void Print() const;
EagerDeoptInfo* eager_deopt_info() {
DCHECK(properties().can_eager_deopt());
DCHECK(!properties().can_lazy_deopt());
......
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