Skip to content

Commit

Permalink
do not include $FILENAME in globals
Browse files Browse the repository at this point in the history
`$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
  • Loading branch information
nyz93 committed May 30, 2024
1 parent 0b77e82 commit bb88970
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/debug/thread_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def skip_location?(loc)
end

module GlobalVariablesHelper
SKIP_GLOBAL_LIST = %i[$= $KCODE $-K $SAFE].freeze
SKIP_GLOBAL_LIST = %i[$= $KCODE $-K $SAFE $FILENAME].freeze
def safe_global_variables
global_variables.reject{|name| SKIP_GLOBAL_LIST.include? name }
end
Expand Down

0 comments on commit bb88970

Please sign in to comment.