Skip to content

Commit 8abc50a

Browse files
nyz93ko1
authored andcommitted
do not include $FILENAME in globals
`$FILENAME` is unsafe to include in the globals because it modifies ARGV and raises an error if it's a file that does not exist. This causes two issues if rdbg used to debug a command with arguments. * when using rdbg the server will crash when running `info globals`, as it does not catch the error * when using a DAP client that requests globals before the debugged program was able to handle its arguments then the ARGV changes and the program will not do what's expected
1 parent 0b77e82 commit 8abc50a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/debug/thread_client.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def skip_location?(loc)
4444
end
4545

4646
module GlobalVariablesHelper
47-
SKIP_GLOBAL_LIST = %i[$= $KCODE $-K $SAFE].freeze
47+
SKIP_GLOBAL_LIST = %i[$= $KCODE $-K $SAFE $FILENAME].freeze
4848
def safe_global_variables
4949
global_variables.reject{|name| SKIP_GLOBAL_LIST.include? name }
5050
end

0 commit comments

Comments
 (0)