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

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