1*64f917f5Schristos /* Copyright (C) 2020-2024 Free Software Foundation, Inc. 28dffb485Schristos 38dffb485Schristos This file is part of GDB. 48dffb485Schristos 58dffb485Schristos This program is free software; you can redistribute it and/or modify 68dffb485Schristos it under the terms of the GNU General Public License as published by 78dffb485Schristos the Free Software Foundation; either version 3 of the License, or 88dffb485Schristos (at your option) any later version. 98dffb485Schristos 108dffb485Schristos This program is distributed in the hope that it will be useful, 118dffb485Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 128dffb485Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 138dffb485Schristos GNU General Public License for more details. 148dffb485Schristos 158dffb485Schristos You should have received a copy of the GNU General Public License 168dffb485Schristos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 178dffb485Schristos 188dffb485Schristos #ifndef GDBSERVER_NETBSD_LOW_H 198dffb485Schristos #define GDBSERVER_NETBSD_LOW_H 208dffb485Schristos 218dffb485Schristos struct regcache; 228dffb485Schristos struct target_desc; 238dffb485Schristos 248dffb485Schristos /* Some information relative to a given register set. */ 258dffb485Schristos 268dffb485Schristos struct netbsd_regset_info 278dffb485Schristos { 288dffb485Schristos /* The ptrace request needed to get/set registers of this set. */ 298dffb485Schristos int get_request, set_request; 308dffb485Schristos /* The size of the register set. */ 318dffb485Schristos int size; 328dffb485Schristos /* Fill the buffer BUF from the contents of the given REGCACHE. */ 338dffb485Schristos void (*fill_function) (struct regcache *regcache, char *buf); 348dffb485Schristos /* Store the register value in BUF in the given REGCACHE. */ 358dffb485Schristos void (*store_function) (struct regcache *regcache, const char *buf); 368dffb485Schristos }; 378dffb485Schristos 388dffb485Schristos /* Target ops definitions for a NetBSD target. */ 398dffb485Schristos 408dffb485Schristos class netbsd_process_target : public process_stratum_target 418dffb485Schristos { 428dffb485Schristos public: 438dffb485Schristos 448dffb485Schristos int create_inferior (const char *program, 458dffb485Schristos const std::vector<char *> &program_args) override; 468dffb485Schristos 478dffb485Schristos void post_create_inferior () override; 488dffb485Schristos 498dffb485Schristos int attach (unsigned long pid) override; 508dffb485Schristos 518dffb485Schristos int kill (process_info *proc) override; 528dffb485Schristos 538dffb485Schristos int detach (process_info *proc) override; 548dffb485Schristos 558dffb485Schristos void mourn (process_info *proc) override; 568dffb485Schristos 578dffb485Schristos void join (int pid) override; 588dffb485Schristos 598dffb485Schristos bool thread_alive (ptid_t pid) override; 608dffb485Schristos 618dffb485Schristos void resume (thread_resume *resume_info, size_t n) override; 628dffb485Schristos 638dffb485Schristos ptid_t wait (ptid_t ptid, target_waitstatus *status, 644b169a6bSchristos target_wait_flags options) override; 658dffb485Schristos 668dffb485Schristos void fetch_registers (regcache *regcache, int regno) override; 678dffb485Schristos 688dffb485Schristos void store_registers (regcache *regcache, int regno) override; 698dffb485Schristos 708dffb485Schristos int read_memory (CORE_ADDR memaddr, unsigned char *myaddr, 718dffb485Schristos int len) override; 728dffb485Schristos 738dffb485Schristos int write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, 748dffb485Schristos int len) override; 758dffb485Schristos 768dffb485Schristos void request_interrupt () override; 778dffb485Schristos 788dffb485Schristos bool supports_read_auxv () override; 798dffb485Schristos 80*64f917f5Schristos int read_auxv (int pid, CORE_ADDR offset, unsigned char *myaddr, 818dffb485Schristos unsigned int len) override; 828dffb485Schristos 838dffb485Schristos bool supports_hardware_single_step () override; 848dffb485Schristos 858dffb485Schristos const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; 868dffb485Schristos 878dffb485Schristos bool supports_z_point_type (char z_type) override; 888dffb485Schristos 898dffb485Schristos int insert_point (enum raw_bkpt_type type, CORE_ADDR addr, 908dffb485Schristos int size, struct raw_breakpoint *bp) override; 918dffb485Schristos 928dffb485Schristos int remove_point (enum raw_bkpt_type type, CORE_ADDR addr, 938dffb485Schristos int size, struct raw_breakpoint *bp) override; 948dffb485Schristos 958dffb485Schristos bool stopped_by_sw_breakpoint () override; 968dffb485Schristos 978dffb485Schristos bool supports_qxfer_siginfo () override; 988dffb485Schristos 998dffb485Schristos int qxfer_siginfo (const char *annex, unsigned char *readbuf, 1008dffb485Schristos unsigned const char *writebuf, CORE_ADDR offset, 1018dffb485Schristos int len) override; 1028dffb485Schristos 1038dffb485Schristos bool supports_stopped_by_sw_breakpoint () override; 1048dffb485Schristos 1058dffb485Schristos bool supports_non_stop () override; 1068dffb485Schristos 1078dffb485Schristos bool supports_multi_process () override; 1088dffb485Schristos 1098dffb485Schristos bool supports_fork_events () override; 1108dffb485Schristos 1118dffb485Schristos bool supports_vfork_events () override; 1128dffb485Schristos 1138dffb485Schristos bool supports_exec_events () override; 1148dffb485Schristos 1158dffb485Schristos bool supports_disable_randomization () override; 1168dffb485Schristos 1178dffb485Schristos bool supports_qxfer_libraries_svr4 () override; 1188dffb485Schristos 1198dffb485Schristos int qxfer_libraries_svr4 (const char*, unsigned char*, const unsigned char*, 1208dffb485Schristos CORE_ADDR, int) override; 1218dffb485Schristos 1228dffb485Schristos bool supports_pid_to_exec_file () override; 1238dffb485Schristos 1244b169a6bSchristos const char *pid_to_exec_file (int pid) override; 1258dffb485Schristos 1268dffb485Schristos const char *thread_name (ptid_t thread) override; 1278dffb485Schristos 1288dffb485Schristos bool supports_catch_syscall () override; 1294b169a6bSchristos 1304b169a6bSchristos protected: 1314b169a6bSchristos /* The architecture-specific "low" methods are listed below. */ 1324b169a6bSchristos 1334b169a6bSchristos /* Return the information to access registers. */ 1344b169a6bSchristos virtual const netbsd_regset_info *get_regs_info () = 0; 1354b169a6bSchristos 1364b169a6bSchristos /* Architecture-specific setup for the current process. */ 1374b169a6bSchristos virtual void low_arch_setup () = 0; 1388dffb485Schristos }; 1398dffb485Schristos 1404b169a6bSchristos extern netbsd_process_target *the_netbsd_target; 1418dffb485Schristos 1428dffb485Schristos #endif /* GDBSERVER_NETBSD_LOW_H */ 143