class Lldbrun::ParserPoint
Constants
- CURRENT_DIR
- LLDBPOINT
- PREV_DIR
- RELATIVE_PATH
Attributes
argv_parser[R]
break_points[R]
Public Class Methods
new(argv_parser)
click to toggle source
# File lib/lldbrun/ParserPoint.rb, line 11 def initialize(argv_parser) @argv_parser = argv_parser @break_points = [] end
Public Instance Methods
run()
click to toggle source
# File lib/lldbrun/ParserPoint.rb, line 16 def run scan_dir(argv_parser.param_scan_dir) if argv_parser.params[ParserARGV::PARAMETER_SCAN_DIR] system(generate_start_command) end
Private Instance Methods
absolute_file_path(path)
click to toggle source
# File lib/lldbrun/ParserPoint.rb, line 64 def absolute_file_path(path) absolute_path = '' if relative_path?(path) absolute_path << "#{`pwd`.strip}/#{path}" end absolute_path end
full_path(dir, name)
click to toggle source
# File lib/lldbrun/ParserPoint.rb, line 60 def full_path(dir, name) "#{dir}/#{name}" end
generate_start_command()
click to toggle source
# File lib/lldbrun/ParserPoint.rb, line 27 def generate_start_command lldb_command = lldb_run_command lldb_command << lldb_standard_params break_points.each do |break_point| lldb_command << lldb_breakpoint_by_file_line(break_point) end lldb_command << lldb_breakpoint_by_method_name lldb_command << lldb_run lldb_command << lldb_skip_first_step lldb_command end
lldb_breakpoint_by_file_line(break_point)
click to toggle source
# File lib/lldbrun/ParserPoint.rb, line 44 def lldb_breakpoint_by_file_line(break_point) " -o \"#{break_point.lldb_set_breakpoint}\"" end
lldb_breakpoint_by_method_name()
click to toggle source
# File lib/lldbrun/ParserPoint.rb, line 40 def lldb_breakpoint_by_method_name " -o \"#{BreakPoint.lldb_set_method_name_breakpoint}\"" end
lldb_run()
click to toggle source
# File lib/lldbrun/ParserPoint.rb, line 52 def lldb_run argv_parser.param_auto_run? ? ' -o run' : '' end
lldb_run_command()
click to toggle source
# File lib/lldbrun/ParserPoint.rb, line 23 def lldb_run_command "#{argv_parser.param_lldb} #{argv_parser.param_file_path}" end
lldb_skip_first_step()
click to toggle source
# File lib/lldbrun/ParserPoint.rb, line 56 def lldb_skip_first_step argv_parser.param_skip_first_step? ? ' -o next' : '' end
lldb_standard_params()
click to toggle source
# File lib/lldbrun/ParserPoint.rb, line 48 def lldb_standard_params ' ' << argv_parser.param_lldb_options end
relative_path?(path)
click to toggle source
# File lib/lldbrun/ParserPoint.rb, line 73 def relative_path?(path) path[RELATIVE_PATH].to_i end
scan_dir(dir)
click to toggle source
# File lib/lldbrun/ParserPoint.rb, line 86 def scan_dir(dir) Dir.foreach(dir) do |name| path = full_path(dir, name) next if name[PREV_DIR] || name[CURRENT_DIR] if File.directory?(path) scan_dir(path) next end scan_file(path) end end
scan_file(path)
click to toggle source
# File lib/lldbrun/ParserPoint.rb, line 77 def scan_file(path) File.open(path, File::RDONLY) do |file| file.each_with_index do |line, index| @break_points << BreakPoint.new(absolute_file_path(path), index + 1) if line.encode("UTF-8", :invalid=>:replace, :replace=>"?")[LLDBPOINT] end file.close end end