GDB (API)
|
00001 /* MI Command Set - target commands. 00002 Copyright (C) 2007-2013 Free Software Foundation, Inc. 00003 00004 This file is part of GDB. 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00018 00019 #include "defs.h" 00020 #include "mi-cmds.h" 00021 #include "mi-getopt.h" 00022 #include "remote.h" 00023 00024 /* Get a file from the target. */ 00025 00026 void 00027 mi_cmd_target_file_get (char *command, char **argv, int argc) 00028 { 00029 int oind = 0; 00030 char *oarg; 00031 const char *remote_file, *local_file; 00032 static const struct mi_opt opts[] = 00033 { 00034 { 0, 0, 0 } 00035 }; 00036 static const char prefix[] = "-target-file-get"; 00037 00038 if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1 00039 || oind != argc - 2) 00040 error (_("-target-file-get: Usage: REMOTE_FILE LOCAL_FILE")); 00041 00042 remote_file = argv[oind]; 00043 local_file = argv[oind + 1]; 00044 00045 remote_file_get (remote_file, local_file, 0); 00046 } 00047 00048 /* Send a file to the target. */ 00049 00050 void 00051 mi_cmd_target_file_put (char *command, char **argv, int argc) 00052 { 00053 int oind = 0; 00054 char *oarg; 00055 const char *remote_file, *local_file; 00056 static const struct mi_opt opts[] = 00057 { 00058 { 0, 0, 0 } 00059 }; 00060 static const char prefix[] = "-target-file-put"; 00061 00062 if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1 00063 || oind != argc - 2) 00064 error (_("-target-file-put: Usage: LOCAL_FILE REMOTE_FILE")); 00065 00066 local_file = argv[oind]; 00067 remote_file = argv[oind + 1]; 00068 00069 remote_file_put (local_file, remote_file, 0); 00070 } 00071 00072 /* Delete a file on the target. */ 00073 00074 void 00075 mi_cmd_target_file_delete (char *command, char **argv, int argc) 00076 { 00077 int oind = 0; 00078 char *oarg; 00079 const char *remote_file; 00080 static const struct mi_opt opts[] = 00081 { 00082 { 0, 0, 0 } 00083 }; 00084 static const char prefix[] = "-target-file-delete"; 00085 00086 if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1 00087 || oind != argc - 1) 00088 error (_("-target-file-delete: Usage: REMOTE_FILE")); 00089 00090 remote_file = argv[oind]; 00091 00092 remote_file_delete (remote_file, 0); 00093 } 00094