Add "info connections" command, "info inferiors" connection number/string
[deliverable/binutils-gdb.git] / gdb / process-stratum-target.h
1 /* Abstract base class inherited by all process_stratum targets
2
3 Copyright (C) 2018-2020 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 #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:
30 ~process_stratum_target () override = 0;
31
32 strata stratum () const final override { return process_stratum; }
33
34 /* Return a string representation of this target's open connection.
35 This string is used to distinguish different instances of a given
36 target type. For example, when remote debugging, the target is
37 called "remote", but since we may have more than one remote
38 target open, connection_string() returns the connection serial
39 connection name, e.g., "localhost:10001", "192.168.0.1:20000",
40 etc. This string is shown in several places, e.g., in "info
41 connections" and "info inferiors". */
42 virtual const char *connection_string () { return nullptr; }
43
44 /* We must default these because they must be implemented by any
45 target that can run. */
46 bool can_async_p () override { return false; }
47 bool supports_non_stop () override { return false; }
48 bool supports_disable_randomization () override { return false; }
49
50 /* This default implementation returns the inferior's address
51 space. */
52 struct address_space *thread_address_space (ptid_t ptid) override;
53
54 /* This default implementation always returns target_gdbarch (). */
55 struct gdbarch *thread_architecture (ptid_t ptid) override;
56
57 /* Default implementations for process_stratum targets. Return true
58 if there's a selected inferior, false otherwise. */
59 bool has_all_memory () override;
60 bool has_memory () override;
61 bool has_stack () override;
62 bool has_registers () override;
63 bool has_execution (inferior *inf) override;
64
65 /* True if any thread is, or may be executing. We need to track
66 this separately because until we fully sync the thread list, we
67 won't know whether the target is fully stopped, even if we see
68 stop events for all known threads, because any of those threads
69 may have spawned new threads we haven't heard of yet. */
70 bool threads_executing = false;
71
72 /* The connection number. Visible in "info connections". */
73 int connection_number = 0;
74 };
75
76 /* Downcast TARGET to process_stratum_target. */
77
78 static inline process_stratum_target *
79 as_process_stratum_target (target_ops *target)
80 {
81 gdb_assert (target->stratum () == process_stratum);
82 return static_cast<process_stratum_target *> (target);
83 }
84
85 #endif /* !defined (PROCESS_STRATUM_TARGET_H) */
This page took 0.031107 seconds and 4 git commands to generate.