Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
No need for the OSSP copyright header on the backtrace thing, only for the exceptions
[simgrid.git] / src / xbt / backtrace.cpp
1 /* Copyright (c) 2005-2016. The SimGrid Team. All rights reserved.          */
2
3 #include <cstddef>
4
5 #include <xbt/log.h>
6 #include <xbt/backtrace.h>
7
8 #include "src/internal_config.h"
9
10 extern "C" {
11
12 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_backtrace, xbt, "Backtrace");
13
14 }
15
16 /** @brief show the backtrace of the current point (lovely while debuging) */
17 void xbt_backtrace_display_current(void)
18 {
19   const std::size_t size = 10;
20   xbt_backtrace_location_t bt[size];
21   size_t used = xbt_backtrace_current(bt, size);
22   xbt_backtrace_display(bt, used);
23 }
24
25 #if HAVE_BACKTRACE && HAVE_EXECINFO_H && HAVE_POPEN && defined(ADDR2LINE)
26 # include "src/xbt/backtrace_linux.cpp"
27 #else
28 # include "src/xbt/backtrace_dummy.cpp"
29 #endif