1 1.1 christos /* Internal interfaces for the NetBSD code. 2 1.1 christos 3 1.1.1.3 christos Copyright (C) 2006-2024 Free Software Foundation, Inc. 4 1.1 christos 5 1.1 christos This file is part of GDB. 6 1.1 christos 7 1.1 christos This program is free software; you can redistribute it and/or modify 8 1.1 christos it under the terms of the GNU General Public License as published by 9 1.1 christos the Free Software Foundation; either version 3 of the License, or 10 1.1 christos (at your option) any later version. 11 1.1 christos 12 1.1 christos This program is distributed in the hope that it will be useful, 13 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of 14 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 1.1 christos GNU General Public License for more details. 16 1.1 christos 17 1.1 christos You should have received a copy of the GNU General Public License 18 1.1 christos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19 1.1 christos 20 1.1 christos #ifndef NAT_NETBSD_NAT_H 21 1.1 christos #define NAT_NETBSD_NAT_H 22 1.1 christos 23 1.1 christos #include "gdbsupport/function-view.h" 24 1.1 christos 25 1.1 christos #include <unistd.h> 26 1.1 christos 27 1.1 christos namespace netbsd_nat 28 1.1 christos { 29 1.1 christos 30 1.1 christos /* Return the executable file name of a process specified by PID. Returns the 31 1.1 christos string in a static buffer. */ 32 1.1 christos 33 1.1 christos extern const char *pid_to_exec_file (pid_t pid); 34 1.1 christos 35 1.1 christos /* Return true if PTID is still active in the inferior. */ 36 1.1 christos 37 1.1 christos extern bool thread_alive (ptid_t ptid); 38 1.1 christos 39 1.1 christos /* Return the name assigned to a thread by an application. Returns 40 1.1 christos the string in a static buffer. 41 1.1 christos 42 1.1 christos This function assumes internally that the queried process is stopped. */ 43 1.1 christos 44 1.1 christos extern const char *thread_name (ptid_t ptid); 45 1.1 christos 46 1.1 christos /* A generic thread lister within a specific PID. The CALLBACK parameter 47 1.1 christos is a C++ function that is called for each detected thread. 48 1.1 christos 49 1.1 christos This function assumes internally that the queried process is stopped. */ 50 1.1 christos 51 1.1 christos extern void for_each_thread (pid_t pid, 52 1.1 christos gdb::function_view<void (ptid_t)> callback); 53 1.1 christos 54 1.1 christos /* Enable additional event reporting in a new process specified by PID. 55 1.1 christos 56 1.1 christos This function assumes internally that the queried process is stopped and 57 1.1 christos traced. */ 58 1.1 christos 59 1.1 christos extern void enable_proc_events (pid_t pid); 60 1.1 christos 61 1.1 christos /* Implement reading and writing of inferior's siginfo_t specified by PID. 62 1.1 christos Returns -1 on failure and the number of bytes on a successful transfer. 63 1.1 christos 64 1.1 christos This function assumes internally that the queried process is stopped and 65 1.1 christos traced. */ 66 1.1 christos 67 1.1 christos extern int qxfer_siginfo (pid_t pid, const char *annex, unsigned char *readbuf, 68 1.1 christos unsigned const char *writebuf, CORE_ADDR offset, 69 1.1 christos int len); 70 1.1.1.2 christos 71 1.1.1.2 christos /* Write gdb's LEN bytes from WRITEBUF and copy it to OFFSET in inferior 72 1.1.1.2 christos process' address space. The inferior is specified by PID. 73 1.1.1.2 christos Returns 0 on success or errno on failure and the number of bytes 74 1.1.1.2 christos on a successful transfer in XFERED_LEN. 75 1.1.1.2 christos 76 1.1.1.2 christos This function assumes internally that the queried process is stopped and 77 1.1.1.2 christos traced. */ 78 1.1.1.2 christos 79 1.1.1.2 christos extern int write_memory (pid_t pid, unsigned const char *writebuf, 80 1.1.1.2 christos CORE_ADDR offset, size_t len, size_t *xfered_len); 81 1.1.1.2 christos 82 1.1.1.2 christos /* Read inferior process's LEN bytes from OFFSET and copy it to WRITEBUF in 83 1.1.1.2 christos gdb's address space. 84 1.1.1.2 christos Returns 0 on success or errno on failure and the number of bytes 85 1.1.1.2 christos on a successful transfer in XFERED_LEN. 86 1.1.1.2 christos 87 1.1.1.2 christos This function assumes internally that the queried process is stopped and 88 1.1.1.2 christos traced. */ 89 1.1.1.2 christos 90 1.1.1.2 christos extern int read_memory (pid_t pid, unsigned char *readbuf, CORE_ADDR offset, 91 1.1.1.2 christos size_t len, size_t *xfered_len); 92 1.1 christos } 93 1.1 christos 94 1.1 christos #endif 95