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

VxWorks

开发平台:

C/C++

  1. /* usrBreakpoint.c - user configurable breakpoint management */
  2. /* Copyright 1998 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01a,13jan98,dbt  written.
  7. */
  8. /*
  9. DESCRIPTION
  10. This file contains user configurable breakpoint management routines used 
  11. by target shell debugger and WDB debugger.
  12. This file is included by usrConfig.c.
  13. SEE ALSO: usrExtra.c
  14. NOMANUAL
  15. */
  16. /* includes */
  17. /******************************************************************************
  18. *
  19. * usrBreakpointSet - set a text breakpoint.
  20. *
  21. * This routine is used by both target shell and WDB debuggers to set a 
  22. * text breakpoint in memory.
  23. * This routine can be modified by the user to set a breakpoint differently
  24. * (for example to set a text breakpoint in a ROM emulator).
  25. *
  26. * RETURNS : NA
  27. *
  28. * NOMANUAL
  29. */ 
  30. void usrBreakpointSet
  31.     (
  32.     INSTR * addr, /* breakpoint address */
  33.     INSTR  value /* breakpoint instruction */
  34.     )
  35.     {
  36.     void * pageAddr; /* page address */
  37.     int pageSize; /* page size */
  38.     if ( addr == (INSTR *)NULL )
  39.         return; /* no error messages available! */
  40.     pageSize = VM_PAGE_SIZE_GET();
  41.     pageAddr = (void *) ((UINT) addr & ~(pageSize - 1));
  42.     VM_TEXT_PAGE_PROTECT(pageAddr, FALSE);
  43.     *addr = value;
  44.     VM_TEXT_PAGE_PROTECT(pageAddr, TRUE);
  45.     CACHE_TEXT_UPDATE (addr, sizeof (INSTR));
  46.     }