Skip to content

Instantly share code, notes, and snippets.

@rhenium
Created December 20, 2015 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhenium/e3a179b0cac87606c183 to your computer and use it in GitHub Desktop.
Save rhenium/e3a179b0cac87606c183 to your computer and use it in GitHub Desktop.
Bug #11851: rb_profile_frames() causes segmentation fault - Ruby trunk - Ruby Issue Tracking System https://bugs.ruby-lang.org/issues/11851
#include "ruby.h"
#include "ruby/debug.h"
VALUE
xxx(VALUE self)
{
VALUE buf[10];
int lines[10];
int n;
n = rb_profile_frames(0, 10, buf, lines);
return INT2FIX(n);
}
void
Init_bug(void)
{
rb_define_global_function("xxx", xxx, 0);
}
require "./bug.so"
class A
def x
p xxx
end
end
def a
[A.new].each(&:x)
end
a
require "mkmf"
create_makefile("bug")
@rhenium
Copy link
Author

rhenium commented Dec 20, 2015

git clone https://gist.github.com/e3a179b0cac87606c183.git
cd e3a179b0cac87606c183
ruby extconf.rb
make
ruby bug.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment