Project

General

Profile

Actions

Bug #21395

closed

Please backport caa6ba1a46afa1bc696adc5fe91ee992f9570c89

Added by mame (Yusuke Endoh) 2 days ago. Updated 2 days ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:122409]

Description

In Ruby 3.4, debug.gem raises an exception when stepping into a rescue clause:

https://github.com/ruby/debug/pull/1142

I discussed with @ko1 (Koichi Sasada), and we decided to resolve this by modifying rb_debug_inspector_backtrace_locations to return a raw array of Thread::Backtrace::Location.

This ticket is to request backporting 8d49c05c134702c321198b70fbbf34dd80cc1ba6, which implements that change, into Ruby 3.4.


As a record, here is a more detailed explanation of the issue:

Starting from Ruby 3.4, rescue and ensure frames have been excluded from backtraces (see #20275).
This change broke the assumption of the debug inspector API.

The debug inspector API is designed to be used as follows:

  1. Obtain an array of Thread::Backtrace::Location using rb_debug_inspector_backtrace_locations
  2. For each index in that array, obtain more detailed information using functions like rb_debug_inspector_frame_binding_get(index)

Due to the changes in #20275, rescue/ensure frames were removed from the array returned by rb_debug_inspector_backtrace_locations.
As a result, the indices in this array became inconsistent with the indices expected by rb_debug_inspector_frame_binding_get(index) and similar functions.

There are two possible directions for fixing this:

  1. Modify rb_debug_inspector_backtrace_locations to return the raw backtrace without removing rescue/ensure frames.
  2. Modify rb_debug_inspector_frame_binding_get(index) to take into account the removal of rescue/ensure frames and return the corresponding data accordingly.

@ko1 (Koichi Sasada) is interested in trying (2) in the future, but for now, commit 8d49c05c134702c321198b70fbbf34dd80cc1ba6 implements the simpler fix, (1).


Related issues 1 (0 open1 closed)

Related to Ruby - Feature #20275: Avoid extra backtrace entries for rescue and ensureClosedEregon (Benoit Daloze)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0