home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sherlock.zip / DEBUG.H < prev    next >
C/C++ Source or Header  |  1994-06-29  |  8KB  |  212 lines

  1. /*
  2. **  Sherlock - Copyright 1992, 1993, 1994
  3. **    Harfmann Software
  4. **    Compuserve: 73147,213
  5. **    All rights reserved
  6. */
  7. /*
  8. ** Structures
  9. */
  10. #pragma pack(1)
  11. typedef struct  {
  12.          unsigned long   Pid;        /* Debuggee Process ID */
  13.          unsigned long   Tid;        /* Debuggee Thread ID */
  14.          long            Cmd;        /* Command or Notification */
  15.          long            Value;      /* Generic Data Value */
  16.          unsigned long   Addr;       /* Debuggee Address */
  17.          unsigned long   Buffer;     /* Debugger Buffer Address */
  18.          unsigned long   Len;        /* Length of Range */
  19.          unsigned long   Index;      /* Generic Identifier Index */
  20.          unsigned long   MTE;        /* Module Table Entry Handle */
  21.          unsigned long   EAX;        /* Register Set */
  22.          unsigned long   ECX;
  23.          unsigned long   EDX;
  24.          unsigned long   EBX;
  25.          unsigned long   ESP;
  26.          unsigned long   EBP;
  27.          unsigned long   ESI;
  28.          unsigned long   EDI;
  29.          unsigned long   EFlags;
  30.          unsigned long   EIP;
  31.          unsigned long   CSLim;      /* Byte Granular Limits */
  32.          unsigned long   CSBase;     /* Byte Granular Base */
  33.          unsigned char   CSAcc;      /* Access Bytes */
  34.          unsigned char   CSAtr;      /* Attribute Bytes */
  35.          unsigned short  CS;
  36.          unsigned long   DSLim;
  37.          unsigned long   DSBase;
  38.          unsigned char   DSAcc;
  39.          unsigned char   DSAtr;
  40.          unsigned short  DS;
  41.          unsigned long   ESLim;
  42.          unsigned long   ESBase;
  43.          unsigned char   ESAcc;
  44.          unsigned char   ESAtr;
  45.          unsigned short  ES;
  46.          unsigned long   FSLim;
  47.          unsigned long   FSBase;
  48.          unsigned char   FSAcc;
  49.          unsigned char   FSAtr;
  50.          unsigned short  FS;
  51.          unsigned long   GSLim;
  52.          unsigned long   GSBase;
  53.          unsigned char   GSAcc;
  54.          unsigned char   GSAtr;
  55.          unsigned short  GS;
  56.          unsigned long   SSLim;
  57.          unsigned long   SSBase;
  58.          unsigned char   SSAcc;
  59.          unsigned char   SSAtr;
  60.          unsigned short  SS;
  61. } DebugBuffer;
  62.  
  63. typedef struct {
  64.     unsigned char   DbgState;
  65.     unsigned char   TState;
  66.     unsigned short  TPriority;
  67. } ThreadState;
  68.  
  69. typedef struct {
  70.     ULONG losig;
  71.     ULONG hisig;
  72.     USHORT signexp;
  73. } FPReg;
  74.  
  75. typedef struct {
  76.     struct {
  77.     int invalidOp:1;
  78.     int denormal:1;
  79.     int zeroDiv:1;
  80.     int overflow:1;
  81.     int underflow:1;
  82.     int precision:1;
  83.     int res1:1;
  84.     int res2:1;
  85.     int precCntl:2;
  86.     int roundCntl:2;
  87.     int infinity:1;
  88.     int res3:3;
  89.     } control;
  90.     struct {
  91.     int invalidOp:1;
  92.     int denormal:1;
  93.     int zeroDiv:1;
  94.     int overflow:1;
  95.     int underflow:1;
  96.     int precision:1;
  97.     int res1:1;
  98.     int errStat:1;
  99.     int cond1:3;
  100.     int tos:3;
  101.     int cond2:1;
  102.     int neuBusy:1;
  103.     } status;
  104.     struct {
  105.     int tag0:2;
  106.     int tag1:2;
  107.     int tag2:2;
  108.     int tag3:2;
  109.     int tag4:2;
  110.     int tag5:2;
  111.     int tag6:2;
  112.     int tag7:2;
  113.     } tags;
  114.     ULONG ip[2];
  115.     ULONG operand[2];
  116.     FPReg reg[8];
  117. } FPState;
  118. #pragma pack()
  119.  
  120. /*
  121. ** Available debugger levels.
  122. */
  123. #define DBG_L_386              1  /* Debug a 386.                           */
  124.  
  125. /*
  126. ** Command values.
  127. */
  128. #define DBG_C_Null             0  /* Null                                   */
  129. #define DBG_C_ReadMem          1  /* Read Word                              */
  130. #define DBG_C_ReadMem_I        1  /* Read Word                              */
  131. #define DBG_C_ReadMem_D        2  /* Read Word (same as 1)                  */
  132. #define DBG_C_ReadReg          3  /* Read Register Set                      */
  133. #define DBG_C_WriteMem         4  /* Write Word                             */
  134. #define DBG_C_WriteMem_I       4  /* Write Word                             */
  135. #define DBG_C_WriteMem_D       5  /* Write Word (same as 4)                 */
  136. #define DBG_C_WriteReg         6  /* Write Register Set                     */
  137. #define DBG_C_Go               7  /* Go                                     */
  138. #define DBG_C_Term             8  /* Terminate                              */
  139. #define DBG_C_SStep            9  /* Single Step                            */
  140. #define DBG_C_Stop            10  /* Stop                                   */
  141. #define DBG_C_Freeze          11  /* Freeze Thread                          */
  142. #define DBG_C_Resume          12  /* Resume Thread                          */
  143. #define DBG_C_NumToAddr       13  /* Object Number to Address               */
  144. #define DBG_C_ReadCoRegs      14  /* Read Coprocessor Registers             */
  145. #define DBG_C_WriteCoRegs     15  /* Write Coprocessor Registers            */
  146. #define DBG_C_ThrdStat        17  /* Get Thread Status                      */
  147. #define DBG_C_MapROAlias      18  /* Map Read-Only Alias                    */
  148. #define DBG_C_MapRWAlias      19  /* Map Read-Write Alias                   */
  149. #define DBG_C_UnMapAlias      20  /* Unmap Alias                            */
  150. #define DBG_C_Connect         21  /* Connect to Debuggee                    */
  151. #define DBG_C_ReadMemBuf      22  /* Read Memory Buffer                     */
  152. #define DBG_C_WriteMemBuf     23  /* Write Memory Buffer                    */
  153. #define DBG_C_SetWatch        24  /* Set Watchpoint                         */
  154. #define DBG_C_ClearWatch      25  /* Clear Watchpoint                       */
  155. #define DBG_C_RangeStep       26  /* Range Step                             */
  156. #define DBG_C_Continue        27  /* Continue (Set Exception State)         */
  157. #define DBG_C_AddrToObject    28  /* Get Memory Object Information          */
  158. #define DBG_C_XchgOpcode      29  /* Exchange Opcode, Step, and Go        */
  159. #define DBG_C_LinToSel        30  /* Translate Linear to Segmented address  */
  160. #define DBG_C_SelToLin        31  /* Translate Segmented to Linear Address  */
  161.  
  162. /*
  163. ** Notification values.
  164. */
  165. #define DBG_N_Success          0  /* Successful command completion          */
  166. #define DBG_N_Error           -1  /* Error detected during command          */
  167. #define DBG_N_ProcTerm        -6  /* Process termination - DosExitList done */
  168. #define DBG_N_Exception       -7  /* Exception detected                     */
  169. #define DBG_N_ModuleLoad      -8  /* Module loaded                          */
  170. #define DBG_N_CoError         -9  /* Coprocessor not in use error           */
  171. #define DBG_N_ThreadTerm     -10  /* Thread termination - not in DosExitList*/
  172. #define DBG_N_AsyncStop      -11  /* Async Stop detected                    */
  173. #define DBG_N_NewProc        -12  /* New Process started                    */
  174. #define DBG_N_AliasFree      -13  /* Alias needs to be freed                */
  175. #define DBG_N_Watchpoint     -14  /* Watchpoint hit                         */
  176. #define DBG_N_ThreadCreate   -15  /* Thread creation                        */
  177. #define DBG_N_ModuleFree     -16  /* Module freed                           */
  178. #define DBG_N_RangeStep      -17  /* Range Step detected                    */
  179.  
  180. /*
  181. ** DbgState in the Thread Status buffer contains info about the
  182. ** current state of debugging as follows:
  183. */
  184. #define DBG_D_Thawed        0
  185. #define DBG_D_Frozen        1
  186.  
  187. /*
  188. ** TState in the Thread Status buffer contains info about the
  189. ** scheduling about a thread as follows:
  190. */
  191. #define DBG_T_Runnable      0
  192. #define DBG_T_Suspended     1
  193. #define DBG_T_Blocked       2
  194. #define DBG_T_CritSec       3
  195.  
  196. /*
  197. ** Watch scopes and types.
  198. */
  199. #define DBG_W_Global        0x00000001
  200. #define DBG_W_Local         0x00000002
  201. #define DBG_W_Execute       0x00010000
  202. #define DBG_W_Write         0x00020000
  203. #define DBG_W_ReadWrite     0x00030000
  204.  
  205. /*
  206. ** define the floating point manifest constants.
  207. */
  208. #define TAG_VALID   0
  209. #define TAG_ZERO    1
  210. #define TAG_INVALID 2
  211. #define TAG_EMPTY   3
  212.