gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / mi / mi-cmd-target.c
CommitLineData
a6b151f1 1/* MI Command Set - target commands.
b811d2c2 2 Copyright (C) 2007-2020 Free Software Foundation, Inc.
a6b151f1
DJ
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19#include "defs.h"
20#include "mi-cmds.h"
21#include "mi-getopt.h"
22#include "remote.h"
23
24/* Get a file from the target. */
25
ce8f13f8 26void
9f33b8b7 27mi_cmd_target_file_get (const char *command, char **argv, int argc)
a6b151f1 28{
00629212
AS
29 int oind = 0;
30 char *oarg;
a6b151f1 31 const char *remote_file, *local_file;
91174723 32 static const struct mi_opt opts[] =
2b03b41d
SS
33 {
34 { 0, 0, 0 }
35 };
cb0fd152 36 static const char prefix[] = "-target-file-get";
a6b151f1 37
00629212
AS
38 if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1
39 || oind != argc - 2)
1b05df00 40 error (_("-target-file-get: Usage: REMOTE_FILE LOCAL_FILE"));
a6b151f1 41
00629212
AS
42 remote_file = argv[oind];
43 local_file = argv[oind + 1];
a6b151f1
DJ
44
45 remote_file_get (remote_file, local_file, 0);
a6b151f1
DJ
46}
47
48/* Send a file to the target. */
49
ce8f13f8 50void
9f33b8b7 51mi_cmd_target_file_put (const char *command, char **argv, int argc)
a6b151f1 52{
00629212
AS
53 int oind = 0;
54 char *oarg;
a6b151f1 55 const char *remote_file, *local_file;
91174723 56 static const struct mi_opt opts[] =
2b03b41d
SS
57 {
58 { 0, 0, 0 }
59 };
cb0fd152 60 static const char prefix[] = "-target-file-put";
a6b151f1 61
00629212
AS
62 if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1
63 || oind != argc - 2)
1b05df00 64 error (_("-target-file-put: Usage: LOCAL_FILE REMOTE_FILE"));
a6b151f1 65
00629212
AS
66 local_file = argv[oind];
67 remote_file = argv[oind + 1];
a6b151f1
DJ
68
69 remote_file_put (local_file, remote_file, 0);
a6b151f1
DJ
70}
71
72/* Delete a file on the target. */
73
ce8f13f8 74void
9f33b8b7 75mi_cmd_target_file_delete (const char *command, char **argv, int argc)
a6b151f1 76{
00629212
AS
77 int oind = 0;
78 char *oarg;
a1b7d198 79 const char *remote_file;
91174723 80 static const struct mi_opt opts[] =
2b03b41d
SS
81 {
82 { 0, 0, 0 }
83 };
cb0fd152 84 static const char prefix[] = "-target-file-delete";
a6b151f1 85
00629212
AS
86 if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1
87 || oind != argc - 1)
1b05df00 88 error (_("-target-file-delete: Usage: REMOTE_FILE"));
a6b151f1 89
00629212 90 remote_file = argv[oind];
a6b151f1
DJ
91
92 remote_file_delete (remote_file, 0);
a6b151f1
DJ
93}
94
This page took 1.402687 seconds and 4 git commands to generate.