Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix HAVE_FOOBAR flags handling
[simgrid.git] / include / xbt / ex.h
1 /* ex - Exception Handling                                                  */
2
3 /* Copyright (c) 2005-2015. The SimGrid Team.
4  * All rights reserved.                                                     */
5
6 /*  Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com>       */
7 /*  Copyright (c) 2002-2004 The OSSP Project <http://www.ossp.org/>         */
8 /*  Copyright (c) 2002-2004 Cable & Wireless <http://www.cw.com/>           */
9 /*  All rights reserved.                                                    */
10
11 /* This code is inspirated from the OSSP version (as retrieved back in 2004)*/
12 /* It was heavily modified to fit the SimGrid framework.                    */
13
14 /* The OSSP version has the following copyright notice:
15 **  OSSP ex - Exception Handling
16 **  Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com>
17 **  Copyright (c) 2002-2004 The OSSP Project <http://www.ossp.org/>
18 **  Copyright (c) 2002-2004 Cable & Wireless <http://www.cw.com/>
19 **
20 **  This file is part of OSSP ex, an exception handling library
21 **  which can be found at http://www.ossp.org/pkg/lib/ex/.
22 **
23 **  Permission to use, copy, modify, and distribute this software for
24 **  any purpose with or without fee is hereby granted, provided that
25 **  the above copyright notice and this permission notice appear in all
26 **  copies.
27 **
28 **  THIS SOFTWARE IS PROVIDED `AS IS'' AND ANY EXPRESSED OR IMPLIED
29 **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
31 **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
32 **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
35 **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
36 **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37 **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
38 **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 **  SUCH DAMAGE.
40  */
41
42 /* The extensions made for the SimGrid project can either be distributed    */
43 /* under the same license, or under the LGPL v2.1                           */
44
45 #ifndef __XBT_EX_H__
46 #define __XBT_EX_H__
47
48 #include "xbt/sysdep.h"
49 #include "xbt/misc.h"
50 #include "xbt/virtu.h"
51
52 SG_BEGIN_DECL()
53
54 /*-*-* Emergency debuging: define this when the exceptions get crazy *-*-*/
55 #undef __EX_MAYDAY
56 #ifdef __EX_MAYDAY
57 # include <stdio.h>
58 #include <errno.h>
59 #  define MAYDAY_SAVE(m)    printf("%d %s:%d save %p\n",                \
60                                    xbt_getpid(), __FILE__, __LINE__,    \
61                                    (m)->jb                              \
62                                   ),
63 #  define MAYDAY_RESTORE(m) printf("%d %s:%d restore %p\n",             \
64                                    xbt_getpid(), __FILE__, __LINE__,    \
65                                    (m)->jb                              \
66                                   ),
67 #  define MAYDAY_CATCH(e)   printf("%d %s:%d Catched '%s'\n",           \
68                                    xbt_getpid(), __FILE__, __LINE__,    \
69                                    (e).msg                              \
70           ),
71 #else
72 #  define MAYDAY_SAVE(m)
73 #  define MAYDAY_RESTORE(m)
74 #  define MAYDAY_CATCH(e)
75 #endif
76 /*-*-* end of debugging stuff *-*-*/
77 #if defined(__EX_MCTX_MCSC__)
78 #include <ucontext.h>           /* POSIX.1 ucontext(3) */
79 #define __ex_mctx_struct         ucontext_t uc;
80 #define __ex_mctx_save(mctx)     (getcontext(&(mctx)->uc) == 0)
81 #define __ex_mctx_restored(mctx)        /* noop */
82 #define __ex_mctx_restore(mctx)  (void)setcontext(&(mctx)->uc)
83 #elif defined(__EX_MCTX_SSJLJ__)
84 #include <setjmp.h>             /* POSIX.1 sigjmp_buf(3) */
85 #define __ex_mctx_struct         sigjmp_buf jb;
86 #define __ex_mctx_save(mctx)     (sigsetjmp((mctx)->jb, 1) == 0)
87 #define __ex_mctx_restored(mctx)        /* noop */
88 #define __ex_mctx_restore(mctx)  (void)siglongjmp((mctx)->jb, 1)
89 #elif defined(__EX_MCTX_SJLJ__) || !defined(__EX_MCTX_CUSTOM__) || defined(__EX_MAYDAY)
90 #include <setjmp.h>             /* ISO-C jmp_buf(3) */
91 #define __ex_mctx_struct         jmp_buf jb;
92 #define __ex_mctx_save(mctx)     ( MAYDAY_SAVE(mctx) setjmp((mctx)->jb) == 0)
93 #define __ex_mctx_restored(mctx)        /* noop */
94 #define __ex_mctx_restore(mctx)  ( MAYDAY_RESTORE(mctx) (void)longjmp((mctx)->jb, 1))
95 #endif
96 /* declare the machine context type */
97 typedef struct {
98 __ex_mctx_struct} __ex_mctx_t;
99
100 /** @addtogroup XBT_ex
101  *  @brief A set of macros providing exception a la C++ in ANSI C (grounding feature)
102  *
103  * This module is a small ISO-C++ style exception handling library
104  * for use in the ISO-C language. It allows you to use the paradigm 
105  * of throwing and catching exceptions in order to reduce the amount
106  * of error handling code without hindering program robustness.
107  *               
108  * This is achieved by directly transferring exceptional return codes
109  * (and the program control flow) from the location where the exception
110  * is raised (throw point) to the location where it is handled (catch
111  * point) -- usually from a deeply nested sub-routine to a parent 
112  * routine. All intermediate routines no longer have to make sure that 
113  * the exceptional return codes from sub-routines are correctly passed 
114  * back to the parent.
115  *
116  * These features are brought to you by a modified version of the libex 
117  * library, one of the numerous masterpiece of Ralf S. Engelschall.
118  *
119  * \htmlonly <div class="toc">\endhtmlonly
120  *
121  * @section XBT_ex_toc TABLE OF CONTENTS
122  *
123  *  - \ref XBT_ex_intro
124  *  - \ref XBT_ex_base
125  *  - \ref XBT_ex_pitfalls
126  *
127  * \htmlonly </div> \endhtmlonly
128  *
129  * @section XBT_ex_intro DESCRIPTION
130  * 
131  * In SimGrid, an exception is a triple <\a msg , \a category , \a value> 
132  * where \a msg is a human-readable text describing the exceptional 
133  * condition, \a code an integer describing what went wrong and \a value
134  * providing a sort of sub-category. (this is different in the original libex).
135  *
136  * @section XBT_ex_base BASIC USAGE
137  *
138  * \em TRY \b TRIED_BLOCK [\em TRY_CLEANUP \b CLEANUP_BLOCK] \em CATCH (variable) \b CATCH_BLOCK
139  *
140  * This is the primary syntactical construct provided. It is modeled after the
141  * ISO-C++ try-catch clause and should sound familiar to most of you.
142  *
143  * Any exception thrown directly from the TRIED_BLOCK block or from called
144  * subroutines is caught. Cleanups which must be done after this block
145  * (whenever an exception arose or not) should be placed into the optionnal
146  * CLEANUP_BLOCK. The code dealing with the exceptions when they arise should
147  * be placed into the (mandatory) CATCH_BLOCK.
148  *
149  * 
150  * In absence of exception, the control flow goes into the blocks TRIED_BLOCK
151  * and CLEANUP_BLOCK (if present); The CATCH_BLOCK block is then ignored.
152  *
153  * When an exception is thrown, the control flow goes through the following
154  * blocks: TRIED_BLOCK (up to the statement throwing the exception),
155  * CLEANUP_BLOCK (if any) and CATCH_BLOCK. The exception is stored in a
156  * variable for inspection inside the CATCH_BLOCK. This variable must be
157  * declared in the outter scope, but its value is only valid within the
158  * CATCH_BLOCK block. 
159  *
160  * Some notes:
161  *  - TRY, CLEANUP and CATCH cannot be used separately, they work
162  *    only in combination and form a language clause as a whole.
163  *  - In contrast to the syntax of other languages (such as C++ or Jave) there
164  *    is only one CATCH block and not multiple ones (all exceptions are
165  *    of the same \em xbt_ex_t C type). 
166  *  - the variable of CATCH can naturally be reused in subsequent 
167  *    CATCH clauses.
168  *  - it is possible to nest TRY clauses.
169  *
170  * The TRY block is a regular ISO-C language statement block, but
171  * 
172  * <center><b>it is not
173  * allowed to jump into it via "goto" or longjmp(3) or out of it via "break",
174  * "return", "goto" or longjmp(3)</b>.</center>
175  *
176  * This is because there is some hidden setup and
177  * cleanup that needs to be done regardless of whether an exception is
178  * caught. Bypassing these steps will break the exception handling facility.
179  * The symptom are likely to be a segfault at the next exception raising point,  
180  * ie far away from the point where you did the mistake. Finding the problem can 
181  * reveal challenging, unfortunately.
182  *   
183  * The CLEANUP and CATCH blocks are regular ISO-C language statement
184  * blocks without any restrictions. You are even allowed to throw (and, in the
185  * CATCH block, to re-throw) exceptions.
186  *
187  * There is one subtle detail you should remember about TRY blocks:
188  * Variables used in the CLEANUP or CATCH clauses must be declared with
189  * the storage class "volatile", otherwise they might contain outdated
190  * information if an exception is thrown.
191  *
192  *
193  * This is because you usually do not know which commands in the TRY
194  * were already successful before the exception was thrown (logically speaking)
195  * and because the underlying ISO-C setjmp(3) facility applies those
196  * restrictions (technically speaking). As a matter of fact, value changes
197  * between the TRY and the THROW may be discarded if you forget the
198  * "volatile" keyword. 
199  * 
200  * \section XBT_ex_pitfalls PROGRAMMING PITFALLS 
201  *
202  * Exception handling is a very elegant and efficient way of dealing with
203  * exceptional situation. Nevertheless it requires additional discipline in
204  * programming and there are a few pitfalls one must be aware of. Look the
205  * following code which shows some pitfalls and contains many errors (assuming
206  * a mallocex() function which throws an exception if malloc(3) fails):
207  *
208  * \dontinclude ex.c
209  * \skip BAD_EXAMPLE
210  * \until end_of_bad_example
211  *
212  * This example raises a few issues:
213  *  -# \b variable \b scope \n
214  *     Variables which are used in the CLEANUP or CATCH clauses must be
215  *     declared before the TRY clause, otherwise they only exist inside the
216  *     TRY block. In the example above, cp1, cp2 and cp3 only exist in the
217  *     TRY block and are invisible from the CLEANUP and CATCH
218  *     blocks.
219  *  -# \b variable \b initialization \n
220  *     Variables which are used in the CLEANUP or CATCH clauses must
221  *     be initialized before the point of the first possible THROW is
222  *     reached. In the example above, CLEANUP would have trouble using cp3
223  *     if mallocex() throws a exception when allocating a TOOBIG buffer.
224  *  -# \b volatile \b variable \n
225  *     Variables which are used in the CLEANUP or CATCH clauses MUST BE
226  *     DECLARED AS "volatile", otherwise they might contain outdated
227  *     information when an exception is thrown. 
228  *  -# \b clean \b before \b catch \n
229  *     The CLEANUP clause is not only place before the CATCH clause in
230  *     the source code, it also occures before in the control flow. So,
231  *     resources being cleaned up cannot be used in the CATCH block. In the
232  *     example, c3 gets freed before the printf placed in CATCH.
233  *  -# \b variable \b uninitialization \n
234  *     If resources are passed out of the scope of the
235  *     TRY/CLEANUP/CATCH construct, they naturally shouldn't get
236  *     cleaned up. The example above does free(3) cp1 in CLEANUP although
237  *     its value was affected to globalcontext->first, invalidating this
238  *     pointer.
239
240  * The following is fixed version of the code (annotated with the pitfall items
241  * for reference): 
242  *
243  * \skip GOOD_EXAMPLE
244  * \until end_of_good_example
245  *
246  * @{
247  */
248
249 /** @brief different kind of errors */
250 typedef enum {
251   unknown_error = 0,            /**< unknown error */
252   arg_error,                    /**< Invalid argument */
253   bound_error,                  /**< Out of bounds argument */
254   mismatch_error,               /**< The provided ID does not match */
255   not_found_error,              /**< The searched element was not found */
256   system_error,                 /**< a syscall did fail */
257   network_error,                /**< error while sending/receiving data */
258   timeout_error,                /**< not quick enough, dude */
259   cancel_error,                 /**< an action was canceled */
260   thread_error,                 /**< error while [un]locking */
261   host_error,                   /**< host failed */
262   tracing_error,                /**< error during the simulation tracing */
263   io_error,                     /**< disk or file error */
264   vm_error                      /**< vm  error */
265 } xbt_errcat_t;
266
267 XBT_PUBLIC(const char *) xbt_ex_catname(xbt_errcat_t cat);
268
269 /** @brief Structure describing an exception */
270 typedef struct {
271   char *msg;                    /**< human readable message */
272   xbt_errcat_t category;        /**< category like HTTP (what went wrong) */
273   int value;                    /**< like errno (why did it went wrong) */
274   /* throw point */
275   char *procname;               /**< Name of the process who thrown this */
276   int pid;                      /**< PID of the process who thrown this */
277   char *file;                   /**< Thrown point */
278   int line;                     /**< Thrown point */
279   char *func;                   /**< Thrown point */
280   /* Backtrace */
281   int used;
282   char **bt_strings;            /* only filed on display (or before the network propagation) */
283   void *bt[XBT_BACKTRACE_SIZE];
284 } xbt_ex_t;
285
286 /* declare the running context type
287  * (that's where we get the process name for the logs and the exception storage)
288  *  -- do not mess with it --
289  */
290 typedef struct xbt_running_ctx_t {
291   __ex_mctx_t *ctx_mctx;        /* permanent machine context of enclosing try/catch */
292   int ctx_caught;               /* temporary flag whether exception was caught */
293   volatile xbt_ex_t exception;  /* temporary exception storage */
294 } xbt_running_ctx_t;
295
296 /* the static and dynamic initializers for a context structure */
297 #define XBT_RUNNING_CTX_INITIALIZER                             \
298     { NULL, 0, { /* content */ NULL, unknown_error, 0,          \
299                  /* throw point*/ NULL, 0, NULL, 0, NULL,       \
300                  /* backtrace */ 0, NULL, /* bt[] */ } }
301
302 XBT_PUBLIC_DATA(const xbt_running_ctx_t) __xbt_ex_ctx_initializer;
303
304 // #define XBT_RUNNING_CTX_INITIALIZE(ctx) (*(ctx) = __xbt_ex_ctx_initializer)
305
306 #define XBT_RUNNING_CTX_INITIALIZE(ctx) \
307   (ctx)->ctx_mctx = NULL; \
308   (ctx)->ctx_caught = 0; \
309   (ctx)->exception.msg = NULL; \
310   (ctx)->exception.category = unknown_error; \
311   (ctx)->exception.value = 0; \
312   (ctx)->exception.procname = NULL; \
313   (ctx)->exception.pid = 0; \
314   (ctx)->exception.file = NULL; \
315   (ctx)->exception.line = 0; \
316   (ctx)->exception.used = 0; \
317   (ctx)->exception.bt_strings = NULL;
318
319 /* the exception context */
320 typedef xbt_running_ctx_t *(*xbt_running_ctx_fetcher_t) (void);
321 XBT_PUBLIC_DATA(xbt_running_ctx_fetcher_t) __xbt_running_ctx_fetch;
322 XBT_PUBLIC( xbt_running_ctx_t *)__xbt_ex_ctx_default(void);
323
324 /* the termination handler */
325 typedef void (*ex_term_cb_t) (xbt_ex_t *);
326 XBT_PUBLIC_DATA(ex_term_cb_t) __xbt_ex_terminate;
327 XBT_PUBLIC( void )__xbt_ex_terminate_default(xbt_ex_t * e);
328
329 /** @brief Introduce a block where exception may be dealed with 
330  *  @hideinitializer
331  */
332 #define TRY \
333     { \
334         xbt_running_ctx_t *__xbt_ex_ctx_ptr = __xbt_running_ctx_fetch(); \
335         int __ex_cleanup = 0; \
336         __ex_mctx_t __ex_mctx_me; \
337         __ex_mctx_t * __ex_mctx_en = __xbt_ex_ctx_ptr->ctx_mctx; \
338         __xbt_ex_ctx_ptr->ctx_mctx = &__ex_mctx_me; \
339         if (__ex_mctx_save(&__ex_mctx_me)) { \
340             if (1)
341
342 /** @brief optional(!) block for cleanup
343  *  @hideinitializer
344  */
345 #define TRY_CLEANUP \
346             else { \
347             } \
348             __xbt_ex_ctx_ptr->ctx_caught = 0; \
349         } else { \
350             __ex_mctx_restored(&__ex_mctx_me); \
351             __xbt_ex_ctx_ptr->ctx_caught = 1; \
352         } \
353         __xbt_ex_ctx_ptr->ctx_mctx = __ex_mctx_en; \
354         __ex_cleanup = 1; \
355         if (1) { \
356             if (1)
357
358 #ifndef DOXYGEN_SKIP
359 #  ifdef __cplusplus
360 #    define XBT_EX_T_CPLUSPLUSCAST (xbt_ex_t&)
361 #  else
362 #    define XBT_EX_T_CPLUSPLUSCAST
363 #  endif
364 #endif
365
366 /** @brief the block for catching (ie, deal with) an exception 
367  *  @hideinitializer
368  */
369 #define CATCH(e) \
370   DO_CATCH((e) = XBT_EX_T_CPLUSPLUSCAST __xbt_running_ctx_fetch()->exception)
371
372 /** @brief like CATCH(e) but without argument
373  *  @hideinitializer
374  *
375  *  Useful if you only want to rethrow the exception caught, and do not want to
376  *  bother with an unused variable.
377  */
378 #define CATCH_ANONYMOUS DO_CATCH(0)
379
380 #define DO_CATCH(_xbt_do_catch_set_e) \
381             else { \
382             } \
383             if (!(__ex_cleanup)) \
384                 __xbt_ex_ctx_ptr->ctx_caught = 0; \
385         } else { \
386             if (!(__ex_cleanup)) { \
387                 __ex_mctx_restored(&__ex_mctx_me); \
388                 __xbt_ex_ctx_ptr->ctx_caught = 1; \
389             } \
390         } \
391         __xbt_ex_ctx_ptr->ctx_mctx = __ex_mctx_en; \
392     } \
393     if (   !(__xbt_running_ctx_fetch()->ctx_caught) \
394         || ((void)(_xbt_do_catch_set_e),                             \
395             MAYDAY_CATCH(__xbt_running_ctx_fetch()->exception) 0)) {    \
396     } \
397     else
398
399 #define DO_THROW(running_ctx)                                           \
400   do { /* deal with the exception */                                    \
401     xbt_running_ctx_t *ctx = (running_ctx);                             \
402     if (ctx->ctx_mctx == NULL)                                          \
403       __xbt_ex_terminate((xbt_ex_t*)&(ctx->exception)); /* not catched */ \
404     else                                                                \
405       __ex_mctx_restore(ctx->ctx_mctx); /* catched somewhere */         \
406     abort();  /* nope, stupid GCC, we won't survive a THROW */          \
407               /* (this won't be reached) */                             \
408   } while(0)
409
410 /** @brief Helper macro for THROW and THROWF
411  *  @hideinitializer
412  *
413  *  @param _throw_ctx: the throwing context in which we should construct the exception
414  *  @param c: category code (integer)
415  *  @param v: value (integer)
416  *  @param m: message text
417  *
418  * If called from within a TRY/CATCH construct, this exception 
419  * is copied into the CATCH relevant variable program control flow 
420  * is derouted to the CATCH (after the optional sg_cleanup).
421  *
422  * If no TRY/CATCH construct embeds this call, the program calls
423  * abort(3). 
424  *
425  * The THROW can be performed everywhere, including inside TRY, 
426  * CLEANUP and CATCH blocks.
427  */
428
429 #define THROW_PREPARE(_throw_ctx, c, v, m)                              \
430   /* build the exception */                                             \
431   _throw_ctx->exception.msg      = (m);                                 \
432   _throw_ctx->exception.category = (xbt_errcat_t)(c);                   \
433   _throw_ctx->exception.value    = (v);                                 \
434   _throw_ctx->exception.procname = (char*)xbt_procname();               \
435   _throw_ctx->exception.pid      = xbt_getpid();                        \
436   _throw_ctx->exception.file     = (char*)__FILE__;                     \
437   _throw_ctx->exception.line     = __LINE__;                            \
438   _throw_ctx->exception.func     = (char*)__func__;                     \
439   _throw_ctx->exception.bt_strings = NULL;                              \
440   xbt_backtrace_current((xbt_ex_t *)&(_throw_ctx->exception));
441
442 #define _XBT_THROW(c, v, m)                                        \
443   do { /* change this sequence into one block */               \
444     xbt_running_ctx_t *_throw_ctx = __xbt_running_ctx_fetch(); \
445     THROW_PREPARE(_throw_ctx, c, v, m);                        \
446     DO_THROW(_throw_ctx);                                      \
447   } while (0)
448
449 /** @brief Builds and throws an exception
450     @hideinitializer */
451 #define THROW(c, v)             _XBT_THROW(c, v, NULL)
452
453 /** @brief Builds and throws an exception with a printf-like formatted message
454     @hideinitializer */
455 #define THROWF(c, v, ...)       _XBT_THROW(c, v, bprintf(__VA_ARGS__))
456
457 #define THROW_IMPOSSIBLE \
458   THROWF(unknown_error, 0, "The Impossible Did Happen (yet again)")
459 #define THROW_UNIMPLEMENTED \
460   THROWF(unknown_error, 0, "Function %s unimplemented",__func__)
461 #define THROW_DEADCODE \
462   THROWF(unknown_error, 0, "Function %s was supposed to be DEADCODE, but it's not",__func__)
463
464 #define DIE_IMPOSSIBLE xbt_die("The Impossible Did Happen (yet again)")
465
466 /** @brief re-throwing of an already caught exception (ie, pass it to the upper catch block) 
467  *  @hideinitializer
468  */
469 #define RETHROW DO_THROW(__xbt_running_ctx_fetch())
470
471 /** @brief like THROWF, but adding some details to the message of an existing exception
472  *  @hideinitializer
473  */
474 #define RETHROWF(...)                                                   \
475   do {                                                                  \
476     char *_xbt_ex_internal_msg = __xbt_running_ctx_fetch()->exception.msg; \
477     __xbt_running_ctx_fetch()->exception.msg = bprintf(__VA_ARGS__,     \
478                                                        _xbt_ex_internal_msg); \
479     free(_xbt_ex_internal_msg);                                         \
480     RETHROW;                                                            \
481   } while (0)
482
483 /** @brief Exception destructor */
484 XBT_PUBLIC(void) xbt_ex_free(xbt_ex_t e);
485 /** @brief The display made by an exception that is not catched */
486 XBT_PUBLIC(void) xbt_ex_display(xbt_ex_t * e);
487
488 /** @brief Shows a backtrace of the current location */
489 XBT_PUBLIC(void) xbt_backtrace_display_current(void);
490 /** @brief reimplementation of glibc backtrace based directly on gcc library, without implicit malloc  */
491 XBT_PUBLIC(int) xbt_backtrace_no_malloc(void**bt, int size);
492 /** @brief Captures a backtrace for further use */
493 XBT_PUBLIC(void) xbt_backtrace_current(xbt_ex_t * e);
494 /** @brief Display a previously captured backtrace */
495 XBT_PUBLIC(void) xbt_backtrace_display(xbt_ex_t * e);
496 /** @brief Get current backtrace with libunwind */
497 XBT_PUBLIC(int) xbt_libunwind_backtrace(void *bt[XBT_BACKTRACE_SIZE], int size);
498
499 SG_END_DECL()
500
501 /** @} */
502 #endif                          /* __XBT_EX_H__ */