Project

General

Profile

Actions

Bug #10689

closed

`unexpected break' occurs when TracePoint#binding is called

Added by ktsj (Kazuki Tsujimoto) almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-01-02 trunk 49102) [x86_64-linux]
[ruby-dev:48797]

Description

以下のコードでunexpected breakになります。

class Bug
  include Enumerable

  def each
    [0].each do 
      yield
    end
  end
end

TracePoint.trace(:c_return) do |tp|
  tp.binding
end

Bug.new.all? { false }

all?中のrb_iter_breakによってth->errinfoがセットされた後に、
TracePoint#binding呼び出しによってcfpのepがヒープを指すようになってしまうのが原因です。

とりあえずTracePoint呼び出し後にth->errinfoのepを書き換えるようにしてみたパッチを添付します。


Files

fix-unexpected-break.patch (3.32 KB) fix-unexpected-break.patch ktsj (Kazuki Tsujimoto), 01/02/2015 09:45 AM
save-target-cfp-in-errinfo.patch (6.26 KB) save-target-cfp-in-errinfo.patch ktsj (Kazuki Tsujimoto), 01/03/2015 01:53 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0