The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Binding.of_caller and breakpoint breaking in 4 days (Ruby 1.8.5)

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eigen Class

Posts: 358
Nickname: eigenclass
Registered: Oct, 2005

Eigenclass is a hardcore Ruby blog.
Binding.of_caller and breakpoint breaking in 4 days (Ruby 1.8.5) Posted: Aug 22, 2006 11:48 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Eigen Class.
Original Post: Binding.of_caller and breakpoint breaking in 4 days (Ruby 1.8.5)
Feed Title: Eigenclass
Feed URL: http://feeds.feedburner.com/eigenclass
Feed Description: Ruby stuff --- trying to stay away from triviality.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Eigen Class
Latest Posts From Eigenclass

Advertisement

You might have heard of Florian Gro��' Binding.of_caller before. More probably, you might have used his breakpoint library (yes, the one included in Rails, which can be used with script/breakpointer). If you read ruby-core a few months ago, you'll know that it only worked thanks to a bug which is being fixed in Ruby 1.8.5. Which means that breakpoint will be breaking in under a week time, since matz is releasing 1.8.5 next Friday or Saturday at the latest*1.

Fortunately, I'd kept an unreleased rcov branch with some 500 lines of C to implement a better Kernel#caller method, which I had discarded at first because there was a much easier way to proceed when bindings were not needed.

So, I have the functionality that will keep breakpoint alive after the arrival of 1.8.5, but I need some help to refine the interface before it can be released; better get the naming right the first time, and this is something several brains tend to do better than one.

This is what it looks like currently:

require 'binding_n'
def a; _a = 1; b end
def b; _b = 2; c end
def c; _c = 3; d end
def d; _d = 4; send(:e) end
def e
  levels = binding_n(10)
  levels.each do |klass, id, file, line, binding, lang|
    puts "=" * 80
    p [klass, id, file, line, lang]
    next unless binding
    p eval("local_variables", binding).map{|x| [x, eval(x, binding)]}
  end
end

def x
  Kernel.install_binding_n_hook
  a
  Kernel.remove_binding_n_hook
end

x


Read more...

Read: Binding.of_caller and breakpoint breaking in 4 days (Ruby 1.8.5)

Topic: Marshalling Ruby 2.0 Codes Previous Topic   Next Topic Topic: FreeBSD 6 vs. Broadcom NetXtreme II

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use