wdbDbgLib.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:8k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* wdbDbgLib.h -  debugger library */
  2. /* Copyright 1984-2002 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01j,25apr02,jhw  Added C++ support (SPR 76304).
  7. 01i,22oct01,dee  Merge from T2.1.0 ColdFire
  8. 01h,05sep01,pch  Avoid declaring functions which will not be defined
  9.                  according to setting of DBG_NO_SINGLE_STEP
  10. 01g,25feb00,frf  Add SH support for T2
  11. 01f,14may98,dbt  fixed previous modification.
  12. 01e,13may98,dbt  added stddef.h include for offsetof definition.
  13. 01d,01may98,cym  added SIMNT support.
  14. 01c,29apr98,dbt  code cleanup.
  15. 01b,15apr98,kkk  added ARM support.
  16. 01a,07oct97,dbt  written
  17. */
  18. #ifndef __INCwdbDbgLibh
  19. #define __INCwdbDbgLibh
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /* includes */
  24. #include "vxWorks.h"
  25. #if     CPU_FAMILY == MC680X0
  26. #include "arch/mc68k/dbgMc68kLib.h"
  27. #endif  /* CPU_FAMILY == MC680X0 */
  28. #if     CPU_FAMILY == I960
  29. #include "arch/i960/dbgI960Lib.h"
  30. #endif  /* CPU_FAMILY == I960 */
  31. #if     CPU_FAMILY == MIPS
  32. #include "arch/mips/dbgMipsLib.h"
  33. #endif  /* CPU_FAMILY == MIPS */
  34. #if     CPU_FAMILY == PPC
  35. #include "arch/ppc/dbgPpcLib.h"
  36. #endif  /* CPU_FAMILY == PPC */
  37. #if     CPU_FAMILY == SPARC
  38. #include "arch/sparc/dbgSparcLib.h"
  39. #endif  /* CPU_FAMILY == SPARC */
  40. #if     CPU_FAMILY == SIMSPARCSOLARIS
  41. #include "arch/simsolaris/dbgSimsolarisLib.h"
  42. #endif  /* CPU_FAMILY == SIMSPARCSOLARIS */
  43. #if     CPU_FAMILY == SIMHPPA
  44. #include "arch/simhppa/dbgSimhppaLib.h"
  45. #endif  /* CPU_FAMILY == SIMHPPA */
  46. #if     CPU_FAMILY == SIMNT
  47. #include "arch/simnt/dbgSimntLib.h"
  48. #endif  /* CPU_FAMILY == SIMNT */
  49. #if     CPU_FAMILY==I80X86
  50. #include "arch/i86/dbgI86Lib.h"
  51. #endif  /* CPU_FAMILY==I80X86 */
  52. #if     CPU_FAMILY == ARM
  53. #include "arch/arm/dbgArmLib.h"
  54. #endif  /* CPU_FAMILY == ARM */
  55. #if     CPU_FAMILY == COLDFIRE
  56. #include "arch/coldfire/dbgColdfireLib.h"
  57. #endif  /* CPU_FAMILY == COLDFIRE */
  58. #if     CPU_FAMILY == SH
  59. #include "arch/sh/dbgShLib.h"
  60. #endif  /* CPU_FAMILY == SH */
  61. #ifndef _ASMLANGUAGE
  62. #include "wdb/dll.h"
  63. #include "wdb/wdbRegs.h"
  64. #include "esf.h"
  65. #include "private/vmLibP.h"
  66. #include "stddef.h"
  67. /* defines */
  68. #if     CPU_FAMILY==MIPS
  69. #define WDB_CTX_LOAD(pRegs) _wdbDbgCtxLoad(pRegs)
  70. #define WDB_CTX_SAVE(pRegs) _wdbDbgCtxSave(pRegs)
  71. extern void _wdbDbgCtxLoad();
  72. extern int _wdbDbgCtxSave();
  73. #endif  /* CPU_FAMILY==MIPS */
  74. #if     CPU_FAMILY==SIMHPPA
  75. #define WDB_CTX_LOAD(pRegs) _wdbDbgCtxLoad(pRegs)
  76. extern void _wdbDbgCtxLoad();
  77. #endif  /* CPU_FAMILY==SIMHPPA */
  78. #ifndef WDB_CTX_LOAD
  79. #define WDB_CTX_LOAD(pRegs) _sigCtxLoad(pRegs)
  80. #endif  /* WDB_CTX_LOAD */
  81. #ifndef WDB_CTX_SAVE
  82. #define WDB_CTX_SAVE(pRegs) _sigCtxSave(pRegs)
  83. #endif  /* WDB_CTX_SAVE */
  84. #define WDB_STEP        1
  85. #define WDB_STEP_OVER   2
  86. #define WDB_STEP_RANGE  4
  87. #define WDB_STEPING     (WDB_STEP | WDB_STEP_OVER | WDB_STEP_RANGE)
  88. #define WDB_CLEANME     8
  89. #define WDB_QUEUED      16
  90. #define WDB_TARGET      32
  91. #define WDB_STEP_TARGET (WDB_STEP | WDB_TARGET)
  92. #ifndef BRK_HARDMASK /* hardware breakpoint mask */
  93. #define BRK_HARDMASK    0x0
  94. #endif /* BRK_HARDMASK */
  95. #ifndef BRK_HARDWARE /* hardware breakpoint bit */
  96. #define BRK_HARDWARE    0x0
  97. #endif /*  BRK_HARDWARE*/
  98. #ifndef DBG_HARDWARE_BP /* support of hardware breakpoint */
  99. #define DBG_HARDWARE_BP 0
  100. #endif /* DBG_HARDWARE_BP */
  101. #ifndef DBG_NO_SINGLE_STEP /* trace mode (single step) support */
  102. #define DBG_NO_SINGLE_STEP 0
  103. #endif
  104. #define BP_INSTALLED 0x80000000 /* bp is installed */
  105. #define BP_HOST 0x40000000 /* host breakpoint */
  106. /* defines used only by the target shell debugger */
  107. #define BP_SO 0x08000000 /* step over (or cret) breakpoint */
  108. #define BP_STEP 0x04000000 /* step breakpoint */
  109. #define BP_EVENT 0x02000000 /* windview eventpoint */
  110. #if CPU==SIMNT
  111. extern void simTextLock(char *);
  112. extern void simTextUnlock(char *);
  113. #define TEXT_UNLOCK simTextUnlock
  114. #define TEXT_LOCK simTextLock
  115. #else /* CPU==SIMNT */
  116. #define TEXT_UNLOCK(addr) 
  117. {
  118. int pageSize = VM_PAGE_SIZE_GET(); 
  119. void * pageAddr = (void *) ((UINT) addr & ~(pageSize - 1)); 
  120. VM_TEXT_PAGE_PROTECT(pageAddr, FALSE); 
  121. }
  122. #define TEXT_LOCK(addr) 
  123. {
  124. int pageSize = VM_PAGE_SIZE_GET(); 
  125. void * pageAddr = (void *) ((UINT) addr & ~(pageSize - 1)); 
  126. VM_TEXT_PAGE_PROTECT(pageAddr, TRUE); 
  127. }
  128. #endif /* CPU==SIMNT */
  129. #define BP_SYS -1
  130. #define BP_ANY_TASK 0
  131. /* data types */
  132. typedef struct brkpt /* breakpoint structure */
  133.     {
  134.     dll_t bp_chain; /* breakpoint chain */
  135.     INSTR * bp_addr; /* breakpoint address */
  136.     INSTR bp_instr; /* instruction at breakpoint address */
  137.     int bp_task; /* breakpoint task */
  138.     unsigned bp_flags; /* breakpoint flags */
  139.     unsigned bp_count; /* breakpoint count */
  140.     unsigned bp_action; /* action associated with breakpoint */
  141.     void (*bp_callRtn)();/* routine to call (if any) */
  142.     int bp_callArg; /* called routine argument */
  143.     } BRKPT;
  144. #define STRUCT_BASE(s,m,p) ((s *)(void *)((char *)(p) - offsetof(s,m)))
  145. #define BP_BASE(p) (STRUCT_BASE(struct brkpt, bp_chain, (p)))
  146. /* global variable */
  147. extern dll_t bpList;
  148. extern dll_t bpFreeList;
  149. /* function declarations */
  150. #ifdef  __STDC__
  151. extern void wdbDbgArchInit (void);
  152. extern void wdbDbgBpListInit (void);
  153. extern STATUS wdbDbgBpFind (INSTR * pc, int context);
  154. extern void wdbDbgBpRemoveAll (void);
  155. extern STATUS wdbDbgBpRemove (BRKPT *pBp);
  156. extern BRKPT * wdbDbgBpAdd (INSTR * addr, int task, unsigned flags, 
  157. unsigned action, unsigned count, 
  158. FUNCPTR callRtn, int callArg);
  159. extern STATUS wdbDbgBpGet (INSTR * pc, int context, int type, BRKPT * pBp);
  160. extern int wdbDbgTraceModeSet (REG_SET * pRegs);
  161. extern void wdbDbgTraceModeClear (REG_SET * pRegs, int traceData);
  162. #if DBG_NO_SINGLE_STEP
  163. extern INSTR * wdbDbgGetNpc (REG_SET * pRegs);
  164. extern void wdbDbgTrap (INSTR * addr, REG_SET * pRegisters, void * pInfo, 
  165. void * pDbgRegSet, BOOL hardware);
  166. #else /* DBG_NO_SINGLE_STEP */
  167. extern void wdbDbgBreakpoint (void * pInfo, REG_SET * pRegisters, 
  168. void * pDbgRegSet, BOOL hardware);
  169. extern void wdbDbgTrace (void * pInfo, REG_SET * pRegisters);
  170. #endif /* DBG_NO_SINGLE_STEP */
  171. #if  DBG_HARDWARE_BP
  172. extern void wdbDbgRegsSet (DBG_REGS * pDbgReg);
  173. extern void wdbDbgRegsClear (void);
  174. extern STATUS wdbDbgHwBpSet (DBG_REGS * pDbgRegs, UINT32 type, UINT32 addr);
  175. extern STATUS wdbDbgHwBpFind (DBG_REGS *  pDbgRegs, UINT32 * pType, 
  176. UINT32 * pAddr);
  177. extern STATUS wdbDbgHwAddrCheck (UINT32 addr, UINT32 type, 
  178. FUNCPTR memProbeRtn);
  179. #endif  /* DBG_HARDWARE_BP */
  180. extern void dbgTaskBpTrap (int level, INSTR * addr, void * pInfo, 
  181. REG_SET * pRegisters,
  182. void * pDbgRegs, BOOL hardware);
  183. extern void dbgTaskBpTrace (int level, void * pInfo,
  184. REG_SET * pRegisters);
  185. extern void dbgTaskBpBreakpoint (int level, void * pInfo,
  186. REG_SET * pRegisters, 
  187. void * pDbgRegs, BOOL hardware);
  188. extern STATUS dbgTaskCont (UINT32 contextId);
  189. extern STATUS dbgTaskStep (UINT32 contextId, UINT32 startAddr, 
  190. UINT32 endAddr);
  191. extern void dbgTaskBpHooksInstall (void);
  192. extern void usrBreakpointSet (INSTR * addr, INSTR value);
  193. #else   /* __STDC__ */
  194. extern void wdbDbgArchInit();
  195. extern void wdbDbgBpListInit ();
  196. extern STATUS wdbDbgBpFind ();
  197. extern void wdbDbgBpRemove ();
  198. extern STATUS wdbDbgBpRemove ();
  199. extern void wdbDbgBpAdd ();
  200. extern STATUS wdbDbgBpGet ();
  201. extern int wdbDbgTraceModeSet ();
  202. extern void wdbDbgTraceModeClear ();
  203. #if DBG_NO_SINGLE_STEP
  204. extern INSTR * wdbDbgGetNpc ();
  205. extern void wdbDbgTrap ();
  206. #else /* DBG_NO_SINGLE_STEP */
  207. extern void wdbDbgBreakpoint ();
  208. extern void wdbDbgTrace ();
  209. #endif /* DBG_NO_SINGLE_STEP */
  210. #if  DBG_HARDWARE_BP
  211. extern void wdbDbgRegsSet ();
  212. extern void wdbDbgRegsClear ();
  213. exern STATUS wdbDbgBpSet ();
  214. extern STATUS wdbDbgHwBpFind ();
  215. extern STATUS wdbDbgHwAddrCheck ();
  216. #endif  /* DBG_HARDWARE_BP */
  217. extern void dbgTaskBpTrap ();
  218. extern void dbgTaskBpTrace ();
  219. extern void dbgTaskBpBreakpoint ();
  220. extern UINT32 dbgTaskCont ();
  221. extern UINT32 dbgTaskStep ();
  222. extern void dbgTaskBpHooksInstall ();
  223. extern void usrBreakpointSet ();
  224. #endif  /* __STDC__ */
  225. #endif  /* _ASMLANGUAGE */
  226. #ifdef __cplusplus
  227. }
  228. #endif
  229. #endif /* __INCwdbDbgLibh */