Project

General

Profile

Bug #14607 ยป fix-use-of-the-rb_profile_frames-start-parameter.patch

dylants (Dylan Thacker-Smith), 03/15/2018 02:50 PM

View differences:

test/-ext-/debug/test_profile_frames.rb
119 119
      a
120 120
    end;
121 121
  end
122

  
123
  def test_start
124
    assert_equal Bug::Debug.profile_frames(0, 10).tap(&:shift), Bug::Debug.profile_frames(1, 9)
125
  end
122 126
end
vm_backtrace.c
1276 1276
    const rb_control_frame_t *cfp = ec->cfp, *end_cfp = RUBY_VM_END_CONTROL_FRAME(ec);
1277 1277
    const rb_callable_method_entry_t *cme;
1278 1278

  
1279
    for (i=0; i<limit && cfp != end_cfp;) {
1279
    for (i=0; i<limit && cfp != end_cfp; cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp)) {
1280 1280
	if (cfp->iseq && cfp->pc) {
1281 1281
	    if (start > 0) {
1282 1282
		start--;
......
1296 1296

  
1297 1297
	    i++;
1298 1298
	}
1299
	cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
1300 1299
    }
1301 1300

  
1302 1301
    return i;
1303
-