From fa64103aa87a8f0f2a3351bb4a54e93e8ade1082 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 27 Dec 2010 14:34:17 +0200 Subject: better debug output in segfaults and stack overflows in windows --- src/client.cpp | 34 ++++++++++------------------- src/debug.cpp | 30 ++++++++++++++++++++++++++ src/debug.h | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main.cpp | 45 +++++++++++++++----------------------- src/mapblock.cpp | 5 +++++ src/materials.h | 1 - src/server.cpp | 34 ++++++----------------------- src/servermain.cpp | 15 ++++--------- 8 files changed, 137 insertions(+), 90 deletions(-) (limited to 'src') diff --git a/src/client.cpp b/src/client.cpp index af2b375f4..4792490f9 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 ae2deac88..422149753 100644 --- a/src/materials.h +++ b/src/materials.h @@ -54,7 +54,6 @@ class MaterialProperties public: MaterialProperties() { - dstream<<__FUNCTION_NAME<