-
Notifications
You must be signed in to change notification settings - Fork 4
/
backtracexx.hpp
53 lines (40 loc) · 1.09 KB
/
backtracexx.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef backtracexx_hpp
#define backtracexx_hpp
#include <iosfwd>
#include <string>
#include <list>
#if defined( WIN32 ) || defined( WIN64 )
#ifdef BACKTRACEXX_EXPORTS
#define BACKTRACEXX_EXPORT __declspec( dllexport )
#else
#define BACKTRACEXX_EXPORT __declspec( dllimport )
#endif
struct _CONTEXT;
typedef struct _CONTEXT* PCONTEXT;
#else
#define BACKTRACEXX_EXPORT __attribute__(( visibility( "default" ) ))
typedef void* PCONTEXT;
#endif
namespace backtracexx
{
struct BACKTRACEXX_EXPORT Frame
{
explicit Frame( void const* address );
void const* address;
std::string symbol;
long displacement;
std::string moduleName;
void const* moduleBaseAddress;
std::string fileName;
long lineNumber;
};
typedef std::list< Frame > Trace;
//
// ctx == 0, scan() stack from current frame.
// ctx != 0, scan() stack from specified context (e.g. passed from SEH handler).
//
BACKTRACEXX_EXPORT Trace scan( ::PCONTEXT /* not used on linux */ ctx = 0 );
BACKTRACEXX_EXPORT bool lookupSymbol( Frame& );
BACKTRACEXX_EXPORT std::ostream& operator << ( std::ostream&, Trace const& );
}
#endif