Skip to content

Commit

Permalink
Merge pull request #1 from farleyknight/patch-1
Browse files Browse the repository at this point in the history
Test for ggdb, which is provided on Mac ports.
  • Loading branch information
Farley Knight committed Dec 5, 2013
2 parents 06ff782 + 26a68e1 commit 7c3d2f0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/hijack/gdb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,20 @@ def quit
def previous_frame_inner_to_this_frame?
backtrace.last =~ /previous frame inner to this frame/i
end

def gdb_path
# Check for gdb
if File.exists?(`which gdb`)
`which gdb`.strip
elsif File.exists?(`which ggdb`)
`which ggdb`.strip
else
raise "Cannot find suitable gdb!"
end
end

def attach_outside_gc
@gdb = IO.popen("gdb -q #{@exec_path} #{@pid} 2>&1", 'r+')
@gdb = IO.popen("#{gdb_path} -q #{@exec_path} #{@pid} 2>&1", 'r+')
wait
ensure_attached_to_ruby_process
attached = false
Expand Down

0 comments on commit 7c3d2f0

Please sign in to comment.