# Set\_trace\_func dumps core

**URL:** <https://www.ruby-forum.com/t/set-trace-func-dumps-core/59385>\
**Category:** Development\
**Created:** [May 3, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/set-trace-func-dumps-core/59385 "2006-05-03T18:59:38Z")\
**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 3, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/set-trace-func-dumps-core/59385/1 "2006-05-03T18:59:38Z")

</div>

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:in`bar’  
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)
