Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/debug/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def self.config
end

def initialize argv
@skip_all = false

if self.class.config
raise 'Can not make multiple configurations in one process'
end
Expand All @@ -78,6 +80,14 @@ def []=(key, val)
set_config(key => val)
end

def skip_all
@skip_all = true
end

def skip?
@skip_all
end

def set_config(**kw)
conf = config.dup
kw.each{|k, v|
Expand Down
2 changes: 1 addition & 1 deletion lib/debug/server_dap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def self.setup debug_port
end

at_exit do
CONFIG[:skip_path] = [//] # skip all
CONFIG.skip_all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really a user configuration but a debugger's internal controlling state. So I think DEBUGGER__.skip? is a better place for this method.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry what is DEBUGGER__.skip? and how to use it for here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant instead of defining on CONFIG, it can be defined on DEBUGGER__. Because it actually has nothing to do with the configuration.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. It seems better.

FileUtils.rm_rf dir if tempdir
end

Expand Down
4 changes: 3 additions & 1 deletion lib/debug/thread_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
module DEBUGGER__
module SkipPathHelper
def skip_path?(path)
!path || skip_internal_path?(path) || (skip_paths = CONFIG[:skip_path]) && skip_paths.any?{|skip_path| path.match?(skip_path)}
CONFIG.skip? || !path ||
skip_internal_path?(path) ||
(skip_paths = CONFIG[:skip_path]) && skip_paths.any?{|skip_path| path.match?(skip_path)}
end

def skip_internal_path?(path)
Expand Down