sim_error.h
2.7 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
* Copyright (C) 1996-1998 by the Board of Trustees
* of Leland Stanford Junior University.
*
* This file is part of the SimOS distribution.
* See LICENSE file for terms of the license.
*
*/
/*****************************************************************
* error.h
*
* Error handling headers for SimOS.
*
* Author: $Author: blythe $
* Date: $Date: 2002/05/29 01:09:09 $
****************************************************************/
#ifndef _CPU_SHARED_ERROR_H
#define _CPU_SHARED_ERROR_H
#ifndef _LANGUAGE_ASSEMBLY
#include <stdarg.h>
#include <stdio.h>
#include "simtypes.h"
extern FILE *cpulogF;
/* #define ASSERTS_DISABLED*/
#ifndef ASSERTS_DISABLED
#define ASSUME(x) {if (!(x)) \
{CPUWarning("%s:%d: assumption failed: %s\n",\
__FILE__, __LINE__, # x);} }
#define VASSUME(x,s) {if (!(x)) \
{CPUPut s; CPUWarning("%s:%d: assumption failed: %s\n",\
__FILE__, __LINE__, # x);} }
#define ASSERT(x) {if (!(x)) \
{CPUError("%s:%d: assertion failed (looping): %s\n",\
__FILE__, __LINE__, # x);} }
#define VASSERT(x,s) {if (!(x)) \
{CPUPut s; CPUError("%s:%d: assertion failed (looping): %s\n",\
__FILE__, __LINE__, # x);} }
#else
#define ASSUME(x)
#define VASSUME(x,s)
#define ASSERT(x)
#define VASSERT(x,s)
#endif
#define NOTREACHED() \
{CPUError("%s:%d: NOTREACHED() error\n",\
__FILE__, __LINE__);}
extern void SimErrorInit(char* log_file);
extern void CPUError(char *,...);
extern void CPUWarning(char *,...);
extern void vCPUPrint(char *,va_list);
extern void CPUPrint(char *,...);
extern void CPUPrintFlush(void);
extern void CPUPut(char *, ...);
extern void lCPUPut(char *, ...);
extern void CPU_nop(void);
extern void CPURestartLog(void);
extern void DebugInit(char* flags);
/* Don't call these directly... use the macros below. */
extern void Debug (char flag, char* format, ...); /* Print debug message if enabled */
extern void DebugDetail(char flag, char *symbol, int cpuNum, char *text,...);
extern void LogEntry(char *symbol, int cpuNum, char *text,...);
#if 0
#define DEBUGGING_DISABLED
#endif
#ifndef DEBUGGING_DISABLED
#define SIM_DEBUG(arg1) Debug arg1
#define SIM_DEBUG_DETAIL(arg1) DebugDetail arg1
#else
#define SIM_DEBUG(arg1)
#define SIM_DEBUG_DETAIL(arg1)
#endif
/*****************************************************************
Seems like a good place to track which letters are used for what:
b - backdoor/registry
i - interrupt debugging -> console, ethernet
d - dma
e - ethernet
f - fpu (mipsy/embra/whatever)
g - general -> memory allocation, checkpoints, gdb, etc.
o - solo-specific debugging (syscalls, etc.)
t - tcl (including timing)
v - visual
*****************************************************************/
#endif
#endif /* _LANGUAGE_ASSEMBY */