From: Paul RASCLE Date: Thu, 8 Feb 2018 07:02:42 +0000 (+0100) Subject: backtrace on SalomeException and SALOME_SalomeException (unexpected exceptions) X-Git-Tag: V8_5_0a2~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e0d1f0a8f914e6b1a91cb4926ebb3886cec76da0;p=modules%2Fkernel.git backtrace on SalomeException and SALOME_SalomeException (unexpected exceptions) --- diff --git a/src/Utils/Utils_ExceptHandlers.cxx b/src/Utils/Utils_ExceptHandlers.cxx index e77e7d898..e8778229b 100644 --- a/src/Utils/Utils_ExceptHandlers.cxx +++ b/src/Utils/Utils_ExceptHandlers.cxx @@ -29,15 +29,70 @@ #include "Utils_CorbaException.hxx" #include "Utils_SALOME_Exception.hxx" +#include +#include +#include +#include + #include #include CORBA_SERVER_HEADER(SALOME_Exception) +//#define NBLINES_BACKTRACE 64 + void SalomeException () { - throw SALOME_Exception("Salome Exception"); + void *stacklines[64]; + char **stackSymbols; + size_t nbLines; + nbLines = backtrace(stacklines, 64); + stackSymbols = backtrace_symbols(stacklines, nbLines); + std::stringstream txt; + txt << "Salome Exception" << std::endl; + for (int i=0; i 0) + txt << infodl.dli_sname; + } + } + txt << " " << infodl.dli_saddr; + + txt << std::endl; + free(demangled); + } + else + txt << i << " " << stackSymbols[i] << std::endl; + } + THROW_SALOME_CORBA_EXCEPTION(txt.str().c_str(), SALOME::INTERNAL_ERROR); }