Skip to content

Commit

Permalink
Attach lib can have different extension than '.so' (e.g. '.bundle' un…
Browse files Browse the repository at this point in the history
…der OS X). So we need to find appropriate one manually.
  • Loading branch information
equivalence1 authored and dmitrii.kravchenko committed Sep 29, 2016
1 parent 6ae52ee commit c03250e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bin/gdb_wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class NativeDebugger
if debase_path.size == 0
raise 'No debase gem found.'
end
@path_to_attach = debase_path[0] + '/attach.so'
@path_to_attach = find_attach_lib(debase_path[0])

@gems_to_include = '["' + gems_to_include * '", "' + '"]'
@debugger_loader_path = debugger_loader_path
Expand All @@ -112,6 +112,18 @@ class NativeDebugger
$stdout.puts "executed '#{launch_string}'"
end

def find_attach_lib(debase_path)
attach_lib = debase_path + '/attach'
known_extensions = %w(.so .bundle .dll)
known_extensions.each do |ext|
if File.file?(attach_lib + ext)
return attach_lib + ext
end
end

raise 'Could not find attach library'
end

def attach_to_process
execute "attach #{@pid}"
end
Expand Down

0 comments on commit c03250e

Please sign in to comment.