Skip to content

Commit 5d9a1f2

Browse files
committed
Let's print if file filtering is support on debugger's start
1 parent bf0ce27 commit 5d9a1f2

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed

lib/ruby-debug-ide.rb

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@ def start_control(host, port, notify_dispatcher)
108108
# "localhost" and nil have problems on some systems.
109109
host ||= '127.0.0.1'
110110
server = TCPServer.new(host, port)
111-
gem_name = (defined?(JRUBY_VERSION) || RUBY_VERSION < '1.9.0') ? 'ruby-debug-base' :
112-
RUBY_VERSION < '2.0.0' ? 'ruby-debug-base19x' : 'debase'
113-
$stderr.printf "Fast Debugger (ruby-debug-ide #{IDE_VERSION}, #{gem_name} #{VERSION}) listens on #{host}:#{port}\n"
111+
print_greeting_msg(host, port)
114112
notify_dispatcher(port) if notify_dispatcher
115113

116114
while (session = server.accept)
@@ -138,8 +136,26 @@ def start_control(host, port, notify_dispatcher)
138136
end
139137
end
140138

139+
def print_greeting_msg(host, port)
140+
base_gem_name = if defined?(JRUBY_VERSION) || RUBY_VERSION < '1.9.0'
141+
'ruby-debug-base'
142+
elsif RUBY_VERSION < '2.0.0'
143+
'ruby-debug-base19x'
144+
else
145+
'debase'
146+
end
147+
148+
file_filtering_support = if Command.file_fiter_supported?
149+
'supported'
150+
else
151+
'not supported'
152+
end
153+
$stderr.printf "Fast Debugger (ruby-debug-ide #{IDE_VERSION}, #{base_gem_name} #{VERSION}, file filtering is #{file_filtering_support}) listens on #{host}:#{port}\n"
154+
end
155+
141156
private
142157

158+
143159
def notify_dispatcher(port)
144160
return unless ENV['IDE_PROCESS_DISPATCHER']
145161
acceptor_host, acceptor_port = ENV['IDE_PROCESS_DISPATCHER'].split(":")

lib/ruby-debug-ide/command.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ def unescape_incoming(str)
7070
$1 + "\n" * ($2.size / 2)
7171
end.gsub(/\\\\/, '\\')
7272
end
73+
74+
def file_fiter_supported?
75+
defined?(Debugger.file_filter)
76+
end
7377
end
7478

7579
def initialize(state, printer)
@@ -145,7 +149,18 @@ def line_at(file, line)
145149

146150
def get_context(thnum)
147151
Debugger.contexts.find{|c| c.thnum == thnum}
148-
end
152+
end
153+
154+
def realpath(filename)
155+
if filename.index(File::SEPARATOR) || File::ALT_SEPARATOR && filename.index(File::ALT_SEPARATOR)
156+
filename = File.expand_path(filename)
157+
end
158+
if (RUBY_VERSION < '1.9') || (RbConfig::CONFIG['host_os'] =~ /mswin/)
159+
filename
160+
else
161+
File.realpath(filename) rescue filename
162+
end
163+
end
149164
end
150165

151166
Command.load_commands

lib/ruby-debug-ide/commands/breakpoints.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,6 @@ def help(cmd)
6262
}
6363
end
6464
end
65-
66-
private
67-
def realpath(filename)
68-
filename = File.expand_path(filename) if filename.index(File::SEPARATOR) || \
69-
File::ALT_SEPARATOR && filename.index(File::ALT_SEPARATOR)
70-
if (RUBY_VERSION < '1.9') || (RbConfig::CONFIG['host_os'] =~ /mswin/)
71-
filename
72-
else
73-
File.realpath(filename) rescue filename
74-
end
75-
end
7665
end
7766

7867
class BreakpointsCommand < Command # :nodoc:

0 commit comments

Comments
 (0)