scratch/cslatevm/kernel.new.little.64.1232382035091548.image 3120520
...
Slate 1> Image saveNamed: 'slate.image'.
Saving image to slate.image
GC Freed 85463 words and coalesced 152 times
GC tenured 351 objects (3817 words)
Nil
Slate 2>
cmalu% ./slate slate.image
Old Memory size: 419430400 bytes
New Memory size: 10485760 bytes
Image size: 13113808 bytes
zsh: segmentation fault ./slate slate.image
cmalu% gdb --args ./slate slate.image
GNU gdb 6.7.1-debian
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show
copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) run
Starting program: /home/jewel/scratch/cslatevm/slate slate.image
[Thread debugging using libthread_db enabled]
Old Memory size: 419430400 bytes
New Memory size: 10485760 bytes
Image size: 13113808 bytes
[New Thread 0x7f20c252f6e0 (LWP 12618)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f20c252f6e0 (LWP 12618)]
0x00007f20c19b4fb5 in memcpy () from /lib/libc.so.6
(gdb) bt
#0 0x00007f20c19b4fb5 in memcpy () from /lib/libc.so.6
#1 0x0000000000409e73 in write_args_into ()
#2 0x000000000040e433 in prim_run_args_into ()
#3 0x00000000004077b8 in send_to_through_arity_with_optionals ()
#4 0x00000000004083b9 in interpret ()
#5 0x00000000004123b0 in main ()
(gdb)
Linux cmalu 2.6.26-1-amd64 #1 SMP Sat Jan 10 17:57:00 UTC 2009 x86_64
GNU/Linux
cmalu% gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.1-2'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--enable-mpfr --enable-cld --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.1 (Debian 4.3.1-2)
John Leuner
It fails when copying the first string
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/jewel/scratch/cslatevm/slate slate.image
[Thread debugging using libthread_db enabled]
Old Memory size: 419430400 bytes
New Memory size: 10485760 bytes
Image size: 13113808 bytes
[New Thread 0x7f29db0f56e0 (LWP 15225)]
[Switching to Thread 0x7f29db0f56e0 (LWP 15225)]
Breakpoint 1, write_args_into (oh=0x7f29da0f9010, buffer=0x7f29c06f79f8
"", limit=1024) at misc.c:134
134 nRemaining = limit;
(gdb) n
135 totalLen = 0;
(gdb) n
136 for (i=0; i<oh->argcSaved; i++) {
(gdb) n
137 iLen = strlen (oh->argvSaved [i]) + 1;
(gdb) n
138 memcpy (buffer + totalLen, oh->argvSaved [i], max(iLen,
nRemaining));
(gdb) p iLen
$3 = 35
(gdb) p oh->argvSaved [i]
$4 = 0x7fffe3111d76 "/home/jewel/scratch/cslatevm/slate"
(gdb) x /100 buffer
0x7f29c06f79f8: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7a08: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7a18: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7a28: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7a38: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7a48: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7a58: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7a68: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7a78: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7a88: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7a98: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7aa8: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7ab8: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7ac8: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7ad8: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7ae8: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7af8: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7b08: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7b18: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7b28: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7b38: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7b48: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7b58: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7b68: 0x00000000 0x00000000 0x00000000
0x00000000
0x7f29c06f7b78: 0x00000000 0x00000000 0x00000000
0x00000000
(gdb) n
Program received signal SIGSEGV, Segmentation fault.
0x00007f29da57afb5 in memcpy () from /lib/libc.so.6
(gdb) bt
#0 0x00007f29da57afb5 in memcpy () from /lib/libc.so.6
#1 0x000000000040ce3a in write_args_into (oh=0x7f29da0f9010,
buffer=0x7f29c06f79f8 "/home/jewel/scratch/cslatevm/slate", limit=1024)
at misc.c:138
#2 0x0000000000413812 in prim_run_args_into (oh=0x7f29da0f9010,
args=0x7fffe31108a0, n=2, opts=0x0, resultStackPointer=22709) at
primitives.c:947
#3 0x00000000004089b5 in send_to_through_arity_with_optionals
(oh=0x7f29da0f9010, selector=0x7f29c13db5b8, args=0x7fffe31108a0,
dispatchers=0x7fffe31108a0, arity=2,
opts=0x0, resultStackPointer=22709) at interpreter.c:353
#4 0x0000000000409a1f in interpret (oh=0x7f29da0f9010) at
interpreter.c:708
#5 0x00000000004179b1 in main (argc=2, argv=0x7fffe3110c68) at vm.c:131
Is that resultStackPointer correct?
I also ran valgrind:
valgrind --tool=memcheck ./slate slate.image
==15150== Memcheck, a memory error detector.
==15150== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et
al.
==15150== Using LibVEX rev 1854, a library for dynamic binary
translation.
==15150== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==15150== Using valgrind-3.3.1-Debian, a dynamic binary instrumentation
framework.
==15150== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et
al.
==15150== For more details, rerun with: -v
==15150==
==15150== Warning: set address range perms: large range 419430400
(undefined)
Old Memory size: 419430400 bytes
New Memory size: 10485760 bytes
Image size: 13113808 bytes
==15150== Invalid read of size 1
==15150== at 0x4C232B9: memcpy (mc_replace_strmem.c:402)
==15150== by 0x40CE39: write_args_into (misc.c:138)
==15150== by 0x413811: prim_run_args_into (primitives.c:947)
==15150== by 0x4089B4: send_to_through_arity_with_optionals
(interpreter.c:353)
==15150== by 0x409A1E: interpret (interpreter.c:708)
==15150== by 0x4179B0: main (vm.c:131)
==15150== Address 0x7ff001000 is not stack'd, malloc'd or (recently)
free'd
==15150==
==15150== Process terminating with default action of signal 11 (SIGSEGV)
==15150== Access not within mapped region at address 0x7FF001000
==15150== at 0x4C232B9: memcpy (mc_replace_strmem.c:402)
==15150== by 0x40CE39: write_args_into (misc.c:138)
==15150== by 0x413811: prim_run_args_into (primitives.c:947)
==15150== by 0x4089B4: send_to_through_arity_with_optionals
(interpreter.c:353)
==15150== by 0x409A1E: interpret (interpreter.c:708)
==15150== by 0x4179B0: main (vm.c:131)
==15150==
==15150== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 8 from 1)
==15150== malloc/free: in use at exit: 470,414,696 bytes in 10 blocks.
==15150== malloc/free: 10 allocs, 0 frees, 470,414,696 bytes allocated.
==15150== For counts of detected errors, rerun with: -v
==15150== searching for pointers to 10 not-freed blocks.
==15150== checked 20,177,856 bytes.
==15150==
==15150== LEAK SUMMARY:
==15150== definitely lost: 0 bytes in 0 blocks.
==15150== possibly lost: 0 bytes in 0 blocks.
==15150== still reachable: 470,414,696 bytes in 10 blocks.
==15150== suppressed: 0 bytes in 0 blocks.
==15150== Rerun with --leak-check=full to see details of leaked memory.
zsh: segmentation fault valgrind --tool=memcheck ./slate slate.image
John