Skip to content
  • NARUSE, Yui's avatar
    0315e1e5
    merge revision(s) f9f13a4f: [Backport #17746] · 0315e1e5
    NARUSE, Yui authored
    
    
    	Ensure that caller respects the start argument
    
    	Previously, if there were ignored frames (iseq without pc), we could
    	go beyond the requested start frame.  This has two changes:
    
    	1) Ensure that we don't look beyond the start frame by using
    	last_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(last_cfp) until the
    	desired start frame is reached.
    
    	2) To fix the failures caused by change 1), which occur when a
    	limited number of frames is requested, scan the VM stack before
    	allocating backtrace frames, looking for ignored frames. This
    	is complicated if there are ignored frames before and after
    	the start, in which case we need to scan until the start frame,
    	and then scan backwards, decrementing the start value until we
    	get to the point where start will result in the number of
    	requested frames.
    
    	This fixes a Rails test failure.  Jean Boussier was able to
    	to produce a failing test case outside of Rails.
    
    Co-authored-by: default avatarJean Boussier <jean.boussier@gmail.com>
    	---
    	 test/ruby/test_backtrace.rb | 16 ++++++++++++++
    	 vm_backtrace.c              | 52 +++++++++++++++++++++++++++++++++++++++++++--
    	 2 files changed, 66 insertions(+), 2 deletions(-)
    0315e1e5
    merge revision(s) f9f13a4f: [Backport #17746]
    NARUSE, Yui authored
    
    
    	Ensure that caller respects the start argument
    
    	Previously, if there were ignored frames (iseq without pc), we could
    	go beyond the requested start frame.  This has two changes:
    
    	1) Ensure that we don't look beyond the start frame by using
    	last_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(last_cfp) until the
    	desired start frame is reached.
    
    	2) To fix the failures caused by change 1), which occur when a
    	limited number of frames is requested, scan the VM stack before
    	allocating backtrace frames, looking for ignored frames. This
    	is complicated if there are ignored frames before and after
    	the start, in which case we need to scan until the start frame,
    	and then scan backwards, decrementing the start value until we
    	get to the point where start will result in the number of
    	requested frames.
    
    	This fixes a Rails test failure.  Jean Boussier was able to
    	to produce a failing test case outside of Rails.
    
    Co-authored-by: default avatarJean Boussier <jean.boussier@gmail.com>
    	---
    	 test/ruby/test_backtrace.rb | 16 ++++++++++++++
    	 vm_backtrace.c              | 52 +++++++++++++++++++++++++++++++++++++++++++--
    	 2 files changed, 66 insertions(+), 2 deletions(-)
Loading