Commit | Line | Data |
---|---|---|
8785ced0 | 1 | /* Low level child interface to ptrace. |
5bf970f9 | 2 | |
42a4f53d | 3 | Copyright (C) 2004-2019 Free Software Foundation, Inc. |
5bf970f9 AC |
4 | |
5 | This file is part of GDB. | |
6 | ||
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 | |
a9762ec7 | 9 | the Free Software Foundation; either version 3 of the License, or |
5bf970f9 AC |
10 | (at your option) any later version. |
11 | ||
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. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
a9762ec7 | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
5bf970f9 AC |
19 | |
20 | #ifndef INF_PTRACE_H | |
21 | #define INF_PTRACE_H | |
22 | ||
f6ac5f3d | 23 | #include "inf-child.h" |
5bf970f9 | 24 | |
f6ac5f3d PA |
25 | /* An abstract prototype ptrace target. The client can override it |
26 | with local methods. */ | |
5bf970f9 | 27 | |
f6ac5f3d PA |
28 | struct inf_ptrace_target : public inf_child_target |
29 | { | |
30 | ~inf_ptrace_target () override = 0; | |
8785ced0 | 31 | |
f6ac5f3d PA |
32 | void attach (const char *, int) override; |
33 | ||
34 | void detach (inferior *inf, int) override; | |
35 | ||
36 | void resume (ptid_t, int, enum gdb_signal) override; | |
37 | ||
38 | ptid_t wait (ptid_t, struct target_waitstatus *, int) override; | |
39 | ||
40 | void files_info () override; | |
41 | ||
42 | void kill () override; | |
43 | ||
44 | void create_inferior (const char *, const std::string &, | |
45 | char **, int) override; | |
46 | #ifdef PT_GET_PROCESS_STATE | |
47 | int follow_fork (int, int) override; | |
48 | ||
49 | int insert_fork_catchpoint (int) override; | |
50 | ||
51 | int remove_fork_catchpoint (int) override; | |
52 | ||
53 | void post_startup_inferior (ptid_t) override; | |
54 | ||
55 | void post_attach (int) override; | |
56 | #endif | |
57 | ||
58 | void mourn_inferior () override; | |
59 | ||
57810aa7 | 60 | bool thread_alive (ptid_t ptid) override; |
f6ac5f3d | 61 | |
a068643d | 62 | std::string pid_to_str (ptid_t) override; |
f6ac5f3d PA |
63 | |
64 | enum target_xfer_status xfer_partial (enum target_object object, | |
65 | const char *annex, | |
66 | gdb_byte *readbuf, | |
67 | const gdb_byte *writebuf, | |
68 | ULONGEST offset, ULONGEST len, | |
69 | ULONGEST *xfered_len) override; | |
70 | ||
71 | #if defined (PT_IO) && defined (PIOD_READ_AUXV) | |
72 | int auxv_parse (gdb_byte **readptr, | |
73 | gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp) override; | |
74 | #endif | |
75 | ||
76 | protected: | |
77 | /* Cleanup the inferior after a successful ptrace detach. */ | |
78 | void detach_success (inferior *inf); | |
79 | }; | |
8785ced0 | 80 | |
94309df7 JB |
81 | /* Return which PID to pass to ptrace in order to observe/control the |
82 | tracee identified by PTID. */ | |
83 | ||
84 | extern pid_t get_ptrace_pid (ptid_t); | |
85 | ||
5bf970f9 | 86 | #endif |