From: Perttu Ahola Date: Mon, 27 Dec 2010 12:34:17 +0000 (+0200) Subject: better debug output in segfaults and stack overflows in windows X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=fa64103aa87a8f0f2a3351bb4a54e93e8ade1082;p=zefram%2Fminetest%2Fminetest_engine.git better debug output in segfaults and stack overflows in windows --- diff --git a/minetest.vcproj b/minetest.vcproj index 45d6027d..c244b437 100644 --- a/minetest.vcproj +++ b/minetest.vcproj @@ -119,6 +119,7 @@ WholeProgramOptimization="true" AdditionalIncludeDirectories=""C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include";"..\jthread\jthread-1.2.1\src";"..\irrlicht\irrlicht-1.7.1\include";"..\zlib\zlib-1.2.5"" PreprocessorDefinitions="WIN32;_HAS_ITERATOR_DEBUGGING=0,UNITTEST_DISABLE,_CRT_SECURE_NO_DEPRECATE" + ExceptionHandling="2" BufferSecurityCheck="false" EnableEnhancedInstructionSet="1" FloatingPointModel="2" diff --git a/src/client.cpp b/src/client.cpp index af2b375f..4792490f 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -31,34 +31,22 @@ void * ClientUpdateThread::Thread() ThreadStarted(); DSTACK(__FUNCTION_NAME); - -#if CATCH_UNHANDLED_EXCEPTIONS - try + + BEGIN_DEBUG_EXCEPTION_HANDLER + + while(getRun()) { -#endif - while(getRun()) - { - m_client->asyncStep(); + m_client->asyncStep(); - //m_client->updateSomeExpiredMeshes(); + //m_client->updateSomeExpiredMeshes(); - bool was = m_client->AsyncProcessData(); + bool was = m_client->AsyncProcessData(); - if(was == false) - sleep_ms(10); - } -#if CATCH_UNHANDLED_EXCEPTIONS + if(was == false) + sleep_ms(10); } - /* - This is what has to be done in threads to get suitable debug info - */ - catch(std::exception &e) - { - dstream<ExceptionRecord; + dstream<<"Access violation at "<ExceptionAddress + <<" write?="<ExceptionInformation[0] + <<" address="<ExceptionInformation[1] + < + #include +#else +#endif /* Debug output @@ -215,6 +224,60 @@ private: core::map m_packets; }; +/* + These should be put into every thread +*/ + +#if CATCH_UNHANDLED_EXCEPTIONS == 1 + #define BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER try{ + #define END_PORTABLE_DEBUG_EXCEPTION_HANDLER\ + }catch(std::exception &e){\ + dstream<setMinHardwareBufferVertexCount(1); + //driver->setMinHardwareBufferVertexCount(50); scene::ISceneManager* smgr = device->getSceneManager(); @@ -2606,18 +2604,9 @@ int main(int argc, char *argv[]) menu->drop(); }*/ } -#if CATCH_UNHANDLED_EXCEPTIONS - /* - This is what has to be done in every thread to get suitable debug info - */ - catch(std::exception &e) - { - dstream<setHardwareMappingHint(scene::EHM_STATIC); /*std::cout<<"MapBlock has "<getSize()<<" faces " diff --git a/src/materials.h b/src/materials.h index ae2deac8..42214975 100644 --- a/src/materials.h +++ b/src/materials.h @@ -54,7 +54,6 @@ class MaterialProperties public: MaterialProperties() { - dstream<<__FUNCTION_NAME<