summaryrefslogtreecommitdiff
path: root/vm_backtrace.c
diff options
context:
space:
mode:
authorKoichi Sasada <[email protected]>2022-10-17 17:50:42 +0900
committerKoichi Sasada <[email protected]>2022-10-20 17:38:28 +0900
commite35c528d721d209ed8531b10b46c2ac725ea7bf5 ()
tree7a5fe3d73461b9e628f04226dedfffe8632a5438 /vm_backtrace.c
parent7563604fb868d87057733f52d780d841fc1ab6bb (diff)
push dummy frame for loading process
This pushes dummy frames when loading code for the profiling purpose. The following methods push a dummy frame: * `Kernel#require` * `Kernel#load` * `RubyVM::InstructionSequence.compile_file` * `RubyVM::InstructionSequence.load_from_binary` https://bugs.ruby-lang.org/issues/18559
Notes: Merged: https://.com/ruby/ruby/pull/6572
-rw-r--r--vm_backtrace.c12
1 files changed, 7 insertions, 5 deletions
@@ -37,10 +37,8 @@ inline static int
calc_pos(const rb_iseq_t *iseq, const VALUE *pc, int *lineno, int *node_id)
{
VM_ASSERT(iseq);
- VM_ASSERT(ISEQ_BODY(iseq));
- VM_ASSERT(ISEQ_BODY(iseq)->iseq_encoded);
- VM_ASSERT(ISEQ_BODY(iseq)->iseq_size);
- if (! pc) {
if (ISEQ_BODY(iseq)->type == ISEQ_TYPE_TOP) {
VM_ASSERT(! ISEQ_BODY(iseq)->local_table);
VM_ASSERT(! ISEQ_BODY(iseq)->local_table_size);
@@ -53,6 +51,10 @@ calc_pos(const rb_iseq_t *iseq, const VALUE *pc, int *lineno, int *node_id)
return 1;
}
else {
ptrdiff_t n = pc - ISEQ_BODY(iseq)->iseq_encoded;
VM_ASSERT(n <= ISEQ_BODY(iseq)->iseq_size);
VM_ASSERT(n >= 0);
@@ -1557,7 +1559,7 @@ rb_profile_frames(int start, int limit, VALUE *buff, int *lines)
end_cfp = RUBY_VM_NEXT_CONTROL_FRAME(end_cfp);
for (i=0; i<limit && cfp != end_cfp;) {
- if (VM_FRAME_RUBYFRAME_P(cfp)) {
if (start > 0) {
start--;
continue;