Skip to content

Commit

Permalink
merge revision(s) 64799,64800,64801: [Backport #15105]
Browse files Browse the repository at this point in the history
	fix typo.

	* vm_exec.h (DEBUG_END_INSN()): use `ec` instead of `th`.
	  This macro is used when `VMDEBUG > 0`.


	escape all env properly.

	* vm_backtrace.c (rb_debug_inspector_open): escape all env using
	  `rb_vm_stack_to_heap()` before making bindings.
	  [Bug #15105]

	  There is a complicated story of this issue:
	  Without this patch, IFUNC frame does not escaped. A IFUNC frame
	  points to CFUNC ep as previous ep. However, CFUNC ep can be escaped
	  because of making bindings of Ruby level frames.
	  IFUNC's ep can points to invalidated ep and `rb_iter_break()` will
	  fail. This is why `any?` fails.

	* test/-ext-/debug/test_debug.rb: add a test.


	* remove trailing spaces.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@66074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nagachika committed Nov 28, 2018
1 parent 29eae8b commit e84f807
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
16 changes: 16 additions & 0 deletions test/-ext-/debug/test_debug.rb
Expand Up @@ -56,4 +56,20 @@ def test_inspector_open_in_eval
binds = inspector_in_eval
binds_check binds, bug7635
end

class MyRelation
include Enumerable

def each
yield :each_entry
end
end

def test_lazy_block
x = MyRelation.new.any? do
Bug::Debug.inspector
true
end
assert_equal true, x, '[Bug #15105]'
end
end
2 changes: 1 addition & 1 deletion version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.5.4"
#define RUBY_RELEASE_DATE "2018-11-28"
#define RUBY_PATCHLEVEL 113
#define RUBY_PATCHLEVEL 114

#define RUBY_RELEASE_YEAR 2018
#define RUBY_RELEASE_MONTH 11
Expand Down
3 changes: 3 additions & 0 deletions vm_backtrace.c
Expand Up @@ -1201,6 +1201,9 @@ rb_debug_inspector_open(rb_debug_inspector_func_t func, void *data)
enum ruby_tag_type state;
volatile VALUE MAYBE_UNUSED(result);

/* escape all env to heap */
rb_vm_stack_to_heap(ec);

dbg_context.ec = ec;
dbg_context.cfp = dbg_context.ec->cfp;
dbg_context.backtrace = ec_backtrace_location_ary(ec, 0, 0);
Expand Down
2 changes: 1 addition & 1 deletion vm_exec.h
Expand Up @@ -36,7 +36,7 @@ typedef rb_iseq_t *ISEQ;
#endif

#define DEBUG_END_INSN() \
rb_vmdebug_debug_print_post(th, GET_CFP() SC_REGS());
rb_vmdebug_debug_print_post(ec, GET_CFP() SC_REGS());

#else

Expand Down

0 comments on commit e84f807

Please sign in to comment.