Re: Valgrind analysis of [BUG] unknown node type 0
From:
Andrew Walrond <andrew@...>
Date:
2004-09-17 11:55:28 UTC
List:
ruby-core #3425
On Friday 17 Sep 2004 12:37, ts wrote: > >>>>> "A" == Andrew Walrond <andrew@walrond.org> writes: > > A> I'll try following this back up the stack with gdb, to see where it > A> leads... > > Don't lost your time : valgrind is not the right tool for this. > Ok, but care to explain why? (that is, why valgrinds output should be discounted?) It drops me nicely into gdb when it spots the uninitialised memory access: $ valgrind --tool=memcheck --db-attach=yes ../ruby/ruby ./rubyx ==17297== Memcheck, a memory error detector for x86-linux. ==17297== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward et al. ==17297== Using valgrind-2.2.0, a program supervision framework for x86-linux. ==17297== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward et al. ==17297== For more details, rerun with: -v ==17297== ==17297== Conditional jump or move depends on uninitialised value(s) ==17297== at 0x806FF18: is_pointer_to_heap (gc.c:591) ==17297== by 0x806FEE1: mark_locations_array (gc.c:609) ==17297== by 0x80710F8: rb_gc (gc.c:1328) ==17297== by 0x806FBAC: rb_newobj (gc.c:376) ==17297== ==17297== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- y starting debugger ==17297== starting debugger with cmd: /bin/gdb -nw /proc/17305/fd/821 17305 GNU gdb 6.2 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 "i686-pc-linux-gnu"...Using host libthread_db library "/pkg/glibc.1/lib/libthread_db.so.1". Attaching to program: /proc/17305/fd/821, process 17305 Reading symbols from /pkg/valgrind.1/lib/valgrind/vg_inject.so...done. Loaded symbols for /pkg/valgrind.1/lib/valgrind/vg_inject.so Reading symbols from /pkg/valgrind.1/lib/valgrind/vgpreload_memcheck.so...done. Loaded symbols for /pkg/valgrind.1/lib/valgrind/vgpreload_memcheck.so Reading symbols from /pkg/glibc.1/lib/libdl.so.2...done. Loaded symbols for /pkg/glibc.1/lib/libdl.so.2 Reading symbols from /pkg/glibc.1/lib/libcrypt.so.1...done. Loaded symbols for /pkg/glibc.1/lib/libcrypt.so.1 Reading symbols from /pkg/glibc.1/lib/libm.so.6...done. Loaded symbols for /pkg/glibc.1/lib/libm.so.6 Reading symbols from /pkg/glibc.1/lib/libc.so.6...done. Loaded symbols for /pkg/glibc.1/lib/libc.so.6 Reading symbols from /lib/ld-linux.so.2...done. Loaded symbols for /lib/ld-linux.so.2 0x0806ff18 in is_pointer_to_heap (ptr=0x80773fd) at gc.c:591 591 if (p < lomem || p > himem) return Qfalse; (gdb) p lomem $1 = (RVALUE *) 0x1baa40a8 (gdb) p himem $2 = (RVALUE *) 0x1bad4de8 (gdb) p p $3 = (RVALUE *) 0x80773fd (gdb) bt #0 0x0806ff18 in is_pointer_to_heap (ptr=0x80773fd) at gc.c:591 #1 0x0806fee2 in mark_locations_array (x=0x52bfd0cc, n=31) at gc.c:609 #2 0x080710f9 in rb_gc () at gc.c:1328 #3 0x0806fbad in rb_newobj () at gc.c:376 #4 0x0805307f in new_dvar (id=11049, value=4, prev=0x1baa40a8) at eval.c:751 #5 0x080531cd in rb_dvar_push (id=11049, value=4) at eval.c:807 #6 0x08099d8e in assignable (id=11049, val=0x0) at parse.y:4834 #7 0x0808fc2c in ruby_yyparse () at parse.y:790 #8 0x08094c15 in yycompile (f=0x52bfdb4d "./rubyx", line=2) at parse.y:2555 #9 0x08094f29 in rb_compile_file (f=0x52bfdb4d "./rubyx", file=464274064, start=2) at parse.y:2647 #10 0x080b7135 in load_file (fname=0x52bfdb4d "./rubyx", script=1) at ruby.c:906 #11 0x080b6cf4 in proc_options (argc=0, argv=0x52bfd9cc) at ruby.c:782 #12 0x080b76c6 in ruby_process_options (argc=2, argv=0x52bfd9c4) at ruby.c:1119 #13 0x08053e18 in ruby_options (argc=2, argv=0x52bfd9c4) at eval.c:1372 #14 0x08052137 in main (argc=2, argv=0x52bfd9c4, envp=0x52bfd9d0) at main.c:49