Skip to content

Commit c03250e

Browse files
equivalence1dmitrii.kravchenko
authored andcommitted
Attach lib can have different extension than '.so' (e.g. '.bundle' under OS X). So we need to find appropriate one manually.
1 parent 6ae52ee commit c03250e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

bin/gdb_wrapper

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class NativeDebugger
9999
if debase_path.size == 0
100100
raise 'No debase gem found.'
101101
end
102-
@path_to_attach = debase_path[0] + '/attach.so'
102+
@path_to_attach = find_attach_lib(debase_path[0])
103103

104104
@gems_to_include = '["' + gems_to_include * '", "' + '"]'
105105
@debugger_loader_path = debugger_loader_path
@@ -112,6 +112,18 @@ class NativeDebugger
112112
$stdout.puts "executed '#{launch_string}'"
113113
end
114114

115+
def find_attach_lib(debase_path)
116+
attach_lib = debase_path + '/attach'
117+
known_extensions = %w(.so .bundle .dll)
118+
known_extensions.each do |ext|
119+
if File.file?(attach_lib + ext)
120+
return attach_lib + ext
121+
end
122+
end
123+
124+
raise 'Could not find attach library'
125+
end
126+
115127
def attach_to_process
116128
execute "attach #{@pid}"
117129
end

0 commit comments

Comments
 (0)