ALPSCore reference
stacktrace.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1998-2018 ALPS Collaboration. See COPYRIGHT.TXT
3  * All rights reserved. Use is subject to license terms. See LICENSE.TXT
4  * For use in publications, see ACKNOWLEDGE.TXT
5  */
6 
7 #ifndef ALPS_STACKTRACE_HPP
8 #define ALPS_STACKTRACE_HPP
9 
10 #include <alps/config.hpp>
12 
13 #include <string>
14 
15 // maximal number of stack frames displayed in stacktrace. Default 63
16 #ifndef ALPS_MAX_FRAMES
17  #define ALPS_MAX_FRAMES 63
18 #endif
19 
20 // prevent the signal object from registering signals
21 #ifdef BOOST_MSVC
22  #define ALPS_NO_SIGNALS
23 #endif
24 
25 // do not print a stacktrace in error messages
26 #ifndef __GNUC__
27  #define ALPS_NO_STACKTRACE
28 #endif
29 
30 // TODO: have_mpi
31 // TODO: have_thread
32 
33 
34 
35 // TODO: check for gcc and use __PRETTY_FUNCTION__
36 
37 #define ALPS_STACKTRACE ( \
38  std::string("\nIn ") + __FILE__ \
39  + " on " + ALPS_STRINGIFY(__LINE__) \
40  + " in " + __FUNCTION__ + "\n" \
41  + ::alps::stacktrace() \
42 )
43 
44 namespace alps {
45 
46  std::string stacktrace();
47 
48 }
49 
50 #endif
std::string stacktrace()
Definition: stacktrace.cpp:25