]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/gdbserver/inferiors.c
Import latest version of texi2pod.pl from FSF GCC sources.
[thirdparty/binutils-gdb.git] / gdb / gdbserver / inferiors.c
CommitLineData
ce3a066d
DJ
1/* Inferior process information for the remote server for GDB.
2 Copyright 2002
3 Free Software Foundation, Inc.
4
5 Contributed by MontaVista Software.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
23
24#include <stdlib.h>
25
26#include "server.h"
27
28struct inferior_info
29{
30 int pid;
611cb4a5 31 void *target_data;
c04a1aa8 32 void *regcache_data;
ce3a066d
DJ
33 struct inferior_info *next;
34};
35
36static struct inferior_info *inferiors;
37struct inferior_info *current_inferior;
38int signal_pid;
39
40void
41add_inferior (int pid)
42{
43 struct inferior_info *new_inferior
44 = (struct inferior_info *) malloc (sizeof (*new_inferior));
45
46 memset (new_inferior, 0, sizeof (*new_inferior));
47
48 new_inferior->pid = pid;
49
50 new_inferior->next = inferiors;
51 inferiors = new_inferior;
52
53 if (current_inferior == NULL)
54 current_inferior = inferiors;
55
c04a1aa8
DJ
56 create_register_cache (new_inferior);
57
ce3a066d
DJ
58 if (signal_pid == 0)
59 signal_pid = pid;
60}
61
62void
63clear_inferiors (void)
64{
65 struct inferior_info *inf = inferiors, *next_inf;
66
67 while (inf)
68 {
69 next_inf = inf->next;
611cb4a5
DJ
70
71 if (inf->target_data)
72 free (inf->target_data);
c04a1aa8
DJ
73 if (inf->regcache_data)
74 free_register_cache (inf);
611cb4a5 75
ce3a066d
DJ
76 free (inf);
77 inf = next_inf;
78 }
79
80 inferiors = NULL;
81}
611cb4a5
DJ
82
83void *
84inferior_target_data (struct inferior_info *inferior)
85{
86 return inferior->target_data;
87}
88
89void
90set_inferior_target_data (struct inferior_info *inferior, void *data)
91{
92 inferior->target_data = data;
93}
c04a1aa8
DJ
94
95void *
96inferior_regcache_data (struct inferior_info *inferior)
97{
98 return inferior->regcache_data;
99}
100
101void
102set_inferior_regcache_data (struct inferior_info *inferior, void *data)
103{
104 inferior->regcache_data = data;
105}