netbsd-low.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /* Copyright (C) 2020-2022 Free Software Foundation, Inc.
  2. This file is part of GDB.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. #ifndef GDBSERVER_NETBSD_LOW_H
  14. #define GDBSERVER_NETBSD_LOW_H
  15. struct regcache;
  16. struct target_desc;
  17. /* Some information relative to a given register set. */
  18. struct netbsd_regset_info
  19. {
  20. /* The ptrace request needed to get/set registers of this set. */
  21. int get_request, set_request;
  22. /* The size of the register set. */
  23. int size;
  24. /* Fill the buffer BUF from the contents of the given REGCACHE. */
  25. void (*fill_function) (struct regcache *regcache, char *buf);
  26. /* Store the register value in BUF in the given REGCACHE. */
  27. void (*store_function) (struct regcache *regcache, const char *buf);
  28. };
  29. /* Target ops definitions for a NetBSD target. */
  30. class netbsd_process_target : public process_stratum_target
  31. {
  32. public:
  33. int create_inferior (const char *program,
  34. const std::vector<char *> &program_args) override;
  35. void post_create_inferior () override;
  36. int attach (unsigned long pid) override;
  37. int kill (process_info *proc) override;
  38. int detach (process_info *proc) override;
  39. void mourn (process_info *proc) override;
  40. void join (int pid) override;
  41. bool thread_alive (ptid_t pid) override;
  42. void resume (thread_resume *resume_info, size_t n) override;
  43. ptid_t wait (ptid_t ptid, target_waitstatus *status,
  44. target_wait_flags options) override;
  45. void fetch_registers (regcache *regcache, int regno) override;
  46. void store_registers (regcache *regcache, int regno) override;
  47. int read_memory (CORE_ADDR memaddr, unsigned char *myaddr,
  48. int len) override;
  49. int write_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
  50. int len) override;
  51. void request_interrupt () override;
  52. bool supports_read_auxv () override;
  53. int read_auxv (CORE_ADDR offset, unsigned char *myaddr,
  54. unsigned int len) override;
  55. bool supports_hardware_single_step () override;
  56. const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
  57. bool supports_z_point_type (char z_type) override;
  58. int insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
  59. int size, struct raw_breakpoint *bp) override;
  60. int remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
  61. int size, struct raw_breakpoint *bp) override;
  62. bool stopped_by_sw_breakpoint () override;
  63. bool supports_qxfer_siginfo () override;
  64. int qxfer_siginfo (const char *annex, unsigned char *readbuf,
  65. unsigned const char *writebuf, CORE_ADDR offset,
  66. int len) override;
  67. bool supports_stopped_by_sw_breakpoint () override;
  68. bool supports_non_stop () override;
  69. bool supports_multi_process () override;
  70. bool supports_fork_events () override;
  71. bool supports_vfork_events () override;
  72. bool supports_exec_events () override;
  73. bool supports_disable_randomization () override;
  74. bool supports_qxfer_libraries_svr4 () override;
  75. int qxfer_libraries_svr4 (const char*, unsigned char*, const unsigned char*,
  76. CORE_ADDR, int) override;
  77. bool supports_pid_to_exec_file () override;
  78. const char *pid_to_exec_file (int pid) override;
  79. const char *thread_name (ptid_t thread) override;
  80. bool supports_catch_syscall () override;
  81. protected:
  82. /* The architecture-specific "low" methods are listed below. */
  83. /* Return the information to access registers. */
  84. virtual const netbsd_regset_info *get_regs_info () = 0;
  85. /* Architecture-specific setup for the current process. */
  86. virtual void low_arch_setup () = 0;
  87. };
  88. extern netbsd_process_target *the_netbsd_target;
  89. #endif /* GDBSERVER_NETBSD_LOW_H */