From: "mame (Yusuke Endoh)" <noreply@...>
Date: 2022-06-09T06:12:36+00:00
Subject: [ruby-core:108815] [Ruby master Bug#14607] Fix use of the rb_profile_frames start parameter

Issue #14607 has been updated by mame (Yusuke Endoh).

Assignee set to ko1 (Koichi Sasada)
Status changed from Open to Assigned

I assume that "additional calculation" means the code `if (start > 0) { start--; continue; }`, but the "additional calculation" seems to make no sense at all to me either.

```
    for (i=0; i<limit && cfp != end_cfp;) {
        if (VM_FRAME_RUBYFRAME_P(cfp)) {
            if (start > 0) {
                start--;
                continue;
            }
```

It is essentially `start = 0;`. The proposed fix seems reasonable to me. @ko1 What do you think?

----------------------------------------
Bug #14607: Fix use of the rb_profile_frames start parameter
https://bugs.ruby-lang.org/issues/14607#change-97892

* Author: dylants (Dylan Thacker-Smith)
* Status: Assigned
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
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`.

This bug applies to all branches under normal maintenance, from ruby 2.3 to trunk.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>