debug
debug copied to clipboard
✨ Allow setting local_fs_map even when using UI_UnixDomainServer
Description
This is a fix for #741
Basically, allow users to specify the local_fs_map even when using UI_UnixDomainServer. The idea is to maintain the existing behavior when the configuration is not specified, but use it when it is.
From the original context:
Stripe runs ruby on a remote server and VS Code on a laptop. We proxy the unix domain socket from server to laptop, and need to use the fs map feature to translate file paths.
@ko1 there's a failing test, but I'm not sure it's related to my changes, as the same test failed in all my other PRs 😕
===============================================================================
Failure: test_default_case(DEBUGGER__::Fork_fork_0):
Test::Unit::AssertionFailedError:
--------------------
| Debugger Session |
--------------------
> [1, 10] in /tmp/debug-20220916-1804-xhwni.rb
> => 1| pid = fork do
> 2| binding.b do: 'p :child_enter'
> 3| a = 1
> 4| b = 2
> 5| c = 3
> 6| binding.b do: 'p :child_leave'
> 7| end
> 8| sleep 0.5
> 9| binding.b do: 'p :parent_enter'
> 10| a = 1
> =>#0 <main> at /tmp/debug-20220916-1804-xhwni.rb:1
> b 5
> (rdbg) b 5
> #0 BP - Line /tmp/debug-20220916-1804-xhwni.rb:5 (line)
> b 10
> (rdbg) b 10
> #1 BP - Line /tmp/debug-20220916-1804-xhwni.rb:10 (line)
> (rdbg) c
> DEBUGGER: Attaching after process 37[27](https://github.com/ruby/debug/actions/runs/2973698355/jobs/4951402957#step:4:28) fork to child process 37[36](https://github.com/ruby/debug/actions/runs/2973698355/jobs/4951402957#step:4:37)
> [4, 13] in /tmp/debug-20220916-1804-xhwni.rb
> 4| b = 2
> 5| c = 3
> 6| binding.b do: 'p :child_leave'
> 7| end
> 8| sleep 0.5
> => 9| binding.b do: 'p :parent_enter'
> 10| a = 1
> 11| b = 2
> 12| c = 3
> 13| binding.b do: 'p :parent_leave'
> =>#0 <main> at /tmp/debug-20220916-1804-xhwni.rb:9
> (rdbg:binding.break) p :parent_enter
> => :parent_enter
> [5, 14] in /tmp/debug-20220916-1804-xhwni.rb
> 5| c = 3
> 6| binding.b do: 'p :child_leave'
> 7| end
> 8| sleep 0.5
> 9| binding.b do: 'p :parent_enter'
> => 10| a = 1
> 11| b = 2
> 12| c = 3
> 13| binding.b do: 'p :parent_leave'
> 14| Process.waitpid pid
> =>#0 <main> at /tmp/debug-20220916-1804-xhwni.rb:10
>
> Stop by #1 BP - Line /tmp/debug-20220916-1804-xhwni.rb:10 (line)
-------------------
| Failure Message |
-------------------
Expected the debugger program to finish on LOCAL mode.
/home/runner/work/debug/debug/test/support/assertions.rb:97:in `assert_block'
/home/runner/work/debug/debug/test/support/console_test_case.rb:107:in `rescue in block (2 levels) in debug_code'
/home/runner/work/debug/debug/test/support/console_test_case.rb:92:in `block (2 levels) in debug_code'
/home/runner/work/debug/debug/test/support/console_test_case.rb:209:in `prepare_test_environment'
/home/runner/work/debug/debug/test/support/console_test_case.rb:90:in `block in debug_code'
/home/runner/.rubies/ruby-debug/lib/ruby/3.2.0+2/timeout.rb:188:in `block in timeout'
/home/runner/.rubies/ruby-debug/lib/ruby/3.2.0+2/timeout.rb:36:in `block in catch'
/home/runner/.rubies/ruby-debug/lib/ruby/3.2.0+2/timeout.rb:36:in `catch'
/home/runner/.rubies/ruby-debug/lib/ruby/3.2.0+2/timeout.rb:36:in `catch'
/home/runner/.rubies/ruby-debug/lib/ruby/3.2.0+2/timeout.rb:197:in `timeout'
/home/runner/work/debug/debug/test/support/console_test_case.rb:89:in `debug_code'
/home/runner/work/debug/debug/test/console/config_fork_test.rb:51:in `test_default_case'
[48](https://github.com/ruby/debug/actions/runs/2973698355/jobs/4951402957#step:4:49):
[49](https://github.com/ruby/debug/actions/runs/2973698355/jobs/4951402957#step:4:50): module ForkTestTemplate
[50](https://github.com/ruby/debug/actions/runs/2973698355/jobs/4951402957#step:4:51): def test_default_case
=> [51](https://github.com/ruby/debug/actions/runs/2973698355/jobs/4951402957#step:4:52): debug_code(program) do
[52](https://github.com/ruby/debug/actions/runs/2973698355/jobs/4951402957#step:4:53): # type 'config fork_mode = both' # default
[53](https://github.com/ruby/debug/actions/runs/2973698355/jobs/4951402957#step:4:54): type 'b 5'
[54](https://github.com/ruby/debug/actions/runs/2973698355/jobs/4951402957#step:4:55): type 'b 10'
===============================================================================
It seems to stick at fork example. Let me check...