Commit 12b45fdf authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[gdb] Add gdb macro 'pn' that prints TurboFan nodes

The macro pn ensures that TurboFan nodes can be easily
printed in gdb, even in release builds where Node::Print
is sometimes not available (because all uses have been
inlined).

This CL also modifies the print function to deal gracefully
with nullptr input nodes, which is helpful for debugging.

Change-Id: Ib5f58aa13b719c8390826bc89dfe21cf58586de5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1672941Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Reviewed-by: 's avatarTamer Tas <tmrts@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62422}
parent 5c2c5ce1
......@@ -303,7 +303,13 @@ void Node::Print() const {
void Node::Print(std::ostream& os) const {
os << *this << std::endl;
for (Node* input : this->inputs()) {
os << " " << *input << std::endl;
os << " ";
if (input) {
os << *input;
} else {
os << "(NULL)";
}
os << std::endl;
}
}
......
include_rules = [
"+components/crash/core/common/crash_key.h",
"+src/compiler/node.h",
]
......@@ -50,6 +50,7 @@
#include "src/objects/js-segment-iterator-inl.h"
#include "src/objects/js-segmenter-inl.h"
#endif // V8_INTL_SUPPORT
#include "src/compiler/node.h"
#include "src/objects/js-weak-refs-inl.h"
#include "src/objects/literal-objects-inl.h"
#include "src/objects/microtask-inl.h"
......@@ -2829,3 +2830,7 @@ V8_EXPORT_PRIVATE extern void _v8_internal_Print_TransitionTree(void* object) {
#endif
}
}
V8_EXPORT_PRIVATE extern void _v8_internal_Node_Print(void* object) {
reinterpret_cast<i::compiler::Node*>(object)->Print();
}
......@@ -65,6 +65,15 @@ Print the current JavaScript stack trace
Usage: jst
end
# Print TurboFan graph node.
define pn
call _v8_internal_Node_Print((void*)($arg0))
end
document pn
Print a v8 TurboFan graph node
Usage: pn node_address
end
# Skip the JavaScript stack.
define jss
set $js_entry_sp=v8::internal::Isolate::Current()->thread_local_top()->js_entry_sp_
......
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