From 421cabd4af3bd536e83c0532f178d15c237bcff7 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Fri, 5 Dec 2025 18:38:11 +0900 Subject: [PATCH] use `Kernel.__callee__` for BasicObject fix https://github.com/ruby/debug/issues/1152 --- lib/debug/thread_client.rb | 2 +- test/console/record_test.rb | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/debug/thread_client.rb b/lib/debug/thread_client.rb index 0e1fa42a1..0a92fe356 100644 --- a/lib/debug/thread_client.rb +++ b/lib/debug/thread_client.rb @@ -1310,7 +1310,7 @@ def initialize frame._local_variables = b.local_variables.map{|name| [name, b.local_variable_get(name)] }.to_h - frame._callee = b.eval('__callee__') + frame._callee = b.eval('::Kernel.__callee__') end } append(frames) diff --git a/test/console/record_test.rb b/test/console/record_test.rb index 6b6f99798..9cf32756e 100644 --- a/test/console/record_test.rb +++ b/test/console/record_test.rb @@ -315,4 +315,24 @@ def test_1663647719 end end end + + class RecordOnBasicClassTest < ConsoleTestCase + def program + <<~RUBY + 1| class Test < BasicObject + 2| def test + 3| 42 + 4| end + 5| end + 6| Test.new.test + RUBY + end + + def test_issue1152 + debug_code program do + type 'record on' + type 'c' + end + end + end end