-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththreaddump.h
More file actions
33 lines (25 loc) · 819 Bytes
/
Copy paththreaddump.h
File metadata and controls
33 lines (25 loc) · 819 Bytes
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
#ifndef THREADDUMP_H
#define THREADDUMP_H
#define THREADDUMP_INIT void __attribute__((constructor))
#define THREADDUMP_DESTROY void __attribute__((destructor))
#define THREADDUMP_ERROR_ABORT(msg, exit_status) do { perror(msg); exit(exit_status); } while(0)
// a little bit hacky
#define THREADDUMP_GDB_ATTACH(pid) "/usr/bin/gdb", "-batch", "-p", pid
#define THREADDUMP_GDB_EXEC(cmd) "-ex", cmd
#ifdef THREADDUMP_DEBUG
#define TDDEBUG 1
#else
#define TDDEBUG 0
#endif
#define THREADDUMP_LOG(fmt, ...) \
do { if (TDDEBUG) fprintf(stderr, fmt, ##__VA_ARGS__); } while(0)
#ifdef __cplusplus
extern "C" {
#endif
static THREADDUMP_INIT threaddump_init(void);
static THREADDUMP_DESTROY threaddump_destroy(void);
static void* threaddump_wait_and_backtrace(void*);
#ifdef __cplusplus
}
#endif
#endif // THREADDUMP_H