Set_trace_func dumps core


#1

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

% cat test.rb
Kernel.module_eval {
define_method :foo, lambda {|&b|
b.call callcc {|_|
set_trace_func lambda {|*|}
break nil }}
define_method :bar, lambda {
foo {|c|
p c }}}

bar

% gdb --args ruby-trunk -v test.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-trunk -v test.rb
Reading symbols for shared libraries …+. done
ruby 1.9.0 (2006-05-01) [powerpc-darwin8.6.0]
nil
test.rb:3: malloc: possible integer overflow (ArgumentError)
from test.rb:3:in foo' from test.rb:7:inbar’
from test.rb:10
ruby-trunk(27129) malloc: *** Deallocation of a pointer not malloced:
0xbfffab20; This could be a double free(), or free() called with the
middle of an allocated block; Try setting environment variable
MallocHelp to see tools to help debug
ruby-trunk(27129) malloc: *** Deallocation of a pointer not malloced:
0x5223c4; This could be a double free(), or free() called with the
middle of an allocated block; Try setting environment variable
MallocHelp to see tools to help debug

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000023
blk_free (data=0x3) at …/ruby-trunk/eval.c:7930
7930 frame = frame->prev;
(gdb) bt
#0 blk_free (data=0x3) at …/ruby-trunk/eval.c:7930
#1 0x0023e998 in rb_gc_call_finalizer_at_exit () at
…/ruby-trunk/gc.c:1896
#2 0x0021c46c in ruby_finalize_1 () at …/ruby-trunk/eval.c:1481
#3 0x00224284 in ruby_cleanup (ex=6) at …/ruby-trunk/eval.c:1516
#4 0x00224318 in ruby_stop (ex=21) at …/ruby-trunk/eval.c:1558
#5 0x002368d4 in ruby_run () at …/ruby-trunk/eval.c:1570
#6 0x00002cd0 in main (argc=3, argv=0xbfffec18, envp=0x15) at
…/ruby-trunk/main.c:43
(gdb)