libretro / libretro-lutro

An experimental lua game framework for libretro following the LÖVE API
https://lutro.libretro.com
MIT License
156 stars 46 forks source link

Attempt to index a function value #217

Closed kivutar closed 3 years ago

kivutar commented 3 years ago

Launch love-vespa, press 2 directions at the same time.

The stack is corrupted.

kivutar@macbookpro ~/ludo kivutar/corenames % ./ludo -L cores/lutro_libretro.dylib ~/love-vespa
vorbis info:
    num streams: 1
    num channels: 2
    sample rate: 44100
vorbis init success
2021/07/17 09:33:14 [OpenAL]: Using 4 buffers of 8192 bytes.
2021/07/17 09:33:14 [Core]: Game loaded: /Users/kivutar/love-vespa
lua_panic!
attempt to index a function value
SIGABRT: abort
PC=0x7fff2054792e m=0 sigcode=0
signal arrived during cgo execution

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x43bf540, 0xc003547de0, 0x47452a0)
    /usr/local/Cellar/go/1.16.5/libexec/src/runtime/cgocall.go:154 +0x5b fp=0xc003547db0 sp=0xc003547d78 pc=0x40072fb
github.com/libretro/ludo/libretro._Cfunc_bridge_retro_run(0x413b27d0)
    _cgo_gotypes.go:578 +0x3c fp=0xc003547de0 sp=0xc003547db0 pc=0x42a3afc
github.com/libretro/ludo/libretro.(*Core).Run.func1(0xc0001ac270)
    /Users/kivutar/ludo/libretro/libretro.go:473 +0x56 fp=0xc003547e18 sp=0xc003547de0 pc=0x42a6c76
github.com/libretro/ludo/libretro.(*Core).Run(0xc0001ac270)
    /Users/kivutar/ludo/libretro/libretro.go:473 +0x2b fp=0xc003547e30 sp=0xc003547e18 pc=0x42a56cb
main.runLoop(0xc005e6c000, 0xc0024e4600)
    /Users/kivutar/ludo/main.go:45 +0x385 fp=0xc003547eb8 sp=0xc003547e30 pc=0x43a93e5
main.main()
    /Users/kivutar/ludo/main.go:137 +0x5a5 fp=0xc003547f88 sp=0xc003547eb8 pc=0x43a9a85
runtime.main()
    /usr/local/Cellar/go/1.16.5/libexec/src/runtime/proc.go:225 +0x256 fp=0xc003547fe0 sp=0xc003547f88 pc=0x403bf56
runtime.goexit()
    /usr/local/Cellar/go/1.16.5/libexec/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc003547fe8 sp=0xc003547fe0 pc=0x406f0c1

rax    0x0
rbx    0xe9b9e00
rcx    0x7ffeefbff2a8
rdx    0x0
rdi    0x103
rsi    0x6
rbp    0x7ffeefbff2d0
rsp    0x7ffeefbff2a8
r8     0x7fff8086e068
r9     0x0
r10    0xe9b9e00
r11    0x246
r12    0x103
r13    0x4e808a40
r14    0x6
r15    0x16
rip    0x7fff2054792e
rflags 0x246
cs     0x7
fs     0x0
gs     0x0
gouchi commented 3 years ago

Logs with RA

#0  0x00007ffff55b3d22 in raise () at /usr/lib/libc.so.6
#1  0x00007ffff559d862 in abort () at /usr/lib/libc.so.6
#2  0x00007fffe4bc4356 in lutro_lua_panic (L=0x5555565b9ca0) at lutro.c:169
#3  0x00007fffe4c30d60 in luaD_throw (L=L@entry=0x5555565b9ca0, errcode=errcode@entry=2) at ldo.c:104
#4  0x00007fffe4c30899 in luaG_errormsg (L=L@entry=0x5555565b9ca0) at ldebug.c:627
#5  0x00007fffe4c309a1 in luaG_runerror (L=L@entry=0x5555565b9ca0, fmt=fmt@entry=0x7fffe4efd58d "attempt to %s a %s value") at ldebug.c:636
#6  0x00007fffe4c30b07 in luaG_typeerror (L=L@entry=0x5555565b9ca0, o=o@entry=0x55555bcfe610, op=op@entry=0x7fffe4eff055 "index") at ldebug.c:577
#7  0x00007fffe4c3a5ea in luaV_gettable (L=L@entry=0x5555565b9ca0, t=t@entry=0x55555bcfe610, key=key@entry=0x7fffffffdd90, val=0x55555bcfe620) at lvm.c:123
#8  0x00007fffe4c2e44a in lua_getfield (L=0x5555565b9ca0, idx=<optimized out>, k=0x7fffe4c4b372 "gamepadpressed") at lapi.c:551
#9  0x00007fffe4bc577d in lutro_gamepadevent (L=0x5555565b9ca0) at lutro.c:580
#10 0x00007fffe4bc5b59 in lutro_run (delta=0.016729000000000001) at lutro.c:645
#11 0x00007fffe4bc3c2a in retro_run () at libretro.c:173
#12 0x000055555562d7dd in core_run () at retroarch.c:39812
#13 0x000055555562c402 in runloop_iterate () at retroarch.c:39160
#14 0x00005555555f7705 in rarch_main (argc=4, argv=0x7fffffffe128, data=0x0) at retroarch.c:15685
#15 0x00005555555f7767 in main (argc=4, argv=0x7fffffffe128) at retroarch.c:15762
info frame
Stack level 0, frame at 0x7fffffffda40:
 rip = 0x7ffff55b3d22 in raise; saved rip = 0x7ffff559d862
 called by frame at 0x7fffffffdb80
 Arglist at 0x7fffffffd918, args: 
 Locals at 0x7fffffffd918, Previous frame's sp is 0x7fffffffda40
 Saved registers:
  rip at 0x7fffffffda38
info reg
rax            0x0                 0
rbx            0x7fffe5742080      140737042980992
rcx            0x7ffff55b3d22      140737309785378
rdx            0x0                 0
rsi            0x7fffffffd920      140737488345376
rdi            0x2                 2
rbp            0x7ffff57398f0      0x7ffff57398f0 <lock>
rsp            0x7fffffffd920      0x7fffffffd920
r8             0x0                 0
r9             0x7fffffffd920      140737488345376
r10            0x8                 8
r11            0x246               582
r12            0x2                 2
r13            0x7fffe4eff03c      140737034317884
r14            0x0                 0
r15            0x55555bcfe610      93825100932624
rip            0x7ffff55b3d22      0x7ffff55b3d22 <raise+322>
eflags         0x246               [ PF ZF IF ]
cs             0x33                51
ss             0x2b                43
ds             0x0                 0
es             0x0                 0
fs             0x0                 0
gs             0x0                 0