Annotation of hatari/tests/debugger/test-dummies.c, revision 1.1.1.6

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.