Valgrind set_trace_func

e$B0J2<$N$h$&$K$9$k$He(B Invalid read of size 4 e$B$H$J$j$^$9!#e(B

% valgrind ./ruby -ve ‘set_trace_func(proc {})’
==13641== Memcheck, a memory error detector.
==13641== Copyright © 2002-2006, and GNU GPL’d, by Julian Seward et
al.
==13641== Using LibVEX rev 1658, a library for dynamic binary
translation.
==13641== Copyright © 2004-2006, and GNU GPL’d, by OpenWorks LLP.
==13641== Using valgrind-3.2.1-Debian, a dynamic binary instrumentation
framework.
==13641== Copyright © 2000-2006, and GNU GPL’d, by Julian Seward et
al.
==13641== For more details, rerun with: -v
==13641==
–13641-- DWARF2 CFI reader: unhandled CFI instruction 0:50
–13641-- DWARF2 CFI reader: unhandled CFI instruction 0:50
–13641-- DWARF2 CFI reader: unhandled CFI instruction 0:50
–13641-- DWARF2 CFI reader: unhandled CFI instruction 0:50
ruby 1.9.0 (2007-09-22 patchlevel 0) [i686-linux]
==13641== Invalid read of size 4
==13641== at 0x80FB8B9: remove_event_hook (thread.c:2709)
==13641== by 0x80FB92E: rb_remove_event_hook (thread.c:2727)
==13641== by 0x80FB9B0: rb_clear_trace_func (thread.c:2749)
==13641== by 0x805A1AB: ruby_finalize_1 (eval.c:146)
==13641== by 0x805A297: ruby_cleanup (eval.c:181)
==13641== by 0x805A507: ruby_run_node (eval.c:256)
==13641== by 0x80576C4: main (main.c:46)
==13641== Address 0x42FDEDC is 12 bytes inside a block of size 16
free’d
==13641== at 0x401CFA5: free (vg_replace_malloc.c:233)
==13641== by 0x8060FCF: ruby_xfree (gc.c:328)
==13641== by 0x80FB8AF: remove_event_hook (thread.c:2706)
==13641== by 0x80FB92E: rb_remove_event_hook (thread.c:2727)
==13641== by 0x80FB9B0: rb_clear_trace_func (thread.c:2749)
==13641== by 0x805A1AB: ruby_finalize_1 (eval.c:146)
==13641== by 0x805A297: ruby_cleanup (eval.c:181)
==13641== by 0x805A507: ruby_run_node (eval.c:256)
==13641== by 0x80576C4: main (main.c:46)
==13641==
==13641== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 19 from
1)
==13641== malloc/free: in use at exit: 914,049 bytes in 6,533 blocks.
==13641== malloc/free: 6,939 allocs, 406 frees, 937,224 bytes allocated.
==13641== For counts of detected errors, rerun with: -v
==13641== searching for pointers to 6,533 not-freed blocks.
==13641== checked 697,756 bytes.
==13641==
==13641== LEAK SUMMARY:
==13641== definitely lost: 0 bytes in 0 blocks.
==13641== possibly lost: 68 bytes in 1 blocks.
==13641== still reachable: 913,981 bytes in 6,532 blocks.
==13641== suppressed: 0 bytes in 0 blocks.
==13641== Reachable blocks (those to which a pointer was found) are not
shown.
==13641== To see them, rerun with: --show-reachable=yes

In article [email protected],
Tanaka A. [email protected] writes:

e$B0J2<$N$h$&$K$9$k$He(B Invalid read of size 4 e$B$H$J$j$^$9!#e(B

% valgrind ./ruby -ve ‘set_trace_func(proc {})’

==13641== at 0x80FB8B9: remove_event_hook (thread.c:2709)

1.8 e$B$Ne(B rb_remove_event_hook e$B$H8+Hf$Y$k$H!“e(Breturn
e$B$,$R$H$D>Ce(B
e$B$($F$$$k$h$&$J$N$G$9$,!”$J$s$G$G$7$g$&e(B?

In article [email protected],
Tanaka A. [email protected] writes:

1.8 e$B$Ne(B rb_remove_event_hook e$B$H8+Hf$Y$k$H!“e(Breturn e$B$,$R$H$D>Ce(B
e$B$($F$$$k$h$&$J$N$G$9$,!”$J$s$G$G$7$g$&e(B?

e$B0UL#$,$o$+$C$F$^$;$s$,!“8+Hf$Y$k$@$1$G$I$&$K$+$9$k$J$i!”$3$&e(B
e$B$$$&$3$H$J$s$G$7$g$&$+e(B?

Index: thread.c

— thread.c (e$B%j%S%8%g%se(B 13542)
+++ thread.c (e$B:n6H%3%T!<e(B)
@@ -2704,6 +2704,7 @@
*root = hook->next;
}
xfree(hook);

  •        return 0;
    
    }
    prev = hook;
    hook = hook->next;