# \[ruby-trunk - Bug #10689\] \[Open\] \`unexpected break' occurs when TracePoint#binding is called

**URL:** <https://www.ruby-forum.com/t/ruby-trunk-bug-10689-open-unexpected-break-occurs-when-tracepoint-binding-is-called/233666>\
**Category:** Development\
**Created:** [January 2, 2015, 10:50am UTC](https://www.ruby-forum.com/t/ruby-trunk-bug-10689-open-unexpected-break-occurs-when-tracepoint-binding-is-called/233666 "2015-01-02T10:50:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [January 2, 2015, 10:50am UTC](https://www.ruby-forum.com/t/ruby-trunk-bug-10689-open-unexpected-break-occurs-when-tracepoint-binding-is-called/233666/1 "2015-01-02T10:50:17Z")

</div>

Issue #10689 has been reported by Kazuki Tsujimoto.

* * *

Bug #10689: `unexpected break’ occurs when TracePoint#binding is called

> **[Bug #10689: \`unexpected break' occurs when TracePoint#binding is called -...](https://bugs.ruby-lang.org/issues/10689)**
>
> Redmine

- Author: Kazuki Tsujimoto
- Status: Open
- Priority: Normal
- Assignee:
- Category: core
- Target version:
- ruby -v: ruby 2.3.0dev (2015-01-02 trunk 49102) [x86\_64-linux]
- Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED

* * *

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

```ruby
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)
