[前][次][番号順一覧][スレッド一覧]

ruby-changes:41152

From: nobu <ko1@a...>
Date: Mon, 21 Dec 2015 10:19:00 +0900 (JST)
Subject: [ruby-changes:41152] nobu:r53225 (trunk): vm_backtrace.c: ignore ifunc frames

nobu	2015-12-21 10:18:48 +0900 (Mon, 21 Dec 2015)

  New Revision: 53225

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53225

  Log:
    vm_backtrace.c: ignore ifunc frames
    
    * vm_backtrace.c (rb_profile_frames): ignore ifunc frames as it
      did before.  [ruby-core:72409] [Bug #11851]

  Modified files:
    trunk/ChangeLog
    trunk/test/-ext-/debug/test_profile_frames.rb
    trunk/vm_backtrace.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53224)
+++ ChangeLog	(revision 53225)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Dec 21 10:18:46 2015  Kazuki Yamaguchi  <k@r...>
+
+	* vm_backtrace.c (rb_profile_frames): ignore ifunc frames as it
+	  did before.  [ruby-core:72409] [Bug #11851]
+
 Mon Dec 21 09:33:17 2015  Karol Bucek  <kares@u...>
 
 	* ext/openssl/lib/openssl/ssl.rb (OpenSSL::SSL::SSLSocket): fix
Index: vm_backtrace.c
===================================================================
--- vm_backtrace.c	(revision 53224)
+++ vm_backtrace.c	(revision 53225)
@@ -1248,25 +1248,25 @@ rb_profile_frames(int start, int limit, https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L1248
     int i;
     rb_thread_t *th = GET_THREAD();
     rb_control_frame_t *cfp = th->cfp, *end_cfp = RUBY_VM_END_CONTROL_FRAME(th);
+    const rb_callable_method_entry_t *cme;
 
     for (i=0; i<limit && cfp != end_cfp;) {
-	const rb_callable_method_entry_t *cme = rb_vm_frame_method_entry(cfp);
-
-	if ((cme && cme->def->type == VM_METHOD_TYPE_ISEQ) || (cfp->iseq && cfp->pc)) {
+	if (cfp->iseq && cfp->pc) {
 	    if (start > 0) {
 		start--;
 		continue;
 	    }
 
 	    /* record frame info */
-	    if (cme) {
+	    cme = rb_vm_frame_method_entry(cfp);
+	    if (cme && cme->def->type == VM_METHOD_TYPE_ISEQ) {
 		buff[i] = (VALUE)cme;
 	    }
 	    else {
 		buff[i] = (VALUE)cfp->iseq;
 	    }
 
-	    if (cfp->iseq && lines) lines[i] = calc_lineno(cfp->iseq, cfp->pc);
+	    if (lines) lines[i] = calc_lineno(cfp->iseq, cfp->pc);
 
 	    i++;
 	}
Index: test/-ext-/debug/test_profile_frames.rb
===================================================================
--- test/-ext-/debug/test_profile_frames.rb	(revision 53224)
+++ test/-ext-/debug/test_profile_frames.rb	(revision 53225)
@@ -102,4 +102,21 @@ class TestProfileFrames < Test::Unit::Te https://github.com/ruby/ruby/blob/trunk/test/-ext-/debug/test_profile_frames.rb#L102
       end
     }
   end
+
+  def test_ifunc_frame
+    bug11851 = '[ruby-core:72409] [Bug #11851]'
+    assert_ruby_status([], <<~'end;', bug11851) # do
+      require '-test-/debug'
+      class A
+        include Bug::Debug
+        def x
+          profile_frames(0, 10)
+        end
+      end
+      def a
+        [A.new].each(&:x)
+      end
+      a
+    end;
+  end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]