9ce8d3dd47adb543c790999eac8b73360c8a76d4
[external/binutils.git] / gdb / process-stratum-target.c
1 /* Abstract base class inherited by all process_stratum targets
2
3    Copyright (C) 2018 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 #include "defs.h"
21 #include "process-stratum-target.h"
22 #include "inferior.h"
23
24 process_stratum_target::~process_stratum_target ()
25 {
26 }
27
28 struct address_space *
29 process_stratum_target::thread_address_space (ptid_t ptid)
30 {
31   /* Fall-back to the "main" address space of the inferior.  */
32   inferior *inf = find_inferior_ptid (ptid);
33
34   if (inf == NULL || inf->aspace == NULL)
35     internal_error (__FILE__, __LINE__,
36                     _("Can't determine the current "
37                       "address space of thread %s\n"),
38                     target_pid_to_str (ptid));
39
40   return inf->aspace;
41 }
42
43 struct gdbarch *
44 process_stratum_target::thread_architecture (ptid_t ptid)
45 {
46   inferior *inf = find_inferior_ptid (ptid);
47   gdb_assert (inf != NULL);
48   return inf->gdbarch;
49 }