Skip to content

Commit 9026873

Browse files
equivalence1dmitrii.kravchenko
authored andcommitted
It is essential for lldb connecting to OS X's ruby process to specify function type. Under OS X (due to compilation keys, I guess) lldb does not know type of ruby functions so we need to write them explicitly.
1 parent d91c3d1 commit 9026873

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

bin/gdb_wrapper

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ class NativeDebugger
105105
@debugger_loader_path = debugger_loader_path
106106
@argv = argv
107107

108+
@eval_string = "rb_eval_string_protect(\"require '#{@debugger_loader_path}'; load_debugger(#{@gems_to_include.gsub("\"", "'")}, #{@argv.gsub("\"", "'")})\", (int *)0)"
109+
108110
launch_string = "#{self} #{executable} #{flags}"
109111
@pipe = IO.popen(launch_string, 'r+')
110112
$stdout.puts "executed '#{launch_string}'"
@@ -177,7 +179,7 @@ class NativeDebugger
177179
end
178180

179181
def load_debugger
180-
execute "call rb_eval_string_protect(\"require '#{@debugger_loader_path}'; load_debugger(#{@gems_to_include.gsub("\"", "'")}, #{@argv.gsub("\"", "'")})\", (int *)0)"
182+
181183
end
182184

183185
def exit
@@ -230,10 +232,14 @@ class LLDB < NativeDebugger
230232
def call_start_attach
231233
super()
232234
execute "expr (void *) dlopen(\"#{@path_to_attach}\", 2)"
233-
execute 'call start_attach()'
235+
execute 'expr (int) start_attach()'
234236
set_tbreak(@tbreak)
235237
end
236238

239+
def load_debugger
240+
execute "expr (VALUE) #{@eval_string}"
241+
end
242+
237243
def to_s
238244
'lldb'
239245
end
@@ -284,6 +290,10 @@ class GDB < NativeDebugger
284290
set_tbreak(@tbreak)
285291
end
286292

293+
def load_debugger
294+
execute "call #{@eval_string}"
295+
end
296+
287297
def to_s
288298
'gdb'
289299
end

0 commit comments

Comments
 (0)