Commit | Line | Data |
---|---|---|
91f83b02 | 1 | /* Base/prototype target for default child (native) targets. |
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_CHILD_H | |
21 | #define INF_CHILD_H | |
22 | ||
f6ac5f3d | 23 | #include "target.h" |
3b3dac9b | 24 | #include "process-stratum-target.h" |
5bf970f9 | 25 | |
f6ac5f3d PA |
26 | /* A prototype child target. The client can override it with local |
27 | methods. */ | |
5bf970f9 | 28 | |
f6ac5f3d | 29 | class inf_child_target |
3b3dac9b | 30 | : public memory_breakpoint_target<process_stratum_target> |
f6ac5f3d PA |
31 | { |
32 | public: | |
3b3dac9b | 33 | inf_child_target () = default; |
f6ac5f3d | 34 | ~inf_child_target () override = 0; |
dab06dbe | 35 | |
d9f719f1 | 36 | const target_info &info () const override; |
f6ac5f3d | 37 | |
f6ac5f3d PA |
38 | void close () override; |
39 | ||
40 | void disconnect (const char *, int) override; | |
41 | ||
42 | void fetch_registers (struct regcache *, int) override = 0; | |
43 | void store_registers (struct regcache *, int) override = 0; | |
44 | ||
45 | void prepare_to_store (struct regcache *) override; | |
46 | ||
47 | bool supports_terminal_ours () override; | |
48 | void terminal_init () override; | |
49 | void terminal_inferior () override; | |
ae739fe7 | 50 | void terminal_save_inferior () override; |
f6ac5f3d PA |
51 | void terminal_ours_for_output () override; |
52 | void terminal_ours () override; | |
53 | void terminal_info (const char *, int) override; | |
54 | ||
55 | void interrupt () override; | |
56 | void pass_ctrlc () override; | |
dab06dbe | 57 | |
f6ac5f3d | 58 | void post_startup_inferior (ptid_t) override; |
6a3cb8e8 | 59 | |
f6ac5f3d | 60 | void mourn_inferior () override; |
6a3cb8e8 | 61 | |
57810aa7 | 62 | bool can_run () override; |
c1ee2fb3 | 63 | |
f6ac5f3d PA |
64 | bool can_create_inferior () override; |
65 | void create_inferior (const char *, const std::string &, | |
66 | char **, int) override = 0; | |
c1ee2fb3 | 67 | |
f6ac5f3d PA |
68 | bool can_attach () override; |
69 | void attach (const char *, int) override = 0; | |
6a3cb8e8 | 70 | |
f6ac5f3d PA |
71 | void post_attach (int) override; |
72 | ||
f6ac5f3d PA |
73 | char *pid_to_exec_file (int pid) override; |
74 | ||
f6ac5f3d PA |
75 | int fileio_open (struct inferior *inf, const char *filename, |
76 | int flags, int mode, int warn_if_slow, | |
77 | int *target_errno) override; | |
78 | int fileio_pwrite (int fd, const gdb_byte *write_buf, int len, | |
79 | ULONGEST offset, int *target_errno) override; | |
80 | int fileio_pread (int fd, gdb_byte *read_buf, int len, | |
81 | ULONGEST offset, int *target_errno) override; | |
82 | int fileio_fstat (int fd, struct stat *sb, int *target_errno) override; | |
83 | int fileio_close (int fd, int *target_errno) override; | |
84 | int fileio_unlink (struct inferior *inf, | |
85 | const char *filename, | |
86 | int *target_errno) override; | |
87 | gdb::optional<std::string> fileio_readlink (struct inferior *inf, | |
88 | const char *filename, | |
89 | int *target_errno) override; | |
57810aa7 | 90 | bool use_agent (bool use) override; |
f6ac5f3d | 91 | |
57810aa7 | 92 | bool can_use_agent () override; |
f6ac5f3d PA |
93 | |
94 | protected: | |
95 | /* Unpush the target if it wasn't explicitly open with "target native" | |
96 | and there are no live inferiors left. Note: if calling this as a | |
97 | result of a mourn or detach, the current inferior shall already | |
98 | have its PID cleared, so it isn't counted as live. That's usually | |
99 | done by calling either generic_mourn_inferior or | |
100 | detach_inferior. */ | |
101 | void maybe_unpush_target (); | |
102 | }; | |
103 | ||
104 | /* Functions for helping to write a native target. */ | |
105 | ||
106 | /* This is for native targets which use a unix/POSIX-style waitstatus. */ | |
107 | extern void store_waitstatus (struct target_waitstatus *, int); | |
6a3cb8e8 | 108 | |
d9f719f1 PA |
109 | /* Register TARGET as native target and set it up to respond to the |
110 | "target native" command. */ | |
111 | extern void add_inf_child_target (inf_child_target *target); | |
112 | ||
113 | /* target_open_ftype callback for inf-child targets. Used by targets | |
114 | that want to register an alternative target_info object. Most | |
115 | targets use add_inf_child_target instead. */ | |
116 | extern void inf_child_open_target (const char *arg, int from_tty); | |
117 | ||
5bf970f9 | 118 | #endif |