Fix for Trac #15611: Scope errors lie about what modules are imported.
[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 #pragma once
15
16 #include "BeginPrivate.h"
17
18 #if USE_LIBDW
19
20 /* Begin a libdw session. A session is tied to a particular capability */
21 LibdwSession *libdwInit(void);
22
23 /* Free a session */
24 void libdwFree(LibdwSession *session);
25
26 // Traverse backtrace in order of outer-most to inner-most frame
27 #define FOREACH_FRAME_INWARDS(pc, bt) \
28 BacktraceChunk *_chunk; \
29 unsigned int _frame_idx; \
30 for (_chunk = &bt->frames; _chunk != NULL; _chunk = _chunk->next) \
31 for (_frame_idx=0; \
32 pc = _chunk->frames[_frame_idx], _frame_idx < _chunk->n_frames; \
33 _frame_idx++)
34
35 // Traverse a backtrace in order of inner-most to outer-most frame
36 int libdwForEachFrameOutwards(Backtrace *bt,
37 int (*cb)(StgPtr, void*),
38 void *user_data);
39
40 #endif /* USE_LIBDW */
41
42 #include "EndPrivate.h"