gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / mi / mi-getopt.h
CommitLineData
fb40c209 1/* MI Option Parser.
b811d2c2 2 Copyright (C) 2000-2020 Free Software Foundation, Inc.
ab91fdd5 3 Contributed by Cygnus Solutions (a Red Hat company).
fb40c209
AC
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
a9762ec7 9 the Free Software Foundation; either version 3 of the License, or
fb40c209
AC
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
a9762ec7 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
fb40c209 19
1a5c2598
TT
20#ifndef MI_MI_GETOPT_H
21#define MI_MI_GETOPT_H
fb40c209 22
2b03b41d
SS
23/* The option list. Terminated by NAME==NULL. ARG_P that the option
24 requires an argument. INDEX is returned to identify the option. */
25
26struct mi_opt
27 {
28 const char *name;
29 int index;
30 int arg_p;
31 };
32
fb40c209
AC
33/* Like getopt() but with simpler semantics.
34
35 An option has the form ``-<name>''. The special option ``--''
36 denotes the end of the option list. An option can be followed by a
37 separate argument (on a per option basis).
38
39 On entry OPTIND contains the index of the next element of ARGV that
40 needs parsing. OPTIND is updated to indicate the index of the next
41 argument before mi_getopt() returns.
42
43 If ARGV[OPTIND] is an option, that options INDEX is returned.
44 OPTARG is set to the options argument or NULL. OPTIND is updated.
45
46 If ARGV[OPTIND] is not an option, -1 is returned and OPTIND updated
47 to specify the non-option argument. OPTARG is set to NULL.
48
242f1fd7
YQ
49 If an unknown option is encountered, mi_getopt() calls
50 ``error("%s: Unknown option %c", prefix, option)'' while
51 mi_getopt_allow_unknown returns -1. */
fb40c209 52
fb40c209 53extern int mi_getopt (const char *prefix, int argc, char **argv,
91174723 54 const struct mi_opt *opt, int *optind, char **optarg);
242f1fd7
YQ
55extern int mi_getopt_allow_unknown (const char *prefix, int argc,
56 char **argv, const struct mi_opt *opts,
57 int *oind, char **oarg);
fb40c209 58
2b03b41d
SS
59/* mi_valid_noargs determines if ARGC/ARGV are a valid set of
60 parameters to satisfy an MI function that is not supposed to
30baf67b 61 receive any arguments.
1abaf70c 62
2b03b41d 63 An MI function that should not receive arguments can still be
1abaf70c
BR
64 passed parameters after the special option '--' such as below.
65
66 Example: The MI function -exec-run takes no args.
67 However, the client may pass '-exec-run -- -a ...'
68 See PR-783
69
70 PREFIX is passed to mi_getopt for an error message.
71
72 This function Returns 1 if the parameter pair ARGC/ARGV are valid
73 for an MI function that takes no arguments. Otherwise, it returns 0
74 and the appropriate error message is displayed by mi_getopt. */
75
76extern int mi_valid_noargs (const char *prefix, int argc, char **argv);
1a5c2598
TT
77
78#endif /* MI_MI_GETOPT_H */
This page took 2.192393 seconds and 4 git commands to generate.