-
Notifications
You must be signed in to change notification settings - Fork 4
/
clem_debug.h
57 lines (42 loc) · 2.29 KB
/
clem_debug.h
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
54
55
56
57
#ifndef CLEM_DEBUG_H
#define CLEM_DEBUG_H
/* TODO: something a little less reliant on clib */
#include <assert.h>
#include <stdio.h>
#define CLEM_ASSERT(_cond_) \
do { \
assert(_cond_); \
} while (0)
#define CLEM_UNIMPLEMENTED(...) \
do { \
clem_debug_log(CLEM_DEBUG_LOG_UNIMPL, __VA_ARGS__); \
} while (0)
#define CLEM_WARN(...) \
do { \
clem_debug_log(CLEM_DEBUG_LOG_WARN, __VA_ARGS__); \
} while (0)
#define CLEM_LOG(...) \
do { \
clem_debug_log(CLEM_DEBUG_LOG_INFO, __VA_ARGS__); \
} while (0)
#define CLEM_DEBUG(...) \
do { \
clem_debug_log(CLEM_DEBUG_LOG_DEBUG, __VA_ARGS__); \
} while (0)
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ClemensMachine ClemensMachine;
struct ClemensDeviceDebugger;
void clem_debug_reset(struct ClemensDeviceDebugger *dbg);
void clem_debug_break(struct ClemensDeviceDebugger *dbg, unsigned debug_reason, unsigned param0,
unsigned param1);
void clem_debug_context(ClemensMachine *context);
void clem_debug_log(int log_level, const char *fmt, ...);
char *clem_debug_acquire_trace(unsigned amt);
void clem_debug_trace_flush();
void clemens_debug_status_toolbox(ClemensMachine *context, unsigned id);
#ifdef __cplusplus
}
#endif
#endif