gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdbserver / inferiors.h
CommitLineData
270c6aea 1/* Inferior process information for the remote server for GDB.
b811d2c2 2 Copyright (C) 1993-2020 Free Software Foundation, Inc.
270c6aea
PA
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
1a5c2598
TT
19#ifndef GDBSERVER_INFERIORS_H
20#define GDBSERVER_INFERIORS_H
270c6aea 21
268a13a5 22#include "gdbsupport/gdb_vecs.h"
9179355e 23#include <list>
82075af2 24
270c6aea 25struct thread_info;
a44892be 26struct regcache;
270c6aea
PA
27struct target_desc;
28struct sym_cache;
29struct breakpoint;
30struct raw_breakpoint;
31struct fast_tracepoint_jump;
32struct process_info_private;
33
34struct process_info
35{
f27866ba
SM
36 process_info (int pid_, int attached_)
37 : pid (pid_), attached (attached_)
38 {}
39
9179355e
SM
40 /* This process' pid. */
41 int pid;
270c6aea
PA
42
43 /* Nonzero if this child process was attached rather than
44 spawned. */
45 int attached;
46
47 /* True if GDB asked us to detach from this process, but we remained
48 attached anyway. */
f27866ba 49 int gdb_detached = 0;
270c6aea
PA
50
51 /* The symbol cache. */
f27866ba 52 struct sym_cache *symbol_cache = NULL;
270c6aea
PA
53
54 /* The list of memory breakpoints. */
f27866ba 55 struct breakpoint *breakpoints = NULL;
270c6aea
PA
56
57 /* The list of raw memory breakpoints. */
f27866ba 58 struct raw_breakpoint *raw_breakpoints = NULL;
270c6aea
PA
59
60 /* The list of installed fast tracepoints. */
f27866ba 61 struct fast_tracepoint_jump *fast_tracepoint_jumps = NULL;
270c6aea 62
82075af2
JS
63 /* The list of syscalls to report, or just a single element, ANY_SYSCALL,
64 for unfiltered syscall reporting. */
f27866ba 65 std::vector<int> syscalls_to_catch;
82075af2 66
f27866ba 67 const struct target_desc *tdesc = NULL;
270c6aea
PA
68
69 /* Private target data. */
f27866ba 70 struct process_info_private *priv = NULL;
270c6aea
PA
71};
72
9179355e
SM
73/* Get the pid of PROC. */
74
75static inline int
76pid_of (const process_info *proc)
77{
78 return proc->pid;
79}
d86d4aaf 80
270c6aea 81/* Return a pointer to the process that corresponds to the current
0bfdf32f 82 thread (current_thread). It is an error to call this if there is
270c6aea
PA
83 no current thread selected. */
84
85struct process_info *current_process (void);
63c40ec7 86struct process_info *get_thread_process (const struct thread_info *);
270c6aea 87
9179355e 88extern std::list<process_info *> all_processes;
270c6aea 89
9179355e
SM
90/* Invoke FUNC for each process. */
91
92template <typename Func>
93static void
94for_each_process (Func func)
95{
96 std::list<process_info *>::iterator next, cur = all_processes.begin ();
97
98 while (cur != all_processes.end ())
99 {
100 next = cur;
101 next++;
102 func (*cur);
103 cur = next;
104 }
105}
106
107/* Find the first process for which FUNC returns true. Return NULL if no
108 process satisfying FUNC is found. */
109
110template <typename Func>
111static process_info *
112find_process (Func func)
113{
114 std::list<process_info *>::iterator next, cur = all_processes.begin ();
115
116 while (cur != all_processes.end ())
117 {
118 next = cur;
119 next++;
120
121 if (func (*cur))
122 return *cur;
123
124 cur = next;
125 }
126
127 return NULL;
128}
fa96cb38 129
0bfdf32f 130extern struct thread_info *current_thread;
649ebbca 131
3d40fbb5
PA
132/* Return the first process in the processes list. */
133struct process_info *get_first_process (void);
134
270c6aea
PA
135struct process_info *add_process (int pid, int attached);
136void remove_process (struct process_info *process);
137struct process_info *find_process_pid (int pid);
138int have_started_inferiors_p (void);
139int have_attached_inferiors_p (void);
140
270c6aea 141void clear_inferiors (void);
9c80ecd6 142
6afd337d
SM
143void *thread_target_data (struct thread_info *);
144struct regcache *thread_regcache_data (struct thread_info *);
145void set_thread_regcache_data (struct thread_info *, struct regcache *);
270c6aea 146
1a5c2598 147#endif /* GDBSERVER_INFERIORS_H */
This page took 0.547929 seconds and 4 git commands to generate.