-
Notifications
You must be signed in to change notification settings - Fork 68
/
dispdbg.h
74 lines (64 loc) · 2.22 KB
/
dispdbg.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* Break-pointer debugging facilities for the StackInterpreter VM.
* Edit this to install various debugging traps. In a production
* VM this header should define only the assert macros and empty
* sendBreakpointreceiver and bytecodeDispatchDebugHook macros.
*/
#include "sqAssert.h"
#include "pharovm/debug.h"
#if !defined(VMBIGENDIAN)
# error "sqConfig.h does not define VMBIGENDIAN"
#elif !((VMBIGENDIAN == 1) || (VMBIGENDIAN == 0))
# error "sqConfig.h does not define VMBIGENDIAN as either 1 or 0"
#endif
/*
* various definitions of the sendBreakpointreceiver macro for break-pointing at
* specific sends.
*/
#if STACKVM
# define warnSendBreak() do { \
suppressHeartbeatFlag = 1; \
warning("send breakpoint (heartbeat suppressed)"); \
} while (0)
# define warnMNUBreak() do { \
suppressHeartbeatFlag = 1; \
warning("MNU breakpoint (heartbeat suppressed)"); \
} while (0)
#else
# define warnSendBreak() warning("send breakpoint")
# define warnMNUBreak() warning("MNU breakpoint")
#endif
#if PRODUCTION && !SENDTRACE /* default for no send breakpoint. */
# define sendBreakpointreceiver(sel, len, rcvr) 0
# define mnuBreakpointreceiver(sel, len, rcvr) 0
#elif SENDTRACE /* send tracing. */
# define sendBreakpointreceiver(sel, len, rcvr) do { \
if (sendTrace) \
logTrace("%.*s\n", (int)(len), (char *)(sel)); \
} while (0)
# define mnuBreakpointreceiver(sel, len, rcvr) 0
#elif 0 /* send trace/byte count. */
# define sendBreakpointreceiver(sel, len, rcvr) do { \
if (sendTrace) \
logTrace("%u %.*s\n", GIV(byteCount), (int)(len), (char *)(sel)); \
} while (0)
# define mnuBreakpointreceiver(sel, len, rcvr) 0
#else /* breakpoint for assert and debug configurations. */
# define sendBreakpointreceiver(sel, len, rcvr) do { \
if ((len) == breakSelectorLength \
&& !strncmp((char *)(sel), breakSelector, breakSelectorLength)) { \
warnSendBreak(); \
if (0) sendTrace = 1; \
} \
if (sendTrace) \
logTrace("%.*s\n", (int)(len), (char *)(sel)); \
} while (0)
# define mnuBreakpointreceiver(sel, len, rcvr) do { \
if ((len) == -breakSelectorLength \
&& !strncmp((char *)(sel), breakSelector, -breakSelectorLength)) { \
warnMNUBreak(); \
if (0) sendTrace = 1; \
} \
} while (0)
#endif
#define bytecodeDispatchDebugHook() 0