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: 0 additions & 10 deletions ext/Makefile

This file was deleted.

29 changes: 0 additions & 29 deletions ext/attach.c

This file was deleted.

9 changes: 0 additions & 9 deletions ext/attach.h

This file was deleted.

8 changes: 6 additions & 2 deletions lib/ruby-debug-ide/attach/gdb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ def switch_to_thread(thread_num)
execute "thread #{thread_num}"
end

def set_break(str)
execute "tbreak #{str}"
end

def call_start_attach
super()
execute "call dlopen(\"#{@path_to_attach}\", 2)"
execute 'call start_attach()'
set_tbreak(@tbreak)
execute 'call debase_start_attach()'
set_break(@tbreak)
end

def print_delimiter
Expand Down
10 changes: 7 additions & 3 deletions lib/ruby-debug-ide/attach/lldb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ def switch_to_thread(thread_num)
execute "thread select #{thread_num}"
end

def set_break(str)
execute "breakpoint set --shlib #{@path_to_attach} --name #{str}"
end

def call_start_attach
super()
execute "expr (void *) dlopen(\"#{@path_to_attach}\", 2)"
execute 'expr (int) start_attach()'
set_tbreak(@tbreak)
execute 'expr (int) debase_start_attach()'
set_break(@tbreak)
end

def print_delimiter
Expand All @@ -51,7 +55,7 @@ def check_delimiter(line)
end

def load_debugger
execute "expr (VALUE) #{@eval_string}"
execute "expr (void) #{@eval_string}"
end

def to_s
Expand Down
11 changes: 6 additions & 5 deletions lib/ruby-debug-ide/attach/native_debugger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def initialize(executable, pid, flags, gems_to_include, debugger_loader_path, ar
@debugger_loader_path = debugger_loader_path
@argv = argv

@eval_string = "rb_eval_string_protect(\"require '#{@debugger_loader_path}'; load_debugger(#{@gems_to_include.gsub("\"", "'")}, #{@argv.gsub("\"", "'")})\", (int *)0)"
@eval_string = "debase_rb_eval(\"require '#{@debugger_loader_path}'; load_debugger(#{@gems_to_include.gsub("\"", "'")}, #{@argv.gsub("\"", "'")})\", (int *)0)"

launch_string = "#{self} #{executable} #{flags}"
@pipe = IO.popen(launch_string, 'r+')
Expand All @@ -30,7 +30,7 @@ def initialize(executable, pid, flags, gems_to_include, debugger_loader_path, ar

def find_attach_lib(debase_path)
attach_lib = debase_path + '/attach'
known_extensions = %w(.so .bundle .dll)
known_extensions = %w(.so .bundle .dll .dylib)
known_extensions.each do |ext|
if File.file?(attach_lib + ext)
return attach_lib + ext
Expand Down Expand Up @@ -60,8 +60,8 @@ def get_response
content = ''
loop do
line = @pipe.readline
break if check_delimiter(line)
DebugPrinter.print_debug('respond line: ' + line)
break if check_delimiter(line)
next if line =~ /\(lldb\)/ # lldb repeats your input to its output
content += line
end
Expand Down Expand Up @@ -89,15 +89,16 @@ def switch_to_thread

end

def set_tbreak(str)
execute "tbreak #{str}"
def set_break(str)

end

def continue
$stdout.puts 'continuing'
@pipe.puts 'c'
loop do
line = @pipe.readline
DebugPrinter.print_debug('respond line: ' + line)
break if line =~ /#{Regexp.escape(@tbreak)}/
end
get_response
Expand Down