File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -82,14 +82,22 @@ def DEBUGGER__.capture_frames(*args)
8282 # it's a bundled gem. This method tries to activate and load that.
8383 def load_bundled_debug_gem
8484 # Discover latest debug.gem under GEM_PATH
85- debug_gem = Gem . paths . path . map { |path | Dir . glob ( "#{ path } /gems/debug-*" ) } . flatten . select do |path |
86- File . basename ( path ) . match? ( /\A debug-\d +\. \d +\. \d +\z / )
85+ debug_gem = Gem . paths . path . flat_map { |path | Dir . glob ( "#{ path } /gems/debug-*" ) } . select do |path |
86+ File . basename ( path ) . match? ( /\A debug-\d +\. \d +\. \d +( \w +)? \z / )
8787 end . sort_by do |path |
8888 Gem ::Version . new ( File . basename ( path ) . delete_prefix ( 'debug-' ) )
8989 end . last
9090 return false unless debug_gem
9191
92+ # Discover debug/debug.so under extensions for Ruby 3.2+
93+ debug_so = Gem . paths . path . flat_map do |path |
94+ Dir . glob ( "#{ path } /extensions/**/#{ File . basename ( debug_gem ) } /debug/debug.so" )
95+ end . first
96+
9297 # Attempt to forcibly load the bundled gem
98+ if debug_so
99+ $LOAD_PATH << debug_so . delete_suffix ( '/debug/debug.so' )
100+ end
93101 $LOAD_PATH << "#{ debug_gem } /lib"
94102 begin
95103 require "debug/session"
You can’t perform that action at this time.
0 commit comments