Fix use of rb_profile_frames
start parameter
rb_profile_frames was always behaving as if the value given for the start parameter was 0. The reason for this was that it would check if (start > 0) { then continue without updating the control frame pointer or anything other than decrementing start. [ruby-core:86147] [Bug #14607] Co-authored-by: Dylan Thacker-Smith <Dylan.Smith@shopify.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
81f02142b8
commit
d676ad1050
@ -119,4 +119,8 @@ class TestProfileFrames < Test::Unit::TestCase
|
||||
a
|
||||
end;
|
||||
end
|
||||
|
||||
def test_start
|
||||
assert_equal Bug::Debug.profile_frames(0, 10).tap(&:shift), Bug::Debug.profile_frames(1, 9)
|
||||
end
|
||||
end
|
||||
|
@ -1276,7 +1276,7 @@ rb_profile_frames(int start, int limit, VALUE *buff, int *lines)
|
||||
const rb_control_frame_t *cfp = ec->cfp, *end_cfp = RUBY_VM_END_CONTROL_FRAME(ec);
|
||||
const rb_callable_method_entry_t *cme;
|
||||
|
||||
for (i=0; i<limit && cfp != end_cfp;) {
|
||||
for (i=0; i<limit && cfp != end_cfp; cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp)) {
|
||||
if (cfp->iseq && cfp->pc) {
|
||||
if (start > 0) {
|
||||
start--;
|
||||
@ -1296,7 +1296,6 @@ rb_profile_frames(int start, int limit, VALUE *buff, int *lines)
|
||||
|
||||
i++;
|
||||
}
|
||||
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
|
||||
}
|
||||
|
||||
return i;
|
||||
|
Loading…
x
Reference in New Issue
Block a user