Skip to content

Commit

Permalink
Pick up upstream fix for start parameter
Browse files Browse the repository at this point in the history
We haven't used the `start` parameter so far, but let's keep closer
to upstream here.

(We had already half-applied the change from upstream for another
reason, so now we have the full fix).
  • Loading branch information
ivoanjo committed Aug 13, 2024
1 parent e6c9122 commit 607d5d5
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ calc_lineno(const rb_iseq_t *iseq, const VALUE *pc)
// * Imported fix from https://github.com/ruby/ruby/pull/8415 to avoid potential crash when using YJIT.
// * Add frame_flags.same_frame and logic to skip redoing work if the buffer already contains the same data we're collecting
// * Skipped use of rb_callable_method_entry_t (cme) for Ruby frames as it doesn't impact us.
// * Imported fix from https://github.com/ruby/ruby/pull/8280 to keep us closer to upstream
//
// What is rb_profile_frames?
// `rb_profile_frames` is a Ruby VM debug API added for use by profilers for sampling the stack trace of a Ruby thread.
Expand Down Expand Up @@ -537,6 +538,11 @@ int ddtrace_rb_profile_frames(VALUE thread, int start, int limit, frame_info *st
else {
cme = rb_vm_frame_method_entry(cfp);
if (cme && cme->def->type == VM_METHOD_TYPE_CFUNC) {
if (start > 0) {
start--;
continue;
}

stack_buffer[i].same_frame =
!stack_buffer[i].is_ruby_frame &&
stack_buffer[i].as.native_frame.caching_cme == (VALUE) cme;
Expand Down

0 comments on commit 607d5d5

Please sign in to comment.