Commit | Line | Data |
---|---|---|
3b3dac9b PA |
1 | /* Abstract base class inherited by all process_stratum targets |
2 | ||
b811d2c2 | 3 | Copyright (C) 2018-2020 Free Software Foundation, Inc. |
3b3dac9b PA |
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 PROCESS_STRATUM_TARGET_H | |
21 | #define PROCESS_STRATUM_TARGET_H | |
22 | ||
23 | #include "target.h" | |
24 | ||
25 | /* Abstract base class inherited by all process_stratum targets. */ | |
26 | ||
27 | class process_stratum_target : public target_ops | |
28 | { | |
29 | public: | |
3b3dac9b PA |
30 | ~process_stratum_target () override = 0; |
31 | ||
dc34c897 | 32 | strata stratum () const final override { return process_stratum; } |
66b4deae | 33 | |
3b3dac9b PA |
34 | /* We must default these because they must be implemented by any |
35 | target that can run. */ | |
36 | bool can_async_p () override { return false; } | |
37 | bool supports_non_stop () override { return false; } | |
38 | bool supports_disable_randomization () override { return false; } | |
39 | ||
40 | /* This default implementation returns the inferior's address | |
41 | space. */ | |
42 | struct address_space *thread_address_space (ptid_t ptid) override; | |
43 | ||
44 | /* This default implementation always returns target_gdbarch (). */ | |
45 | struct gdbarch *thread_architecture (ptid_t ptid) override; | |
f3d11a9a PA |
46 | |
47 | /* Default implementations for process_stratum targets. Return true | |
48 | if there's a selected inferior, false otherwise. */ | |
49 | bool has_all_memory () override; | |
50 | bool has_memory () override; | |
51 | bool has_stack () override; | |
52 | bool has_registers () override; | |
5018ce90 | 53 | bool has_execution (inferior *inf) override; |
5b6d1e4f PA |
54 | |
55 | /* True if any thread is, or may be executing. We need to track | |
56 | this separately because until we fully sync the thread list, we | |
57 | won't know whether the target is fully stopped, even if we see | |
58 | stop events for all known threads, because any of those threads | |
59 | may have spawned new threads we haven't heard of yet. */ | |
60 | bool threads_executing = false; | |
3b3dac9b PA |
61 | }; |
62 | ||
5b6d1e4f PA |
63 | /* Downcast TARGET to process_stratum_target. */ |
64 | ||
65 | static inline process_stratum_target * | |
66 | as_process_stratum_target (target_ops *target) | |
67 | { | |
68 | gdb_assert (target->stratum () == process_stratum); | |
69 | return static_cast<process_stratum_target *> (target); | |
70 | } | |
71 | ||
3b3dac9b | 72 | #endif /* !defined (PROCESS_STRATUM_TARGET_H) */ |