[前][次][番号順一覧][スレッド一覧]

ruby-changes:61695

From: Nobuyoshi <ko1@a...>
Date: Sat, 13 Jun 2020 08:25:14 +0900 (JST)
Subject: [ruby-changes:61695] 1f1b62fb7b (master): Added install-dbg

https://git.ruby-lang.org/ruby.git/commit/?id=1f1b62fb7b

From 1f1b62fb7bb0855788f3da7fdcf9e440ff617fb3 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 13 Jun 2020 08:09:00 +0900
Subject: Added install-dbg

Scripts to run the interpreter via debugger.

diff --git a/common.mk b/common.mk
index f36b5bb..937d6bf 100644
--- a/common.mk
+++ b/common.mk
@@ -550,6 +550,13 @@ do-install-gem: $(PROGRAM) pre-install-gem https://github.com/ruby/ruby/blob/trunk/common.mk#L550
 post-install-gem::
 	@$(NULLCMD)
 
+install-dbg: pre-install-dbg do-install-dbg post-install-dbg
+pre-install-dbg::
+do-install-dbg: $(PROGRAM) pre-install-dbg
+	$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=dbg
+post-install-dbg::
+	@$(NULLCMD)
+
 rdoc: PHONY main
 	@echo Generating RDoc documentation
 	$(Q) $(RDOC) --ri --op "$(RDOCOUT)" $(RDOC_GEN_OPTS) $(RDOCFLAGS) "$(srcdir)"
diff --git a/template/ruby-gdb.in b/template/ruby-gdb.in
new file mode 100755
index 0000000..7ab4e97
--- /dev/null
+++ b/template/ruby-gdb.in
@@ -0,0 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/template/ruby-gdb.in#L1
+#!/bin/sh
+prefix="/${0%/*}"
+prefix="${prefix%/*}"
+ruby="${bindir}/${RUBY_INSTALL_NAME}"
+gdbinit="${rubylibdir}/gdbinit"
+exec gdb --command="$gdbinit" --args "$ruby" "$@"
diff --git a/template/ruby-lldb.in b/template/ruby-lldb.in
new file mode 100755
index 0000000..c33603b
--- /dev/null
+++ b/template/ruby-lldb.in
@@ -0,0 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/template/ruby-lldb.in#L1
+#!/bin/sh
+prefix="/${0%/*}"
+prefix="${prefix%/*}"
+ruby="${bindir}/${RUBY_INSTALL_NAME}"
+lldbinit="${rubylibdir}/lldb_cruby.py"
+exec lldb -O "command script import $lldbinit" "$ruby" -- "$@"
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index 7d7dbd5..aadfd41 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -149,7 +149,9 @@ end https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L149
 
 $install_procs = Hash.new {[]}
 def install?(*types, &block)
-  $install_procs[:all] <<= block
+  unless types.delete(:nodefault)
+    $install_procs[:all] <<= block
+  end
   types.each do |type|
     $install_procs[type] <<= block
   end
@@ -482,7 +484,12 @@ _=_\\ https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L484
 =end
 EOS
 
-installer = Struct.new(:ruby_shebang, :ruby_bin, :ruby_install_name, :stub, :trans)
+installer = Struct.new(:ruby_shebang, :ruby_bin, :ruby_install_name, :stub, :trans) do
+  def transform(name)
+    RbConfig.expand(trans[name])
+  end
+end
+
 $script_installer = Class.new(installer) do
   ruby_shebang = File.join(bindir, ruby_install_name)
   if File::ALT_SEPARATOR
@@ -527,7 +534,7 @@ $script_installer = Class.new(installer) do https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L534
   end
 
   def install(src, cmd)
-    cmd = cmd.sub(/[^\/]*\z/m) {|n| RbConfig.expand(trans[n])}
+    cmd = cmd.sub(/[^\/]*\z/m) {|n| transform(n)}
 
     shebang, body = open(src, "rb") do |f|
       next f.gets, f.read
@@ -655,6 +662,20 @@ install?(:local, :comm, :man) do https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L662
   end
 end
 
+install?(:dbg, :nodefault) do
+  prepare "debugger commands", bindir
+  prepare "debugger scripts", rubylibdir
+  conf = RbConfig::MAKEFILE_CONFIG.merge({"prefix"=>"${prefix#/}"})
+  Dir.glob(File.join(srcdir, "template/ruby-*db.in")) do |src|
+    cmd = $script_installer.transform(File.basename(src, ".in"))
+    open_for_install(File.join(bindir, cmd), $script_mode) {
+      RbConfig.expand(File.read(src), conf)
+    }
+  end
+  install File.join(srcdir, "misc/lldb_cruby.py"), File.join(rubylibdir, "lldb_cruby.py")
+  install File.join(srcdir, ".gdbinit"), File.join(rubylibdir, "gdbinit")
+end
+
 module RbInstall
   module Specs
     class FileCollector
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]