lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hi, I just tried compiling LuaJIT2, turning on debugging symbols as
well as asserts and valgrind support in the Makefile. I haven't
managed to get it to work reliably yet, and I feel like I must be
doing something wrong to hit problems so quickly in a program that
many people are using without problem.

The quick summary is that it seems to work when run in valgrind, but
not outside. I am using Ubuntu 10.04 on an x84_64 intel processor, and
get the same results with beta5, which is the only other version I
have installed. Here are the full results:

henk@invincible-spell:~$ cat badfib.lua
function badfib(n)
  return n < 2 and n or badfib(n-1) + badfib(n-2)


henk@invincible-spell:~$ luajit-2.0.0-beta6 badfib.lua 15

henk@invincible-spell:~$ luajit-2.0.0-beta6 badfib.lua 16
Segmentation fault

henk@invincible-spell:~$ lua badfib.lua 16

henk@invincible-spell:~$ gdb luajit-2.0.0-beta6
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
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".
For bug reporting instructions, please see:
Reading symbols from /usr/local/bin/luajit-2.0.0-beta6...done.
(gdb) run badfib.lua 16
Starting program: /usr/local/bin/luajit-2.0.0-beta6 badfib.lua 16

Program received signal SIGSEGV, Segmentation fault.
0x00000000394cffed in ?? ()
(gdb) bt
#0  0x00000000394cffed in ?? ()
#1  0x0000000040000f18 in ?? ()
#2  0x000000000041f9e0 in lj_vm_hotcall ()
#3  0x000000000040c2aa in lua_pcall (L=0x40000378,
    nargs=<value optimized out>, nresults=-1, errfunc=<value optimized out>)
    at lj_api.c:1027
#4  0x0000000000403ec6 in docall (L=0x40000378, narg=1, clear=0)
    at luajit.c:120
#5  0x0000000000404eb4 in handle_script (L=0x40000378) at luajit.c:284
#6  pmain (L=0x40000378) at luajit.c:488
#7  0x000000000041dfa9 in lj_BC_FUNCC ()
#8  0x000000000040b6d2 in lua_cpcall (L=0xfffffffb40007c38, func=0x400082e0,
    ud=0x400082c0) at lj_api.c:1049
#9  0x0000000000403dff in main (argc=3, argv=0x7fffffffe2c8) at luajit.c:516

henk@invincible-spell:~$ valgrind luajit-2.0.0-beta6 badfib.lua 16
==9115== Memcheck, a memory error detector
==9115== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==9115== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for
copyright info
==9115== Command: luajit-2.0.0-beta6 badfib.lua 16
==9115== HEAP SUMMARY:
==9115==     in use at exit: 0 bytes in 0 blocks
==9115==   total heap usage: 1 allocs, 1 frees, 568 bytes allocated
==9115== All heap blocks were freed -- no leaks are possible
==9115== For counts of detected and suppressed errors, rerun with: -v
==9115== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)


Please let me know if there is more useful information I can provide.