Logo AND Algorithmique Numérique Distribuée

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