Commit | Line | Data |
---|---|---|
91f83b02 | 1 | /* Base/prototype target for default child (native) targets. |
5bf970f9 | 2 | |
e2882c85 | 3 | Copyright (C) 2004-2018 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" |
5bf970f9 | 24 | |
f6ac5f3d PA |
25 | /* A prototype child target. The client can override it with local |
26 | methods. */ | |
5bf970f9 | 27 | |
f6ac5f3d PA |
28 | class inf_child_target |
29 | : public memory_breakpoint_target<target_ops> | |
30 | { | |
31 | public: | |
32 | inf_child_target (); | |
33 | ~inf_child_target () override = 0; | |
dab06dbe | 34 | |
f6ac5f3d PA |
35 | const char *shortname () override |
36 | { return "native"; } | |
37 | ||
38 | const char *longname () override | |
39 | { return _("Native process"); } | |
40 | ||
41 | const char *doc () override | |
42 | { return _("Native process (started by the \"run\" command)."); } | |
43 | ||
44 | void open (const char *arg, int from_tty) override; | |
45 | void close () override; | |
46 | ||
47 | void disconnect (const char *, int) override; | |
48 | ||
49 | void fetch_registers (struct regcache *, int) override = 0; | |
50 | void store_registers (struct regcache *, int) override = 0; | |
51 | ||
52 | void prepare_to_store (struct regcache *) override; | |
53 | ||
54 | bool supports_terminal_ours () override; | |
55 | void terminal_init () override; | |
56 | void terminal_inferior () override; | |
57 | void terminal_ours_for_output () override; | |
58 | void terminal_ours () override; | |
59 | void terminal_info (const char *, int) override; | |
60 | ||
61 | void interrupt () override; | |
62 | void pass_ctrlc () override; | |
dab06dbe | 63 | |
f6ac5f3d | 64 | void post_startup_inferior (ptid_t) override; |
6a3cb8e8 | 65 | |
f6ac5f3d | 66 | void mourn_inferior () override; |
6a3cb8e8 | 67 | |
f6ac5f3d | 68 | int can_run () override; |
c1ee2fb3 | 69 | |
f6ac5f3d PA |
70 | bool can_create_inferior () override; |
71 | void create_inferior (const char *, const std::string &, | |
72 | char **, int) override = 0; | |
c1ee2fb3 | 73 | |
f6ac5f3d PA |
74 | bool can_attach () override; |
75 | void attach (const char *, int) override = 0; | |
6a3cb8e8 | 76 | |
f6ac5f3d PA |
77 | void post_attach (int) override; |
78 | ||
79 | /* We must default these because they must be implemented by any | |
80 | target that can run. */ | |
81 | int can_async_p () override { return 0; } | |
82 | int supports_non_stop () override { return 0; } | |
83 | int supports_disable_randomization () override { return 0; } | |
84 | ||
85 | char *pid_to_exec_file (int pid) override; | |
86 | ||
87 | int has_all_memory () override; | |
88 | int has_memory () override; | |
89 | int has_stack () override; | |
90 | int has_registers () override; | |
91 | int has_execution (ptid_t) override; | |
92 | ||
93 | int fileio_open (struct inferior *inf, const char *filename, | |
94 | int flags, int mode, int warn_if_slow, | |
95 | int *target_errno) override; | |
96 | int fileio_pwrite (int fd, const gdb_byte *write_buf, int len, | |
97 | ULONGEST offset, int *target_errno) override; | |
98 | int fileio_pread (int fd, gdb_byte *read_buf, int len, | |
99 | ULONGEST offset, int *target_errno) override; | |
100 | int fileio_fstat (int fd, struct stat *sb, int *target_errno) override; | |
101 | int fileio_close (int fd, int *target_errno) override; | |
102 | int fileio_unlink (struct inferior *inf, | |
103 | const char *filename, | |
104 | int *target_errno) override; | |
105 | gdb::optional<std::string> fileio_readlink (struct inferior *inf, | |
106 | const char *filename, | |
107 | int *target_errno) override; | |
108 | int use_agent (int use) override; | |
109 | ||
110 | int can_use_agent () override; | |
111 | ||
112 | protected: | |
113 | /* Unpush the target if it wasn't explicitly open with "target native" | |
114 | and there are no live inferiors left. Note: if calling this as a | |
115 | result of a mourn or detach, the current inferior shall already | |
116 | have its PID cleared, so it isn't counted as live. That's usually | |
117 | done by calling either generic_mourn_inferior or | |
118 | detach_inferior. */ | |
119 | void maybe_unpush_target (); | |
120 | }; | |
121 | ||
122 | /* Functions for helping to write a native target. */ | |
123 | ||
124 | /* This is for native targets which use a unix/POSIX-style waitstatus. */ | |
125 | extern void store_waitstatus (struct target_waitstatus *, int); | |
6a3cb8e8 | 126 | |
5bf970f9 | 127 | #endif |