summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-12-20 09:05:58 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2022-12-20 09:07:54 -0800
commitcf0b413ef8b794ef6e7436f22fd5a998050dada9 (patch)
tree49faae64f65ff43440558ed27c666e82d10f6b93 /lib
parent80e56d1438724d37ca09f61e560f95c00599cdf3 (diff)
[ruby/irb] Respect DLEXT to force-load debug.so
(https://github.com/ruby/irb/pull/481) Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/irb/cmd/debug.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/irb/cmd/debug.rb b/lib/irb/cmd/debug.rb
index e6e812e075..7d39b9fa27 100644
--- a/lib/irb/cmd/debug.rb
+++ b/lib/irb/cmd/debug.rb
@@ -102,13 +102,14 @@ module IRB
return false unless debug_gem
# Discover debug/debug.so under extensions for Ruby 3.2+
- debug_so = Gem.paths.path.flat_map do |path|
- Dir.glob("#{path}/extensions/**/#{File.basename(debug_gem)}/debug/debug.so")
+ ext_name = "/debug/debug.#{RbConfig::CONFIG['DLEXT']}"
+ ext_path = Gem.paths.path.flat_map do |path|
+ Dir.glob("#{path}/extensions/**/#{File.basename(debug_gem)}#{ext_name}")
end.first
# Attempt to forcibly load the bundled gem
- if debug_so
- $LOAD_PATH << debug_so.delete_suffix('/debug/debug.so')
+ if ext_path
+ $LOAD_PATH << ext_path.delete_suffix(ext_name)
end
$LOAD_PATH << "#{debug_gem}/lib"
begin