From 0183613bf9d1d5c14be9fdf34af31ea1b94eb48e Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 19 May 2017 14:58:38 +0000 Subject: compile.c: dump_disasm_list_with_cursor * compile.c (dump_disasm_list_with_cursor): improve disassemble list. show whole elemetns and mark the current element. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/compile.c b/compile.c index 18e1ac8090..e89aa5418b 100644 --- a/compile.c +++ b/compile.c @@ -427,7 +427,8 @@ freeze_hide_obj(VALUE obj) #define gl_node_level ISEQ_COMPILE_DATA(iseq)->node_level #endif -static void dump_disasm_list(LINK_ELEMENT *elem); +static void dump_disasm_list_with_cursor(const LINK_ELEMENT *elem, const LINK_ELEMENT *curr); +static void dump_disasm_list(const LINK_ELEMENT *elem); static int insn_data_length(INSN *iobj); static int calc_sp_depth(int depth, INSN *iobj); @@ -1631,7 +1632,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor) line_info_index = code_index = sp = 0; #define BADINSN_ERROR \ - (dump_disasm_list(list), \ + (dump_disasm_list_with_cursor(&anchor->anchor, list), \ xfree(generated_iseq), \ xfree(line_info_table), \ COMPILE_ERROR) @@ -6494,7 +6495,13 @@ insn_data_to_s_detail(INSN *iobj) } static void -dump_disasm_list(struct iseq_link_element *link) +dump_disasm_list(const LINK_ELEMENT *link) +{ + dump_disasm_list_with_cursor(link, NULL); +} + +static void +dump_disasm_list_with_cursor(const LINK_ELEMENT *link, const LINK_ELEMENT *curr) { int pos = 0; INSN *iobj; @@ -6504,6 +6511,7 @@ dump_disasm_list(struct iseq_link_element *link) printf("-- raw disasm--------\n"); while (link) { + if (curr) putc(curr == link ? '*' : ' ', stdout); switch (link->type) { case ISEQ_ELEMENT_INSN: { -- cgit v1.2.3