Make start address of `osReserveHeapMemory` tunable via command line -xb
[ghc.git] / rts / Libdw.h
1 /* -----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 2014-2015
4 *
5 * Producing stacktraces with DWARF unwinding using libdw..
6 *
7 * Do not #include this file directly: #include "Rts.h" instead.
8 *
9 * To understand the structure of the RTS headers, see the wiki:
10 * http://ghc.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
11 *
12 * -------------------------------------------------------------------------- */
13
14 #ifndef LIBDW_H
15 #define LIBDW_H
16
17 #include "BeginPrivate.h"
18
19 #if USE_LIBDW
20
21 /* Begin a libdw session. A session is tied to a particular capability */
22 LibdwSession *libdwInit(void);
23
24 /* Free a session */
25 void libdwFree(LibdwSession *session);
26
27 /* Pretty-print a backtrace to std*/
28 void libdwPrintBacktrace(LibdwSession *session, FILE *file, Backtrace *bt);
29
30 // Traverse backtrace in order of outer-most to inner-most frame
31 #define FOREACH_FRAME_INWARDS(pc, bt) \
32 BacktraceChunk *_chunk; \
33 unsigned int _frame_idx; \
34 for (_chunk = &bt->frames; _chunk != NULL; _chunk = _chunk->next) \
35 for (_frame_idx=0; \
36 pc = _chunk->frames[_frame_idx], _frame_idx < _chunk->n_frames; \
37 _frame_idx++)
38
39 // Traverse a backtrace in order of inner-most to outer-most frame
40 int libdwForEachFrameOutwards(Backtrace *bt,
41 int (*cb)(StgPtr, void*),
42 void *user_data);
43
44 #endif /* USE_LIBDW */
45
46 #include "EndPrivate.h"
47
48 #endif /* LIBDW_H */