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

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