Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a shorthand for ruby_debug_print_node #9423

Merged
merged 3 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,20 @@ NODE *
ruby_debug_print_node(int level, int debug_level, const char *header, const NODE *node)
{
if (level < debug_level) {
fprintf(stderr, "DBG> %s: %s (%u)\n", header,
ruby_node_name(nd_type(node)), nd_line(node));
fprintf(stderr, "DBG> %s: %s (id: %d, line: %d, location: (%d,%d)-(%d,%d))\n",
header, ruby_node_name(nd_type(node)), nd_node_id(node), nd_line(node),
nd_first_lineno(node), nd_first_column(node),
nd_last_lineno(node), nd_last_column(node));
}
return (NODE *)node;
}

void
ruby_debug_print_n(const NODE *node)
{
ruby_debug_print_node(0, 1, "", node);
}

void
ruby_debug_breakpoint(void)
{
Expand Down
2 changes: 2 additions & 0 deletions vm_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ RUBY_SYMBOL_EXPORT_BEGIN
struct RNode;

VALUE ruby_debug_print_value(int level, int debug_level, const char *header, VALUE v);
void ruby_debug_print_v(VALUE v);
ID ruby_debug_print_id(int level, int debug_level, const char *header, ID id);
struct RNode *ruby_debug_print_node(int level, int debug_level, const char *header, const struct RNode *node);
void ruby_debug_print_n(const struct RNode *node);
int ruby_debug_print_indent(int level, int debug_level, int indent_level);
void ruby_debug_gc_check_func(void);
void ruby_set_debug_option(const char *str);
Expand Down