GDB (xrefs)
Loading...
Searching...
No Matches
inf-child.h
Go to the documentation of this file.
1/* Base/prototype target for default child (native) targets.
2
3 Copyright (C) 2004-2023 Free Software Foundation, Inc.
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
9 the Free Software Foundation; either version 3 of the License, or
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
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#ifndef INF_CHILD_H
21#define INF_CHILD_H
22
23#include "target.h"
25
26/* A prototype child target. The client can override it with local
27 methods. */
28
30 : public memory_breakpoint_target<process_stratum_target>
31{
32public:
33 inf_child_target () = default;
34 ~inf_child_target () override = 0;
35
36 const target_info &info () const override;
37
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;
50 void terminal_save_inferior () override;
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;
57
58 void follow_exec (inferior *follow_inf, ptid_t ptid,
59 const char *execd_pathname) override;
60
61 void mourn_inferior () override;
62
63 bool can_run () override;
64
65 bool can_create_inferior () override;
66 void create_inferior (const char *, const std::string &,
67 char **, int) override = 0;
68
69 bool can_attach () override;
70 void attach (const char *, int) override = 0;
71
72 void post_attach (int) override;
73
74 const char *pid_to_exec_file (int pid) override;
75
76 int fileio_open (struct inferior *inf, const char *filename,
77 int flags, int mode, int warn_if_slow,
78 fileio_error *target_errno) override;
79 int fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
80 ULONGEST offset, fileio_error *target_errno) override;
81 int fileio_pread (int fd, gdb_byte *read_buf, int len,
82 ULONGEST offset, fileio_error *target_errno) override;
83 int fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno) override;
84 int fileio_close (int fd, fileio_error *target_errno) override;
85 int fileio_unlink (struct inferior *inf,
86 const char *filename,
87 fileio_error *target_errno) override;
88 gdb::optional<std::string> fileio_readlink (struct inferior *inf,
89 const char *filename,
90 fileio_error *target_errno) override;
91 bool use_agent (bool use) override;
92
93 bool can_use_agent () override;
94
95protected:
96 /* Unpush the target if it wasn't explicitly open with "target native"
97 and there are no live inferiors left. Note: if calling this as a
98 result of a mourn or detach, the current inferior shall already
99 have its PID cleared, so it isn't counted as live. That's usually
100 done by calling either generic_mourn_inferior or
101 detach_inferior. */
102 void maybe_unpush_target ();
103};
104
105/* Convert the host wait(2) status to a target_waitstatus. */
106
107extern target_waitstatus host_status_to_waitstatus (int hoststatus);
108
109/* Register TARGET as native target and set it up to respond to the
110 "target native" command. */
111extern 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. */
116extern void inf_child_open_target (const char *arg, int from_tty);
117
118#endif
bool can_use_agent() override
Definition inf-child.c:392
void pass_ctrlc() override
Definition inf-child.c:133
void prepare_to_store(struct regcache *) override
Definition inf-child.c:86
void mourn_inferior() override
Definition inf-child.c:190
inf_child_target()=default
bool can_run() override
Definition inf-child.c:206
bool can_attach() override
Definition inf-child.c:218
void disconnect(const char *, int) override
Definition inf-child.c:170
void store_registers(struct regcache *, int) override=0
bool supports_terminal_ours() override
Definition inf-child.c:91
void create_inferior(const char *, const std::string &, char **, int) override=0
int fileio_close(int fd, fileio_error *target_errno) override
Definition inf-child.c:327
void attach(const char *, int) override=0
void post_attach(int) override
Definition inf-child.c:73
void fetch_registers(struct regcache *, int) override=0
void terminal_info(const char *, int) override
Definition inf-child.c:139
int fileio_open(struct inferior *inf, const char *filename, int flags, int mode, int warn_if_slow, fileio_error *target_errno) override
Definition inf-child.c:234
void follow_exec(inferior *follow_inf, ptid_t ptid, const char *execd_pathname) override
Definition inf-child.c:398
void terminal_init() override
Definition inf-child.c:97
void maybe_unpush_target()
Definition inf-child.c:199
void close() override
Definition inf-child.c:183
void terminal_ours_for_output() override
Definition inf-child.c:115
const target_info & info() const override
Definition inf-child.c:49
int fileio_pread(int fd, gdb_byte *read_buf, int len, ULONGEST offset, fileio_error *target_errno) override
Definition inf-child.c:286
void interrupt() override
Definition inf-child.c:127
int fileio_fstat(int fd, struct stat *sb, fileio_error *target_errno) override
Definition inf-child.c:313
void terminal_save_inferior() override
Definition inf-child.c:109
bool can_create_inferior() override
Definition inf-child.c:212
const char * pid_to_exec_file(int pid) override
Definition inf-child.c:224
int fileio_unlink(struct inferior *inf, const char *filename, fileio_error *target_errno) override
Definition inf-child.c:341
~inf_child_target() override=0
Definition inf-child.c:69
void terminal_ours() override
Definition inf-child.c:121
gdb::optional< std::string > fileio_readlink(struct inferior *inf, const char *filename, fileio_error *target_errno) override
Definition inf-child.c:356
bool use_agent(bool use) override
Definition inf-child.c:380
int fileio_pwrite(int fd, const gdb_byte *write_buf, int len, ULONGEST offset, fileio_error *target_errno) override
Definition inf-child.c:259
void terminal_inferior() override
Definition inf-child.c:103
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
Definition gnu-nat.c:1861
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int int rusage_t pid_t pid
Definition gnu-nat.c:1791
target_waitstatus host_status_to_waitstatus(int hoststatus)
Definition inf-child.c:57
void add_inf_child_target(inf_child_target *target)
Definition inf-child.c:418
void inf_child_open_target(const char *arg, int from_tty)
Definition inf-child.c:152
Definition gnu-nat.c:153