1 /* Low level child interface to ptrace.
3 Copyright (C) 2004-2021 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 #include "inf-child.h"
25 /* An abstract prototype ptrace target. The client can override it
26 with local methods. */
28 struct inf_ptrace_target
: public inf_child_target
30 ~inf_ptrace_target () override
= 0;
32 void attach (const char *, int) override
;
34 void detach (inferior
*inf
, int) override
;
36 void resume (ptid_t
, int, enum gdb_signal
) override
;
38 ptid_t
wait (ptid_t
, struct target_waitstatus
*, target_wait_flags
) override
;
40 void files_info () override
;
42 void kill () override
;
44 void create_inferior (const char *, const std::string
&,
45 char **, int) override
;
47 void mourn_inferior () override
;
49 bool thread_alive (ptid_t ptid
) override
;
51 std::string
pid_to_str (ptid_t
) override
;
53 enum target_xfer_status
xfer_partial (enum target_object object
,
56 const gdb_byte
*writebuf
,
57 ULONGEST offset
, ULONGEST len
,
58 ULONGEST
*xfered_len
) override
;
61 /* Cleanup the inferior after a successful ptrace detach. */
62 void detach_success (inferior
*inf
);
66 /* Return which PID to pass to ptrace in order to observe/control the
67 tracee identified by PTID.
69 Unlike most other Operating Systems, NetBSD tracks both pid and lwp
70 and avoids this function. */
72 extern pid_t
get_ptrace_pid (ptid_t
);