diff --git a/lib/debug/frame_info.rb b/lib/debug/frame_info.rb index 8fab332de..558f5466b 100644 --- a/lib/debug/frame_info.rb +++ b/lib/debug/frame_info.rb @@ -171,7 +171,7 @@ def parameters_info private def get_singleton_class obj obj.singleton_class # TODO: don't use it - rescue TypeError + rescue Exception nil end diff --git a/test/console/backtrace_test.rb b/test/console/backtrace_test.rb index 570d66c80..8c6056a6a 100644 --- a/test/console/backtrace_test.rb +++ b/test/console/backtrace_test.rb @@ -229,4 +229,31 @@ def test_backtrace_prints_without_hanging end end end + + class BrokenSingletonMethodBacktraceTest < ConsoleTestCase + def program + <<~RUBY + 1| class C + 2| def self.foo + 3| debugger + 4| end + 5| def singleton_class + 6| raise + 7| end + 8| def self.singleton_class + 9| eval(")") # SyntaxError + 10| end + 11| end + 12| C.foo + RUBY + end + + def test_raise_exception + debug_code program do + type 'c' + assert_line_text(/foo/) + type 'c' + end + end + end end