|
Hi all, I'm having difficulty getting examples using LUA_ENVIRONINDEX to work. I've been trying to use code posted previously on this list, as well as from the article in Game Programming Gems 6. In all cases, I get a SIGBUS error at the call lua_replace(L, LUA_ENVIRONINDEX). Has anyone else had this issue? Is there something else I can look at to diagnose the problem? Here's a minimal example (main.cpp): extern "C" { #include <lua.h> #include <lualib.h> #include <lauxlib.h> } int main(int argc, char* argv[]) { lua_State * L = lua_open(); luaL_openlibs(L); lua_settop(L, 0); luaL_dostring(L, "print(_VERSION)"); // Lua 5.1 lua_newtable(L); lua_replace(L, LUA_ENVIRONINDEX); // "has exited due to signal 10 (SIGBUS)." lua_close(L); return 0; } FWIW OS 10.4.7, Xcode 2.4, MacBookPro (Intel). Xcode isn't able to debug this very well. It appears to crash at an index2adr call is the culprit. Here's what I get: tty /dev/ttyp2 Program loaded. sharedlibrary apply-load-rules all run [Switching to process 942 local thread 0xf03] Running… Lua version 501Program received signal: "EXC_BAD_ACCESS". asm index2addr 000023a3a:1: 0x00023a3a <+0138> mov 12(%eax),%eax 0x00023a3d <+0141> mov %eax,80(%ecx) 0x00023a40 <+0144> movl $0x5,8(%edx) 0x00023a47 <+0151> mov %edx,%eax 0x00023a49 <+0153> pop %ebx 0x00023a4a <+0154> pop %esi 0x00023a4b <+0155> pop %ebp 0x00023a4c <+0156> ret 0x00023a4d <+0157> mov 16(%eax),%eax 0x00023a50 <+0160> add $0x5c,%eax 0x00023a53 <+0163> pop %ebx 0x00023a54 <+0164> pop %esi 0x00023a55 <+0165> pop %ebp 0x00023a56 <+0166> ret On Aug 29, 2006, at 9:51 AM, David Jones wrote:
|