Well I'm not running Smaug for starts, but rather borrowed the implementation of some things from it (like your Lua setup).
I know how to use GDB, and am aware you can't be expected to debug anything without code or script -- I was hoping for a little more insight of what might be useful to see, but since that didn't happen, I'll just throw something out there and hope for the best :)
Test script being executed on a room, with luaL_dofile()
rsend("Obj 1")
rsend("Obj 2")
local room = mud.room_info()
rsend(room.name)
Output:
Quote: Obj 1
Obj 2
The Armory
Memory locations for pointers in my list of Lua elements. ptr->owner is a void* that is cast to the appropriate type based on ptr->type. Type 3 is the room, type 1 is myself.
Quote: [ DEBUG] ptr: 0x8b8adb0 ptr->type: 3 ptr->L: 0x8b8adc0 ptr->owner: 0x8b8acb0
[ DEBUG] ptr: 0x8b687b8 ptr->type: 1 ptr->L: 0x8bc32b8 ptr->owner: 0x8bc2d00
Now, I am using the wait.lua from the 1st page of this thread (the one Nick cleaned up some), with this test code:
wait.make( function ()
rsend("In wait")
wait.pause(3)
rsend("Three seconds!")
end
)
And here's the GDB when it explodes, with my type 3 (room) pointer somehow now pointing to myself.
Quote: 344 case LUA_TYPE_RM:
345 {
346 rm = static_cast<ROOM_INDEX_DATA *>(lua->owner);
347 if( rm->lua->L == L )
348 {
349 lua_pushstring(L,ROOM_STATE);
350 lua_gettable(L,LUA_ENVIRONINDEX);
351 lua_pop(L,1);
352 return rm;
(gdb) print rm
$1 = (ROOM_INDEX_DATA *) 0x8bc2d00
(gdb) print *(CHAR_DATA *)rm
<snip> name = 0xb778a3d4 "Kline"
Hopefully this is a good enough starting point? Full source for everything is available via public svn/WebSVN if anybody is truly interested in helping me work this since it's not a Smaug base, but is using most of the same Lua code. |