From e521005d5b8f5bc987b8bc86e72306bfbf0ecfce Mon Sep 17 00:00:00 2001 From: Andy Jeffries Date: Wed, 13 Sep 2023 09:25:15 +0100 Subject: [PATCH 1/5] Allow adding a suffix to sockets for easier multiple-socket debugging --- README.md | 1 + lib/debug/config.rb | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c46a5d058..3a1bdedc7 100644 --- a/README.md +++ b/README.md @@ -501,6 +501,7 @@ config set no_color true * `RUBY_DEBUG_HOST` (`host`): TCP/IP remote debugging: host (default: 127.0.0.1) * `RUBY_DEBUG_SOCK_PATH` (`sock_path`): UNIX Domain Socket remote debugging: socket path * `RUBY_DEBUG_SOCK_DIR` (`sock_dir`): UNIX Domain Socket remote debugging: socket directory + * `RUBY_DEBUG_SOCK_SUFFIX` (`sock_suffix`): UNIX Domain Socket remote debugging: socket suffix * `RUBY_DEBUG_LOCAL_FS_MAP` (`local_fs_map`): Specify local fs map * `RUBY_DEBUG_SKIP_BP` (`skip_bp`): Skip breakpoints if no clients are attached (default: false) * `RUBY_DEBUG_COOKIE` (`cookie`): Cookie for negotiation diff --git a/lib/debug/config.rb b/lib/debug/config.rb index f6f1a066d..f2b630b80 100644 --- a/lib/debug/config.rb +++ b/lib/debug/config.rb @@ -46,6 +46,7 @@ module DEBUGGER__ host: ['RUBY_DEBUG_HOST', "REMOTE: TCP/IP remote debugging: host", :string, "127.0.0.1"], sock_path: ['RUBY_DEBUG_SOCK_PATH', "REMOTE: UNIX Domain Socket remote debugging: socket path"], sock_dir: ['RUBY_DEBUG_SOCK_DIR', "REMOTE: UNIX Domain Socket remote debugging: socket directory"], + sock_suffix: ['RUBY_DEBUG_SOCK_SUFFIX', "REMOTE: UNIX Domain Socket remote debugging: socket suffix"], local_fs_map: ['RUBY_DEBUG_LOCAL_FS_MAP', "REMOTE: Specify local fs map", :path_map], skip_bp: ['RUBY_DEBUG_SKIP_BP', "REMOTE: Skip breakpoints if no clients are attached", :bool, 'false'], cookie: ['RUBY_DEBUG_COOKIE', "REMOTE: Cookie for negotiation"], @@ -496,7 +497,11 @@ def self.unix_domain_socket_dir def self.create_unix_domain_socket_name_prefix(base_dir = unix_domain_socket_dir) user = ENV['USER'] || 'UnknownUser' - File.join(base_dir, "ruby-debug-#{user}") + filename = "ruby-debug-#{user}" + if !CONFIG[:sock_suffix].nil? + filename += "-#{CONFIG[:sock_suffix]}" + end + File.join(base_dir, filename) end def self.create_unix_domain_socket_name(base_dir = unix_domain_socket_dir) From c0f588039f91603b391130fb5c4413147b6134bf Mon Sep 17 00:00:00 2001 From: Andy Jeffries Date: Mon, 25 Sep 2023 08:20:28 +0100 Subject: [PATCH 2/5] Add socket filename prefix as well as suffix --- README.md | 1 + lib/debug/config.rb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 3a1bdedc7..917050598 100644 --- a/README.md +++ b/README.md @@ -501,6 +501,7 @@ config set no_color true * `RUBY_DEBUG_HOST` (`host`): TCP/IP remote debugging: host (default: 127.0.0.1) * `RUBY_DEBUG_SOCK_PATH` (`sock_path`): UNIX Domain Socket remote debugging: socket path * `RUBY_DEBUG_SOCK_DIR` (`sock_dir`): UNIX Domain Socket remote debugging: socket directory + * `RUBY_DEBUG_SOCK_PREFIX` (`sock_prefix`): UNIX Domain Socket remote debugging: socket prefix * `RUBY_DEBUG_SOCK_SUFFIX` (`sock_suffix`): UNIX Domain Socket remote debugging: socket suffix * `RUBY_DEBUG_LOCAL_FS_MAP` (`local_fs_map`): Specify local fs map * `RUBY_DEBUG_SKIP_BP` (`skip_bp`): Skip breakpoints if no clients are attached (default: false) diff --git a/lib/debug/config.rb b/lib/debug/config.rb index f2b630b80..90a4ba731 100644 --- a/lib/debug/config.rb +++ b/lib/debug/config.rb @@ -47,6 +47,7 @@ module DEBUGGER__ sock_path: ['RUBY_DEBUG_SOCK_PATH', "REMOTE: UNIX Domain Socket remote debugging: socket path"], sock_dir: ['RUBY_DEBUG_SOCK_DIR', "REMOTE: UNIX Domain Socket remote debugging: socket directory"], sock_suffix: ['RUBY_DEBUG_SOCK_SUFFIX', "REMOTE: UNIX Domain Socket remote debugging: socket suffix"], + sock_prefix: ['RUBY_DEBUG_SOCK_PREFIX', "REMOTE: UNIX Domain Socket remote debugging: socket prefix"], local_fs_map: ['RUBY_DEBUG_LOCAL_FS_MAP', "REMOTE: Specify local fs map", :path_map], skip_bp: ['RUBY_DEBUG_SKIP_BP', "REMOTE: Skip breakpoints if no clients are attached", :bool, 'false'], cookie: ['RUBY_DEBUG_COOKIE', "REMOTE: Cookie for negotiation"], @@ -498,6 +499,9 @@ def self.unix_domain_socket_dir def self.create_unix_domain_socket_name_prefix(base_dir = unix_domain_socket_dir) user = ENV['USER'] || 'UnknownUser' filename = "ruby-debug-#{user}" + if !CONFIG[:sock_prefix].nil? + filename = "#{CONFIG[:sock_prefix]}-#{filename}" + end if !CONFIG[:sock_suffix].nil? filename += "-#{CONFIG[:sock_suffix]}" end From a751ab36fa24a84b106de365a26b0be0f83985b4 Mon Sep 17 00:00:00 2001 From: Andy Jeffries Date: Tue, 7 Nov 2023 16:14:41 +0000 Subject: [PATCH 3/5] Change socket prefix/suffix to session name --- lib/debug/config.rb | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/debug/config.rb b/lib/debug/config.rb index 90a4ba731..ce5a5562d 100644 --- a/lib/debug/config.rb +++ b/lib/debug/config.rb @@ -44,10 +44,9 @@ module DEBUGGER__ open: ['RUBY_DEBUG_OPEN', "REMOTE: Open remote port (same as `rdbg --open` option)"], port: ['RUBY_DEBUG_PORT', "REMOTE: TCP/IP remote debugging: port"], host: ['RUBY_DEBUG_HOST', "REMOTE: TCP/IP remote debugging: host", :string, "127.0.0.1"], + session_name: ['RUBY_DEBUG_SESSION_NAME' "REMOTE: Session name for differentiating multiple sessions"], sock_path: ['RUBY_DEBUG_SOCK_PATH', "REMOTE: UNIX Domain Socket remote debugging: socket path"], sock_dir: ['RUBY_DEBUG_SOCK_DIR', "REMOTE: UNIX Domain Socket remote debugging: socket directory"], - sock_suffix: ['RUBY_DEBUG_SOCK_SUFFIX', "REMOTE: UNIX Domain Socket remote debugging: socket suffix"], - sock_prefix: ['RUBY_DEBUG_SOCK_PREFIX', "REMOTE: UNIX Domain Socket remote debugging: socket prefix"], local_fs_map: ['RUBY_DEBUG_LOCAL_FS_MAP', "REMOTE: Specify local fs map", :path_map], skip_bp: ['RUBY_DEBUG_SKIP_BP', "REMOTE: Skip breakpoints if no clients are attached", :bool, 'false'], cookie: ['RUBY_DEBUG_COOKIE', "REMOTE: Cookie for negotiation"], @@ -499,12 +498,6 @@ def self.unix_domain_socket_dir def self.create_unix_domain_socket_name_prefix(base_dir = unix_domain_socket_dir) user = ENV['USER'] || 'UnknownUser' filename = "ruby-debug-#{user}" - if !CONFIG[:sock_prefix].nil? - filename = "#{CONFIG[:sock_prefix]}-#{filename}" - end - if !CONFIG[:sock_suffix].nil? - filename += "-#{CONFIG[:sock_suffix]}" - end File.join(base_dir, filename) end From defd41d7aa7d6d213b5328fd235ced6fad49a769 Mon Sep 17 00:00:00 2001 From: Andy Jeffries Date: Tue, 7 Nov 2023 16:16:23 +0000 Subject: [PATCH 4/5] Revert README.md to upstream master version --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 917050598..c46a5d058 100644 --- a/README.md +++ b/README.md @@ -501,8 +501,6 @@ config set no_color true * `RUBY_DEBUG_HOST` (`host`): TCP/IP remote debugging: host (default: 127.0.0.1) * `RUBY_DEBUG_SOCK_PATH` (`sock_path`): UNIX Domain Socket remote debugging: socket path * `RUBY_DEBUG_SOCK_DIR` (`sock_dir`): UNIX Domain Socket remote debugging: socket directory - * `RUBY_DEBUG_SOCK_PREFIX` (`sock_prefix`): UNIX Domain Socket remote debugging: socket prefix - * `RUBY_DEBUG_SOCK_SUFFIX` (`sock_suffix`): UNIX Domain Socket remote debugging: socket suffix * `RUBY_DEBUG_LOCAL_FS_MAP` (`local_fs_map`): Specify local fs map * `RUBY_DEBUG_SKIP_BP` (`skip_bp`): Skip breakpoints if no clients are attached (default: false) * `RUBY_DEBUG_COOKIE` (`cookie`): Cookie for negotiation From 10b30c9a5ffd7305977f21a41cb9f4358bcd397e Mon Sep 17 00:00:00 2001 From: Andy Jeffries Date: Tue, 7 Nov 2023 16:17:25 +0000 Subject: [PATCH 5/5] Remove unnecessary change in config.rb --- lib/debug/config.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/debug/config.rb b/lib/debug/config.rb index ce5a5562d..ea5b06d7a 100644 --- a/lib/debug/config.rb +++ b/lib/debug/config.rb @@ -497,8 +497,7 @@ def self.unix_domain_socket_dir def self.create_unix_domain_socket_name_prefix(base_dir = unix_domain_socket_dir) user = ENV['USER'] || 'UnknownUser' - filename = "ruby-debug-#{user}" - File.join(base_dir, filename) + File.join(base_dir, "ruby-debug-#{user}") end def self.create_unix_domain_socket_name(base_dir = unix_domain_socket_dir)