1 /*
2  * Dummy stuff needed to compile debugger related test code
3  */
4 
5 /* fake tracing flags */
6 #include "log.h"
7 Uint64 LogTraceFlags = 0;
8 
9 /* fake Hatari configuration variables for number parsing */
10 #include "configuration.h"
11 CNF_PARAMS ConfigureParams;
12 
13 /* fake cycles stuff */
14 #include "cycles.h"
15 int CurrentInstrCycles;
Cycles_GetCounter(int nId)16 int Cycles_GetCounter(int nId) { return 0; }
17 
18 /* fake ST RAM */
19 #include "stMemory.h"
20 Uint8 STRam[16*1024*1024];
21 Uint32 STRamEnd = 4*1024*1024;
22 
23 /* fake memory banks */
24 #include "memory.h"
25 addrbank *mem_banks[65536];
26 
27 /* fake IO memory variables */
28 #include "ioMem.h"
29 int nIoMemAccessSize;
30 Uint32 IoAccessBaseAddress;
31 
32 /* fake CPU wrapper stuff */
33 #include "m68000.h"
34 int nWaitStateCycles;
35 cpu_instruction_t CpuInstruction;
MakeFromSR(void)36 void MakeFromSR(void) { }
37 
38 /* fake UAE core registers */
39 #include "newcpu.h"
40 cpuop_func *cpufunctbl[65536];
41 struct regstruct regs;
MakeSR(void)42 void MakeSR(void) { }
m68k_dumpstate(FILE * f,uaecptr * nextpc)43 void m68k_dumpstate (FILE *f, uaecptr *nextpc) { }
m68k_disasm(FILE * f,uaecptr addr,uaecptr * nextpc,int cnt)44 void m68k_disasm (FILE *f, uaecptr addr, uaecptr *nextpc, int cnt) { }
45 
46 /* fake memory snapshot */
47 #include "memorySnapShot.h"
MemorySnapShot_Store(void * pData,int Size)48 void MemorySnapShot_Store(void *pData, int Size) { }
49 
50 /* fake TOS variables */
51 #include "tos.h"
52 Uint32 TosAddress, TosSize;
53 
54 /* fake debugui.c stuff */
55 #include "debug_priv.h"
56 #include "debugui.h"
57 FILE *debugOutput;
DebugUI(debug_reason_t reason)58 void DebugUI(debug_reason_t reason) { }
DebugUI_PrintCmdHelp(const char * psCmd)59 void DebugUI_PrintCmdHelp(const char *psCmd) { }
DebugUI_MatchHelper(const char ** strings,int items,const char * text,int state)60 char *DebugUI_MatchHelper(const char **strings, int items, const char *text, int state) {
61 	return NULL;
62 }
63 
64 /* fake debugInfo.c stuff */
65 #include "debugInfo.h"
DebugInfo_ShowSessionInfo(void)66 void DebugInfo_ShowSessionInfo(void) {}
DebugInfo_GetTEXT(void)67 Uint32 DebugInfo_GetTEXT(void) { return 0x1234; }
DebugInfo_GetTEXTEnd(void)68 Uint32 DebugInfo_GetTEXTEnd(void) { return 0x1234; }
DebugInfo_GetDATA(void)69 Uint32 DebugInfo_GetDATA(void) { return 0x12f4; }
DebugInfo_GetBSS(void)70 Uint32 DebugInfo_GetBSS(void)  { return 0x1f34; }
71 
72 /* fake debugdsp.c stuff */
73 #include "debugdsp.h"
DebugDsp_InitSession(void)74 void DebugDsp_InitSession(void) { }
DebugDsp_InstrCount(void)75 Uint32 DebugDsp_InstrCount(void) { return 0; }
DebugDsp_OpcodeType(void)76 Uint32 DebugDsp_OpcodeType(void) { return 0; }
77 
78 /* use fake dsp.c stuff in case config.h is configured with DSP emu */
79 #include "dsp.h"
80 bool bDspEnabled;
DSP_DisasmAddress(FILE * f,Uint16 lowerAdr,Uint16 UpperAdr)81 Uint16 DSP_DisasmAddress(FILE *f, Uint16 lowerAdr, Uint16 UpperAdr) { return 0; }
DSP_GetInstrCycles(void)82 Uint16 DSP_GetInstrCycles(void) { return 0; }
DSP_GetPC(void)83 Uint16 DSP_GetPC(void) { return 0; }
DSP_GetRegisterAddress(const char * arg,Uint32 ** addr,Uint32 * mask)84 int DSP_GetRegisterAddress(const char *arg, Uint32 **addr, Uint32 *mask)
85 {
86 	*addr = NULL; /* find if this gets used */
87 	*mask = 0;
88 	return 0;
89 }
DSP_ReadMemory(Uint16 addr,char space,const char ** mem_str)90 Uint32 DSP_ReadMemory(Uint16 addr, char space, const char **mem_str)
91 {
92 	*mem_str = NULL; /* find if this gets used */
93 	return 0;
94 }
95 
96 /* fake console redirection */
97 #include "console.h"
98 int ConOutDevice;
Console_Check(void)99 void Console_Check(void) { }
100 
101 /* fake gemdos stuff */
102 #include "gemdos.h"
GemDOS_GetLastProgramPath(void)103 const char *GemDOS_GetLastProgramPath(void) { return NULL; }
104 
105 /* fake profiler stuff */
106 #include "profile.h"
107 const char Profile_Description[] = "";
Profile_Command(int nArgc,char * psArgs[],bool bForDsp)108 int Profile_Command(int nArgc, char *psArgs[], bool bForDsp) { return DEBUGGER_CMDDONE; }
Profile_Match(const char * text,int state)109 char *Profile_Match(const char *text, int state) { return NULL; }
Profile_CpuStart(void)110 bool Profile_CpuStart(void) { return false; }
Profile_CpuUpdate(void)111 void Profile_CpuUpdate(void) { }
Profile_CpuStop(void)112 void Profile_CpuStop(void) { }
113 
114 /* fake Hatari video variables */
115 #include "screen.h"
116 #include "video.h"
117 int nHBL = 20;
118 int nVBLs = 71;
119 
120 /* fake video variables accessor */
Video_GetPosition(int * pFrameCycles,int * pHBL,int * pLineCycles)121 void Video_GetPosition(int *pFrameCycles, int *pHBL, int *pLineCycles)
122 {
123 	*pFrameCycles = 2048;
124 	*pHBL = nHBL;
125 	*pFrameCycles = 508;
126 }
127 
128 /* only function needed from file.c */
129 #include <sys/stat.h>
130 #include <sys/time.h>
131 #include "file.h"
File_Exists(const char * filename)132 bool File_Exists(const char *filename)
133 {
134 	struct stat buf;
135 	if (stat(filename, &buf) == 0 &&
136 	    (buf.st_mode & (S_IRUSR|S_IWUSR)) && !(buf.st_mode & S_IFDIR))
137 	{
138 		/* file points to user readable regular file */
139 		return true;
140 	}
141 	return false;
142 }
143 
144 /* fake debugger file parsing */
145 #include "debugui.h"
DebugUI_ParseFile(const char * path,bool reinit)146 bool DebugUI_ParseFile(const char *path, bool reinit)
147 {
148 	return File_Exists(path);
149 }
150 
151 /* fake disassembly output */
152 #include "68kDisass.h"
Disasm_GetNextPC(Uint32 pc)153 Uint32 Disasm_GetNextPC(Uint32 pc) { return pc+2; }
Disasm(FILE * f,uaecptr addr,uaecptr * nextpc,int count)154 void Disasm (FILE *f, uaecptr addr, uaecptr *nextpc, int count) {}
Disasm_GetColumns(int * columns)155 void Disasm_GetColumns(int *columns) {}
Disasm_SetColumns(int * columns)156 void Disasm_SetColumns(int *columns) {}
Disasm_DisableColumn(int column,int * oldcols,int * newcols)157 void Disasm_DisableColumn(int column, int *oldcols, int *newcols) {}
158