aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/netbsd-low.h
diff options
context:
space:
mode:
authorKamil Rytarowski <n54@gmx.com>2020-09-02 19:35:42 +0200
committerKamil Rytarowski <n54@gmx.com>2020-09-10 15:40:10 +0200
commit62ba50486f1146f0cfd33074fc127fe00a02e87e (patch)
tree85bf1a5ab4532bb4801f9aeb6d341481d5da4768 /gdbserver/netbsd-low.h
parentcf4ac4be12c311d387c8bce55f16f5ad3782d77c (diff)
downloadgdb-62ba50486f1146f0cfd33074fc127fe00a02e87e.zip
gdb-62ba50486f1146f0cfd33074fc127fe00a02e87e.tar.gz
gdb-62ba50486f1146f0cfd33074fc127fe00a02e87e.tar.bz2
Add minimal and functional NetBSD/amd64 gdbserver
Implement the following functionality: create_inferior, post_create_inferior, attach, kill, detach, mourn, join, thread_alive, resume, wait, fetch_registers, store_registers, read_memory, write_memory, request_interrupt, supports_read_auxv, read_auxv, supports_hardware_single_step, sw_breakpoint_from_kind, supports_z_point_type, insert_point, remove_point, stopped_by_sw_breakpoint, supports_qxfer_siginfo, qxfer_siginfo, supports_stopped_by_sw_breakpoint, supports_non_stop, supports_multi_process, supports_fork_events, supports_vfork_events, supports_exec_events, supports_disable_randomization, supports_qxfer_libraries_svr4, qxfer_libraries_svr4, supports_pid_to_exec_file, pid_to_exec_file, thread_name, supports_catch_syscall. The only CPU architecture supported: x86_64. Implement only support for hardware assisted single step and software breakpoint. Implement support only for regular X86 registers, thus no FPU. gdbserver/ChangeLog: * netbsd-low.cc: Add. * netbsd-low.h: Likewise. * netbsd-amd64-low.cc: Likewise. * Makefile.in (SFILES): Register "netbsd-low.cc", "netbsd-low.h", "netbsd-amd64-low.cc". * configure.srv: Add x86_64-*-netbsd*.
Diffstat (limited to 'gdbserver/netbsd-low.h')
-rw-r--r--gdbserver/netbsd-low.h154
1 files changed, 154 insertions, 0 deletions
diff --git a/gdbserver/netbsd-low.h b/gdbserver/netbsd-low.h
new file mode 100644
index 0000000..3d2ec34
--- /dev/null
+++ b/gdbserver/netbsd-low.h
@@ -0,0 +1,154 @@
+/* Copyright (C) 2020 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef GDBSERVER_NETBSD_LOW_H
+#define GDBSERVER_NETBSD_LOW_H
+
+struct regcache;
+struct target_desc;
+
+/* Some information relative to a given register set. */
+
+struct netbsd_regset_info
+{
+ /* The ptrace request needed to get/set registers of this set. */
+ int get_request, set_request;
+ /* The size of the register set. */
+ int size;
+ /* Fill the buffer BUF from the contents of the given REGCACHE. */
+ void (*fill_function) (struct regcache *regcache, char *buf);
+ /* Store the register value in BUF in the given REGCACHE. */
+ void (*store_function) (struct regcache *regcache, const char *buf);
+};
+
+/* A list of regsets for the target being debugged, terminated by an entry
+ where the size is negative.
+
+ This list should be created by the target-specific code. */
+
+extern struct netbsd_regset_info netbsd_target_regsets[];
+
+/* The target-specific operations for NetBSD support. */
+
+struct netbsd_target_ops
+{
+ /* Architecture-specific setup. */
+ void (*arch_setup) ();
+};
+
+/* Target ops definitions for a NetBSD target. */
+
+class netbsd_process_target : public process_stratum_target
+{
+public:
+
+ int create_inferior (const char *program,
+ const std::vector<char *> &program_args) override;
+
+ void post_create_inferior () override;
+
+ int attach (unsigned long pid) override;
+
+ int kill (process_info *proc) override;
+
+ int detach (process_info *proc) override;
+
+ void mourn (process_info *proc) override;
+
+ void join (int pid) override;
+
+ bool thread_alive (ptid_t pid) override;
+
+ void resume (thread_resume *resume_info, size_t n) override;
+
+ ptid_t wait (ptid_t ptid, target_waitstatus *status,
+ int options) override;
+
+ void fetch_registers (regcache *regcache, int regno) override;
+
+ void store_registers (regcache *regcache, int regno) override;
+
+ int read_memory (CORE_ADDR memaddr, unsigned char *myaddr,
+ int len) override;
+
+ int write_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
+ int len) override;
+
+ void request_interrupt () override;
+
+ bool supports_read_auxv () override;
+
+ int read_auxv (CORE_ADDR offset, unsigned char *myaddr,
+ unsigned int len) override;
+
+ bool supports_hardware_single_step () override;
+
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
+ bool supports_z_point_type (char z_type) override;
+
+ int insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
+ int size, struct raw_breakpoint *bp) override;
+
+ int remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
+ int size, struct raw_breakpoint *bp) override;
+
+ bool stopped_by_sw_breakpoint () override;
+
+ bool supports_qxfer_siginfo () override;
+
+ int qxfer_siginfo (const char *annex, unsigned char *readbuf,
+ unsigned const char *writebuf, CORE_ADDR offset,
+ int len) override;
+
+ bool supports_stopped_by_sw_breakpoint () override;
+
+ bool supports_non_stop () override;
+
+ bool supports_multi_process () override;
+
+ bool supports_fork_events () override;
+
+ bool supports_vfork_events () override;
+
+ bool supports_exec_events () override;
+
+ bool supports_disable_randomization () override;
+
+ bool supports_qxfer_libraries_svr4 () override;
+
+ int qxfer_libraries_svr4 (const char*, unsigned char*, const unsigned char*,
+ CORE_ADDR, int) override;
+
+ bool supports_pid_to_exec_file () override;
+
+ char *pid_to_exec_file (int pid) override;
+
+ const char *thread_name (ptid_t thread) override;
+
+ bool supports_catch_syscall () override;
+};
+
+/* The inferior's target description. This is a global because the
+ NetBSD ports support neither bi-arch nor multi-process. */
+
+extern struct netbsd_target_ops the_low_target;
+
+/* XXX: multilib */
+extern const struct target_desc *netbsd_tdesc;
+
+#endif /* GDBSERVER_NETBSD_LOW_H */