Skip to content

Instantly share code, notes, and snippets.

@rocky
Created August 17, 2011 10:14
Show Gist options
  • Select an option

  • Save rocky/1151261 to your computer and use it in GitHub Desktop.

Select an option

Save rocky/1151261 to your computer and use it in GitHub Desktop.
rubinius 2.0-pre issue with rbx-trepanning
    def debugger(settings = {:immediate => false})
    @settings = @settings.merge(settings)
    skip_loader if @settings[:skip_loader]
    spinup_thread
    puts "1"
    @debugee_thread = @thread
    # if @settings[:hide_level]
    #   @processor.hidelevels[@thread] = @settings[:hide_level]
    # end

    # process_cmdfile_setting(settings)

    # Feed info (breakpoint, debugged program thread, channel and backtrace 
    # info) to the debugger thread
    locs = Rubinius::VM.backtrace(@settings[:offset] + 1, true)

    method = Rubinius::CompiledMethod.of_sender

    event = settings[:immediate] ? 'debugger-call' : 'start'
    bp = Breakpoint.new('<start>', method, 0, 0, 0, {:event => event} )
    channel = Rubinius::Channel.new

    puts "2"
    @local_channel.send Rubinius::Tuple[bp, Thread.current, channel, locs]
    puts "3"

    # wait for the debugger to release us
    channel.receive
    puts "4"

    # Now that there is a debugger on the other end, set the debugged 
    # program thread to call us when it hits a breakpoint.
    Thread.current.set_debugger_thread @thread
    puts "5"
    self
  end

I get input and output:

   $ ./bin/trepanx test/example/gcd.rb 3 5
    1
    2
    3
    4
    5
    no waiters
    The GCD of 3 and 5 is 1
    trepanx: That's all, folks...
    trepanx: That's all, folks...
    $ 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment