Skip to content

Commit

Permalink
Load iseq name later than other ISEQ references
Browse files Browse the repository at this point in the history
previous_insn_index() is crashing:
https://github.com/ruby/ruby/actions/runs/8100712618/job/22139323673
https://github.com/ruby/ruby/actions/runs/8099334388/job/22134848249

but it's probably not the fault of previous_insn_index() itself. I'm
guessing the top-most frame is a C frame, and so iseq is just 0.

To confirm that, I'd like to try calling other functions on an ISEQ
first.
  • Loading branch information
k0kubun committed Feb 29, 2024
1 parent 3d61477 commit 1a58892
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vm_insnhelper.c
Expand Up @@ -276,14 +276,14 @@ rb_vm_check_canary(const rb_execution_context_t *ec, VALUE *sp)
}

const VALUE *orig = rb_iseq_original_iseq(iseq);
const ptrdiff_t pos = previous_insn_index(iseq, GET_PC());
const enum ruby_vminsn_type insn = (enum ruby_vminsn_type)orig[pos];
const char *name = insn_name(insn);
const VALUE iseqw = rb_iseqw_new(iseq);
const VALUE inspection = rb_inspect(iseqw);
const char *stri = rb_str_to_cstr(inspection);
const VALUE disasm = rb_iseq_disasm(iseq);
const char *strd = rb_str_to_cstr(disasm);
const ptrdiff_t pos = previous_insn_index(iseq, GET_PC());
const enum ruby_vminsn_type insn = (enum ruby_vminsn_type)orig[pos];
const char *name = insn_name(insn);

/* rb_bug() is not capable of outputting this large contents. It
is designed to run form a SIGSEGV handler, which tends to be
Expand Down

0 comments on commit 1a58892

Please sign in to comment.