[Rivet-svn] rivet: Print some backtrace info if available

Rivet Mercurial rivet at projects.hepforge.org
Tue Oct 10 13:45:02 BST 2017


details:   https://rivet.hepforge.org/hg/rivet/rev/ee9af481d86e
branches:  multiweight
changeset: 6088:ee9af481d86e
user:      David Grellscheid <david.grellscheid at durham.ac.uk>
date:      Tue Oct 10 13:28:13 2017 +0100
description:
Print some backtrace info if available

diffs (29 lines):

--- a/src/Tools/RivetYODA.cc	Tue Oct 10 11:17:31 2017 +0100
+++ b/src/Tools/RivetYODA.cc	Tue Oct 10 13:28:13 2017 +0100
@@ -4,10 +4,10 @@
 #include "YODA/ReaderYODA.h"
 #include "YODA/ReaderAIDA.h"
 
-// #include "DummyConfig.hh"
-// #ifdef HAVE_EXECINFO_H
-// #include <execinfo.h>
-// #endif
+#include "DummyConfig.hh"
+#ifdef HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
 
 using namespace std;
 
@@ -45,6 +45,11 @@
 template <class T>
 typename T::Ptr Wrapper<T>::active() const {
     if ( !_active ) {
+#ifdef HAVE_BACKTRACE
+      void * buffer[4];
+      backtrace(buffer, 4);
+      backtrace_symbols_fd(buffer, 4 , 1);
+#endif
       assert(false && "No active pointer set. Was this object booked in init()?");
     }
     return _active;


More information about the Rivet-svn mailing list