Hey, I'm trying to track down the reason I'm getting a segfault, but I'm a little perplexed because my own C code is rather trivial (i.e load a module, call a neko function in a loop). Here's the backtrace in case somebody more experienced than myself might be able to glean something from it. In this case, neko was built with -g and no optimizations and is running on amd64. At a glance, looks like alloc is returning null...
--- Program terminated with signal 11, Segmentation fault. [New process 17289] #0 0x00007f77df1bce8b in memcpy () from /lib/libc.so.6 (gdb) bt #0 0x00007f77df1bce8b in memcpy () from /lib/libc.so.6 #1 0x00007f77df8cfe00 in neko_stack_expand (sp=0x7f77dfad6928, csp=0x7f77dfad6930, vm=0xe6de00) at vm/others.c:344 #2 0x00007f77df8c40e6 in neko_interp_loop (vm=0xe6de00, m=0xe81de0, _acc=140152830519600, _pc=0x1015000) at vm/interp.c:773 #3 0x00007f77df8cd5cb in neko_interp (vm=0xe6de00, _m=0xe81de0, acc=140152830519600, pc=0x1015000) at vm/interp.c:1125 #4 0x00007f77df8c10e3 in neko_vm_execute (vm=0xe6de00, _m=0xe81de0) at vm/interp.c:231 #5 0x00007f77df8ce50b in loader_loadmodule (mname=0xe8cf00, vthis=0xe67fc0) at vm/load.c:399 #6 0x00007f77df8c6d4f in neko_interp_loop (vm=0xe6de00, m=0xe81f00, _acc=140152830519600, _pc=0xf0ecb8) at vm/interp.c:834 #7 0x00007f77df8cd5cb in neko_interp (vm=0xe6de00, _m=0xe81f00, acc=140152830519600, pc=0xf0ecb8) at vm/interp.c:1125 #8 0x00007f77df8c079b in neko_val_callEx (vthis=0x0, f=0xe9fb80, args=0x1010738, nargs=1, exc=0x0) at vm/callback.c:112 #9 0x00007f77df8c08bd in neko_val_callN (f=0xe9fb80, args=0x1010738, nargs=1) at vm/callback.c:133 #10 0x00007f77df8bd392 in builtin_call (f=0xe9fb80, ctx=0x1012b70, args=0x1010730) at vm/builtins.c:479 #11 0x00007f77df8c5cea in neko_interp_loop (vm=0xe6de00, m=0xe81f00, _acc=140152830519600, _pc=0xf1d990) at vm/interp.c:827 #12 0x00007f77df8cd5cb in neko_interp (vm=0xe6de00, _m=0xe81f00, acc=140152830519600, pc=0xf1d990) at vm/interp.c:1125 #13 0x00007f77df8c079b in neko_val_callEx (vthis=0xf53a38, f=0xea3ce0, args=0x7fffe8559a38, nargs=1, exc=0x0) at vm/callback.c:112 #14 0x00000000004024d3 in CallHaxeMethod1 (obj=0xf53a38, method=<value optimized out>, a=0x101d4f8) at nekohaxe.c:90 #15 0x0000000000401b75 in ServerLoop (sockfd=<value optimized out>) at nekoapp.c:208 #16 0x0000000000401fc6 in main (argc=<value optimized out>, argv=<value optimized out>) at nekoapp.c:180 (gdb) frame 1 #1 0x00007f77df8cfe00 in neko_stack_expand (sp=0x7f77dfad6928, csp=0x7f77dfad6930, vm=0xe6de00) at vm/others.c:344 344 memcpy(nsp,vm->spmin,sizeof(int_val) * i); (gdb) print i $1 = -69896281 (gdb) x vm 0xe6de00: 0x00f53d38 (gdb) x nsp 0x0: Cannot access memory at address 0x0 --- Thanks, Chaz -- Neko : One VM to run them all (http://nekovm.org)
