From: Paul RASCLE Date: Thu, 8 Feb 2018 07:02:42 +0000 (+0100) Subject: backtrace on SalomeException and SALOME_SalomeException (unexpected exceptions) X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5a0877ae54070d2237fe373fa9ca8787fab907e5;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); }