Fix compile error with use of 'typename' outside of template
[deliverable/binutils-gdb.git] / gdb / gdbserver / inferiors.h
CommitLineData
270c6aea 1/* Inferior process information for the remote server for GDB.
618f726f 2 Copyright (C) 1993-2016 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
19#ifndef INFERIORS_H
20#define INFERIORS_H
21
22/* Generic information for tracking a list of ``inferiors'' - threads,
23 processes, etc. */
24struct inferior_list
25{
26 struct inferior_list_entry *head;
27 struct inferior_list_entry *tail;
28};
29struct inferior_list_entry
30{
31 ptid_t id;
32 struct inferior_list_entry *next;
33};
34
35struct thread_info;
a44892be 36struct regcache;
270c6aea
PA
37struct target_desc;
38struct sym_cache;
39struct breakpoint;
40struct raw_breakpoint;
41struct fast_tracepoint_jump;
42struct process_info_private;
43
44struct process_info
45{
80894984
DE
46 /* This must appear first.
47 The list iterator functions assume it. */
48 struct inferior_list_entry entry;
270c6aea
PA
49
50 /* Nonzero if this child process was attached rather than
51 spawned. */
52 int attached;
53
54 /* True if GDB asked us to detach from this process, but we remained
55 attached anyway. */
56 int gdb_detached;
57
58 /* The symbol cache. */
59 struct sym_cache *symbol_cache;
60
61 /* The list of memory breakpoints. */
62 struct breakpoint *breakpoints;
63
64 /* The list of raw memory breakpoints. */
65 struct raw_breakpoint *raw_breakpoints;
66
67 /* The list of installed fast tracepoints. */
68 struct fast_tracepoint_jump *fast_tracepoint_jumps;
69
70 const struct target_desc *tdesc;
71
72 /* Private target data. */
fe978cb0 73 struct process_info_private *priv;
270c6aea
PA
74};
75
d86d4aaf
DE
76#define ptid_of(inf) ((inf)->entry.id)
77#define pid_of(inf) ptid_get_pid ((inf)->entry.id)
78#define lwpid_of(inf) ptid_get_lwp ((inf)->entry.id)
79
270c6aea 80/* Return a pointer to the process that corresponds to the current
0bfdf32f 81 thread (current_thread). It is an error to call this if there is
270c6aea
PA
82 no current thread selected. */
83
84struct process_info *current_process (void);
85struct process_info *get_thread_process (struct thread_info *);
86
87extern struct inferior_list all_processes;
88
89void add_inferior_to_list (struct inferior_list *list,
90 struct inferior_list_entry *new_inferior);
91void for_each_inferior (struct inferior_list *list,
92 void (*action) (struct inferior_list_entry *));
93
649ebbca
DE
94void for_each_inferior_with_data
95 (struct inferior_list *list,
96 void (*action) (struct inferior_list_entry *, void *),
97 void *data);
98
99void clear_inferior_list (struct inferior_list *list);
100
101int one_inferior_p (struct inferior_list *list);
102
fa96cb38
PA
103/* Helper for ALL_INFERIORS_TYPE. Gets the next element starting at
104 CUR, if CUR is not NULL. */
105#define A_I_NEXT(type, list, cur) \
106 ((cur) != NULL \
107 ? (type *) ((struct inferior_list_entry *) cur)->next \
108 : NULL)
109
110/* Iterate over all inferiors of type TYPE in LIST, open loop
111 style. */
112#define ALL_INFERIORS_TYPE(type, list, cur, tmp) \
113 for ((cur) = (type *) (list)->head, (tmp) = A_I_NEXT (type, list, cur); \
114 (cur) != NULL; \
115 (cur) = (tmp), (tmp) = A_I_NEXT (type, list, cur))
116
117/* Iterate over all inferiors in LIST, open loop style. */
118#define ALL_INFERIORS(list, cur, tmp) \
119 ALL_INFERIORS_TYPE (struct inferior_list_entry, list, cur, tmp)
120
121/* Iterate over all processes, open loop style. */
122#define ALL_PROCESSES(cur, tmp) \
123 ALL_INFERIORS_TYPE (struct process_info, &all_processes, cur, tmp)
124
0bfdf32f 125extern struct thread_info *current_thread;
270c6aea
PA
126void remove_inferior (struct inferior_list *list,
127 struct inferior_list_entry *entry);
128
649ebbca
DE
129struct inferior_list_entry *get_first_inferior (struct inferior_list *list);
130
3d40fbb5
PA
131/* Return the first process in the processes list. */
132struct process_info *get_first_process (void);
133
270c6aea
PA
134struct process_info *add_process (int pid, int attached);
135void remove_process (struct process_info *process);
136struct process_info *find_process_pid (int pid);
137int have_started_inferiors_p (void);
138int have_attached_inferiors_p (void);
139
270c6aea
PA
140ptid_t thread_to_gdb_id (struct thread_info *);
141ptid_t gdb_id_to_thread_id (ptid_t);
142
143void clear_inferiors (void);
144struct inferior_list_entry *find_inferior
145 (struct inferior_list *,
146 int (*func) (struct inferior_list_entry *,
147 void *),
148 void *arg);
149struct inferior_list_entry *find_inferior_id (struct inferior_list *list,
150 ptid_t id);
80894984 151
270c6aea
PA
152void *inferior_target_data (struct thread_info *);
153void set_inferior_target_data (struct thread_info *, void *);
a44892be
PA
154struct regcache *inferior_regcache_data (struct thread_info *);
155void set_inferior_regcache_data (struct thread_info *, struct regcache *);
270c6aea
PA
156
157#endif /* INFERIORS_H */
This page took 0.223348 seconds and 4 git commands to generate.