arch_gdb.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * ARM GDB support
  3. * arch-specific portion of GDB stub
  4. *
  5. * File : arch_gdb.h(arm)
  6. * This file is part of RT-Thread RTOS
  7. * COPYRIGHT (C) 2006, RT-Thread Develop Team
  8. *
  9. * The license and distribution terms for this file may be
  10. * found in the file LICENSE in this distribution or at
  11. * http://www.rt-thread.org/license/LICENSE
  12. *
  13. * Change Logs:
  14. * Date Author Notes
  15. * 2014-07-04 wzyy2 first version
  16. */
  17. #ifndef __ARM_GDB_H__
  18. #define __ARM_GDB_H__
  19. #include <rtthread.h>
  20. #ifndef RT_GDB_HAVE_HWBP
  21. #define RT_GDB_HAVE_HWBP 0
  22. #endif
  23. #ifndef RT_GDB_HAVE_SWBP
  24. #define RT_GDB_HAVE_SWBP 1
  25. #endif
  26. #if RT_GDB_HAVE_HWBP
  27. #error GDB:No hardware_breakpoint support
  28. #endif
  29. /*
  30. * By doing this as an undefined instruction trap, we force a mode
  31. * switch from SVC to UND mode, allowing us to save full kernel state.
  32. * We also define a GDB_COMPILED_BREAK which can be used to compile
  33. * in breakpoints.
  34. */
  35. #define BREAK_INSTR_SIZE 4
  36. #define GDB_BREAKINST 0xe7ffdefe
  37. #define GDB_COMPILED_BREAK 0xe7ffdeff
  38. #define CACHE_FLUSH_IS_SAFE 1
  39. #define ARM_GP_REGS 16
  40. #define ARM_FP_REGS 8
  41. #define ARM_EXTRA_REGS 2
  42. #define GDB_MAX_REGS (ARM_GP_REGS + (ARM_FP_REGS * 3) + ARM_EXTRA_REGS)
  43. #define NUMREGBYTES (GDB_MAX_REGS << 2)
  44. //#define BUFMAX ((NUMREGBYTES << 1) + 10)
  45. #define BUFMAX 400
  46. enum regnames {
  47. GDB_R0, /*0*/
  48. GDB_R1, /*1*/
  49. GDB_R2, /*2*/
  50. GDB_R3, /*3*/
  51. GDB_R4, /*4*/
  52. GDB_R5, /*5*/
  53. GDB_R6, /*6*/
  54. GDB_R7, /*7*/
  55. GDB_R8, /*8*/
  56. GDB_R9, /*9*/
  57. GDB_R10, /*10*/
  58. GDB_FP, /*11*/
  59. GDB_IP, /*12*/
  60. GDB_SPT, /*13*/
  61. GDB_LR, /*14*/
  62. GDB_PC, /*15*/
  63. GDB_CPSR = GDB_MAX_REGS-1
  64. };
  65. /* arch */
  66. extern struct gdb_arch arch_gdb_ops;
  67. void gdb_breakpoint();
  68. void gdb_get_register(unsigned long *gdb_regs);
  69. void gdb_put_register(unsigned long *gdb_regs);
  70. void gdb_set_register(void *hw_regs);
  71. int gdb_arch_handle_exception(char *remcom_in_buffer,
  72. char *remcom_out_buffer);
  73. void gdb_flush_icache_range(unsigned long start, unsigned long end);
  74. int gdb_undef_hook(void *regs);
  75. int gdb_handle_exception(int signo, void *regs);
  76. #endif /* __ARM_GDB_H__ */