sim-watch.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* Simulator watchpoint support.
  2. Copyright (C) 1997-2015 Free Software Foundation, Inc.
  3. Contributed by Cygnus Support.
  4. This file is part of GDB, the GNU debugger.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  15. #ifndef SIM_WATCH_H
  16. #define SIM_WATCH_H
  17. typedef enum {
  18. invalid_watchpoint = -1,
  19. pc_watchpoint,
  20. clock_watchpoint,
  21. cycles_watchpoint,
  22. nr_watchpoint_types,
  23. } watchpoint_type;
  24. typedef struct _sim_watch_point sim_watch_point;
  25. struct _sim_watch_point {
  26. int ident;
  27. watchpoint_type type;
  28. int interrupt_nr; /* == nr_interrupts -> breakpoint */
  29. int is_periodic;
  30. int is_within;
  31. unsigned long arg0;
  32. unsigned long arg1;
  33. sim_event *event;
  34. sim_watch_point *next;
  35. };
  36. typedef struct _sim_watchpoints {
  37. /* Pointer into the host's data structures specifying the
  38. address/size of the program-counter */
  39. /* FIXME: In the future this shall be generalized so that any of the
  40. N processors M registers can be watched */
  41. void *pc;
  42. int sizeof_pc;
  43. /* Pointer to the handler for interrupt watchpoints */
  44. /* FIXME: can this be done better? */
  45. /* NOTE: For the DATA arg, the handler is passed a (char**) pointer
  46. that is an offset into the INTERRUPT_NAMES vector. Use
  47. arithmetic to determine the interrupt-nr. */
  48. sim_event_handler *interrupt_handler;
  49. /* Pointer to a null terminated list of interrupt names */
  50. /* FIXME: can this be done better? Look at the PPC's interrupt
  51. mechanism and table for a rough idea of where it will go next */
  52. int nr_interrupts;
  53. const char **interrupt_names;
  54. /* active watchpoints */
  55. int last_point_nr;
  56. sim_watch_point *points;
  57. } sim_watchpoints;
  58. /* Watch install handler. */
  59. MODULE_INSTALL_FN sim_watchpoint_install;
  60. #endif /* SIM_WATCH_H */