aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c59
1 files changed, 34 insertions, 25 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index 09c23a3..89cba54 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -78,6 +78,17 @@
/* The remote target. */
+static const char remote_doc[] = N_("\
+Use a remote computer via a serial line, using a gdb-specific protocol.\n\
+Specify the serial device it is connected to\n\
+(e.g. /dev/ttyS0, /dev/ttya, COM1, etc.).");
+
+static const target_info remote_target_info = {
+ "remote",
+ N_("Remote serial target in gdb-specific protocol"),
+ remote_doc
+};
+
class remote_target : public target_ops
{
public:
@@ -86,24 +97,15 @@ public:
to_stratum = process_stratum;
}
- const char *shortname () override
- { return "remote"; }
-
- const char *longname () override
- { return _("Remote serial target in gdb-specific protocol"); }
-
- const char *doc () override
- {
- return _("\
-Use a remote computer via a serial line, using a gdb-specific protocol.\n\
-Specify the serial device it is connected to\n\
-(e.g. /dev/ttyS0, /dev/ttya, COM1, etc.).");
- }
+ const target_info &info () const override
+ { return remote_target_info; }
thread_control_capabilities get_thread_control_capabilities () override
{ return tc_schedlock; }
- void open (const char *, int) override;
+ /* Open a remote connection. */
+ static void open (const char *, int);
+
void close () override;
void detach (inferior *, int) override;
@@ -376,23 +378,27 @@ Specify the serial device it is connected to\n\
enum exec_direction_kind execution_direction () override;
protected:
- void open_1 (const char *name, int from_tty, int extended_p);
+ static void open_1 (const char *name, int from_tty, int extended_p);
void start_remote (int from_tty, int extended_p);
};
+static const target_info extended_remote_target_info = {
+ "extended-remote",
+ N_("Extended remote serial target in gdb-specific protocol"),
+ remote_doc
+};
+
/* Set up the extended remote target by extending the standard remote
target and adding to it. */
class extended_remote_target final : public remote_target
{
public:
- const char *shortname () override
- { return "extended-remote"; }
+ const target_info &info () const override
+ { return extended_remote_target_info; }
- const char *longname () override
- { return _("Extended remote serial target in gdb-specific protocol"); }
-
- void open (const char *, int) override;
+ /* Open an extended-remote connection. */
+ static void open (const char *, int);
bool can_create_inferior () override { return true; }
void create_inferior (const char *, const std::string &,
@@ -5268,7 +5274,10 @@ remote_target::open_1 (const char *name, int from_tty, int extended_p)
puts_filtered (name);
puts_filtered ("\n");
}
- push_target (this); /* Switch to using remote target now. */
+
+ remote_target *target
+ = extended_p ? &extended_remote_ops : &remote_ops;
+ push_target (target); /* Switch to using remote target now. */
/* Register extra event sources in the event loop. */
remote_async_inferior_event_token
@@ -5336,7 +5345,7 @@ remote_target::open_1 (const char *name, int from_tty, int extended_p)
TRY
{
- start_remote (from_tty, extended_p);
+ target->start_remote (from_tty, extended_p);
}
CATCH (ex, RETURN_MASK_ALL)
{
@@ -14007,8 +14016,8 @@ _initialize_remote (void)
time. */
remote_state = new_remote_state ();
- add_target (&remote_ops);
- add_target (&extended_remote_ops);
+ add_target (remote_target_info, remote_target::open);
+ add_target (extended_remote_target_info, extended_remote_target::open);
/* Hook into new objfile notification. */
gdb::observers::new_objfile.attach (remote_new_objfile);