# Set\_trace\_func dumps core (2)

**URL:** <https://www.ruby-forum.com/t/set-trace-func-dumps-core-2/60261>\
**Category:** Development\
**Created:** [May 11, 2006, 5:57pm UTC](https://www.ruby-forum.com/t/set-trace-func-dumps-core-2/60261 "2006-05-11T17:57:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![URABE\_Shyouhei](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/eb8c5e/32.png) [@URABE\_Shyouhei](https://www.ruby-forum.com/u/URABE_Shyouhei)\
**Post date:** [May 11, 2006, 5:57pm UTC](https://www.ruby-forum.com/t/set-trace-func-dumps-core-2/60261/1 "2006-05-11T17:57:59Z")

</div>

e$B0J2\<$N$h$&$K$9$k$He(Bcoree$B$rEG$-$^$9!#e(B

% cat segv.rb  
class Binding  
def eval str, \*a  
Kernel.eval str, self, \*a  
end  
end

class Foo  
def m1  
callcc do |\*|  
x = lambda do |e, f, l, m, b, c|  
set\_trace\_func nil  
yield b  
end  
y = lambda do |e, \*|  
set\_trace\_func x if e == “return”  
end  
set\_trace\_func y  
return  
end  
end

def m2  
m1 do |b|  
p [self, b.eval(“self”), eval(“self”, b)]  
end  
end  
end

eval “Foo.new.m2.foo”

% gdb --args ruby-1.8 -v segv.rb  
GNU gdb 6.1-20040303 (Apple version gdb-413) (Wed May 18 10:17:02 GMT  
2005)  
Copyright 2004 Free Software Foundation, Inc.  
GDB is free software, covered by the GNU General Public License, and you  
are  
welcome to change it and/or distribute copies of it under certain  
conditions.  
Type “show copying” to see the conditions.  
There is absolutely no warranty for GDB. Type “show warranty” for  
details.  
This GDB was configured as “powerpc-apple-darwin”…Reading symbols for  
shared libraries … done

(gdb) run  
Starting program: /usr/local/bin/ruby-1.8 -v segv.rb  
Reading symbols for shared libraries …+. done  
ruby 1.8.4 (2006-05-11) [powerpc-darwin8.6.0]  
[#Foo:0x25a30, #Foo:0x25a30, #Foo:0x25a30]

Program received signal EXC\_BAD\_ACCESS, Could not access memory.  
Reason: KERN\_PROTECTION\_FAILURE at address: 0x00000000  
0x00000000 in ?? ()  
(gdb) bt  
#0 0x00000000 in ?? ()  
Cannot access memory at address 0x0  
Cannot access memory at address 0x0  
Cannot access memory at address 0x0  
#1 0x002254e8 in rb\_call0 (klass=Cannot access memory at address 0x0  
154520, recv=154160, id=10065, oid=Cannot access memory at address 0x0  
Cannot access memory at address 0x0  
10065, argc=0, argv=0x0, body=0x25d28, flags=0) at  
…/ruby-1.8/eval.c:5920  
#2 0x00225838 in rb\_call (klass=154520, recv=154160, mid=10065, argc=0,  
argv=0x0, scope=0) at …/ruby-1.8/eval.c:6001  
#3 0x00222984 in rb\_eval (self=219620, n=0x25d28) at  
…/ruby-1.8/eval.c:3430  
#4 0x002227b4 in rb\_eval (self=219620, n=0x25d28) at  
…/ruby-1.8/eval.c:3424  
#5 0x002315ec in eval (self=219620, src=154400, scope=4, file=0x2a031c  
“(eval)”, line=1) at …/ruby-1.8/eval.c:6395  
#6 0x00231a5c in rb\_f\_eval (argc=2824376, argv=0x25d28, self=2822604)  
at …/ruby-1.8/eval.c:6507  
#7 0x00224e00 in rb\_call0 (klass=224400, recv=219620, id=3913,  
oid=3913, argc=1, argv=0xbfffe000, body=0x35264, flags=2) at  
…/ruby-1.8/eval.c:5771  
#8 0x00225838 in rb\_call (klass=224400, recv=219620, mid=3913, argc=1,  
argv=0xbfffe000, scope=1) at …/ruby-1.8/eval.c:6001  
#9 0x00222bbc in rb\_eval (self=0, n=0x25d28) at …/ruby-1.8/eval.c:3445  
#10 0x00232d50 in ruby\_exec\_internal () at …/ruby-1.8/eval.c:1590  
#11 0x00232d9c in ruby\_exec () at …/ruby-1.8/eval.c:1610  
#12 0x00232de4 in ruby\_run () at …/ruby-1.8/eval.c:1620  
#13 0x00002ce8 in main (argc=3, argv=0xbfffec24, envp=0x25a30) at  
…/ruby-1.8/main.c:46  
(gdb)
