Now, this isn't strictly game programming related, but I find we tend to have a lot of specific-error-knowledge tucked away in our heads at times, and I'm wondering if anyone has seen something like this, and can point me at my error.
I've been building a build system that's mostly Lua, with some specific C++ code written in to do the menial stuff. It works fine under gcc in Linux, but on Windows, with gcc (MinGW) or using Visual Studio 2005, I get a crash that I can't piece together.
Basically, whenever I get to a certain point in my application's run, I get an Access Violation inside ntdll, that appears to be from a mutex lock.
I'm not sure what this 'means', exactly, in terms of what I'm doing wrong. The string it's destructing seems alright; there are no other threads running at this current time, so I'm not really sure what's going on?
Here's my code that ends up calling other functions that end up generating the access violation:
static int LUA_ProcessExecute(lua_State* pLuaState)
{
char const * pCommand = luaL_checkstring(pLuaState, 1);
int returnValue= Process::Execute(pCommand); // Access violation comes from pCommand being converted to std::string, and then destructing the temporary
lua_pushnumber(pLuaState, returnValue);
return 1;
}
And here's the call stack.
ntdll.dll!_RtlpWaitForCriticalSection@4() + 0x5b bytes ntdll.dll!_RtlEnterCriticalSection@4() + 0x46 bytes mke.exe!_lock(int locknum=4) Line 349 C > mke.exe!operator delete(void * pUserData=0x012541c0) Line 45 + 0x7 bytes C++ mke.exe!std::allocator<char>::deallocate(char * _Ptr=0x012541c0, unsigned int __formal=2560) Line 141 + 0x9 bytes C++ mke.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy(bool _Built=true, unsigned int _Newsize=0) Line 2076 C++ mke.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string<char,std::char_traits<char>,std::allocator<char> >() Line 906 C++ mke.exe!LUA_ProcessExecute(lua_State * pLuaState=0x00b75408) Line 13 C++ mke.exe!luaD_precall(lua_State * L=0x00b75408, lua_TValue * func=0x00d664a8, int nresults=1) Line 319 + 0x16 bytes C mke.exe!luaV_execute(lua_State * L=0x00b75408, int nexeccalls=8) Line 587 + 0x14 bytes C mke.exe!luaD_call(lua_State * L=0x00b75408, lua_TValue * func=0x00b757b0, int nResults=-1) Line 377 + 0xb bytes C mke.exe!lua_call(lua_State * L=0x00b75408, int nargs=0, int nresults=-1) Line 783 + 0x11 bytes C mke.exe!luaB_dofile(lua_State * L=0x00b75408) Line 329 + 0xd bytes C mke.exe!luaD_precall(lua_State * L=0x00b75408, lua_TValue * func=0x00b75790, int nresults=0) Line 319 + 0x16 bytes C mke.exe!luaV_execute(lua_State * L=0x00b75408, int nexeccalls=1) Line 587 + 0x14 bytes C mke.exe!luaD_call(lua_State * L=0x00b75408, lua_TValue * func=0x00b75780, int nResults=1) Line 377 + 0xb bytes C mke.exe!f_call(lua_State * L=0x00b75408, void * ud=0x0013fbac) Line 801 + 0x16 bytes C mke.exe!luaD_rawrunprotected(lua_State * L=0x00b75408, void (lua_State *, void *)* f=0x00418da0, void * ud=0x0013fbac) Line 118 + 0x1f bytes C mke.exe!luaD_pcall(lua_State * L=0x00b75408, void (lua_State *, void *)* func=0x00418da0, void * u=0x0013fbac, int old_top=224, int ef=208) Line 463 + 0x11 bytes C mke.exe!lua_pcall(lua_State * L=0x00b75408, int nargs=0, int nresults=1, int errfunc=13) Line 822 + 0x20 bytes C mke.exe!main(int argc=1, char * * argv=0x00b73730) Line 313 + 0x17 bytes C++ mke.exe!__tmainCRTStartup() Line 327 + 0x19 bytes C mke.exe!mainCRTStartup() Line 196 C kernel32.dll!_BaseProcessStart@4() + 0x23 bytes
I don't want to overwhelm with information, but if someone smells something familiar and needs more information to test a theory, by all means, ask. I'd love to find a better starting point than re-reading every API function's documentation.
Thanks!












