home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Exec 5 / CD_Magazyn_EXEC_nr_5.iso / Programy / Programowanie / PPC / wosdb_src.lzx / debugger.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-13  |  2.8 KB  |  148 lines

  1. /* $VER: debugger.h V0.3a (06.05.99)
  2.  *
  3.  * This file is part of the WarpOS debugger 'wosdb'
  4.  * Copyright (c) 1999-2001  Frank Wille
  5.  *
  6.  *
  7.  * v0.3a (06.05.99) phx
  8.  *       Removed wosdb_breakpointlist() - struct LoadFile is sufficient.
  9.  *       wosdb_load() supports argument string.
  10.  * v0.2  (02.05.99) phx
  11.  *       wosdb_validaddr(): checks whether an address belongs to the
  12.  *       debugged program.
  13.  * v0.1  (01.05.99) phx
  14.  *       First usable version.
  15.  * v0.0  (17.04.99) phx
  16.  *       File created.
  17.  */
  18.  
  19. #ifndef DEBUGGER_H
  20. #define DEBUGGER_H
  21.  
  22. #include <exec/lists.h>
  23. #ifndef PPC_DISASM_H
  24. #include "ppc_disasm.h"
  25. #endif
  26.  
  27.  
  28. #define NAME "wosdb"
  29. #define VERSION 0
  30. #define REVISION 4
  31. #define PLEVEL 3
  32.  
  33. #define TRAP_INS      0x7fe00008  /* trap instruction */
  34.  
  35. /* pseudo exceptions */
  36. #define EXCF_BRKPT    0x40000000  /* trap instruction encountered */
  37. #define EXCF_FINISHED 0x80000000  /* task finished */
  38.  
  39. typedef UBYTE *ADDR;
  40.  
  41.  
  42. struct SpecRegs {
  43.   ULONG srHID0;
  44.   ULONG srHID1;
  45.   ULONG srPVR;
  46.   ULONG srSDR1;
  47.   ULONG srEAR;
  48.   ULONG srDEC;
  49.   ULONG srTBU;
  50.   ULONG srTBL;
  51. };
  52.  
  53.  
  54. struct Symbol {
  55.   struct Symbol *next;
  56.   char *name;
  57.   ADDR addr;
  58. };
  59.  
  60.  
  61. struct Section {
  62.   struct Section *next;
  63.   ADDR addr;
  64.   ULONG len;
  65.   struct Symbol *symbols;
  66. };
  67.  
  68.  
  69. struct Breakpoint {
  70.   struct MinNode n;
  71.   ADDR addr;
  72.   ULONG contents;
  73.   BOOL temporary;
  74. };
  75.  
  76.  
  77. struct LoadFile {
  78.   char *name;
  79.   int sections;
  80.   int symbols;
  81.   struct Section *firstsec;
  82.   struct MinList *breakpoints;
  83.   struct SpecRegs *specregs;
  84. };
  85.  
  86.  
  87. /* expression evaluation */
  88.  
  89. struct enode {
  90.   struct enode *root;
  91.   struct enode *left;
  92.   struct enode *right;
  93.   int operation;
  94.   union {
  95.     int priority;
  96.     long value;
  97.   } u;
  98. };
  99.  
  100. #define OPERAND 0
  101. #define PLUS 1
  102. #define MINUS 2
  103. #define MULT 3
  104. #define DIV 4
  105. #define PLUSPRI 0
  106. #define MINUSPRI 0
  107. #define MULTPRI 1
  108. #define DIVPRI 1
  109. #define TERMPRI 2
  110.  
  111.  
  112. /* assembler inlines */
  113. void _remove(void *n) =
  114.         "\tlwz\tr5,4(r3)\n"
  115.         "\tlwz\tr4,0(r3)\n"
  116.         "\tstw\tr4,0(r5)\n"
  117.         "\tstw\tr5,4(r4)";
  118.  
  119. void _insertbefore(void *n,void *sn) =
  120.         "\tlwz\tr5,4(r4)\n"
  121.         "\tstw\tr4,0(r3)\n"
  122.         "\tstw\tr5,4(r3)\n"
  123.         "\tstw\tr3,0(r5)\n"
  124.         "\tstw\tr3,4(r4)";
  125.  
  126.  
  127. /* wosdb prototypes */
  128. BOOL wosdb_setbreakpoint(ADDR);
  129. BOOL wosdb_tempbreakpoint(ADDR);
  130. BOOL wosdb_clearbreakpoint(ADDR);
  131. struct Breakpoint *wosdb_hidebreakpoint(ADDR);
  132. void wosdb_showbreakpoint(struct Breakpoint *);
  133. struct LoadFile *wosdb_load(char *,char *);
  134. void wosdb_unload(void);
  135. ULONG wosdb_cont(BOOL,BOOL);
  136. ULONG wosdb_taskresult(void);
  137. char *wosdb_exceptinfo(void);
  138. char *wosdb_symbol(ADDR);
  139. char *wosdb_label(ADDR);
  140. void wosdb_opersymbols(struct DisasmPara_PPC *,int);
  141. int wosdb_validaddr(ADDR);
  142. ULONG wosdb_getexp(char *);
  143. struct SpecRegs *wosdb_getspecregs(void);
  144. struct EXCContext *wosdb_init(void);
  145. void wosdb_exit(void);
  146.  
  147. #endif /* DEBUGGER_H */
  148.