aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-utils.c14
-rw-r--r--gdb/cli/cli-utils.h14
2 files changed, 22 insertions, 6 deletions
diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c
index 306b69e..30d4091 100644
--- a/gdb/cli/cli-utils.c
+++ b/gdb/cli/cli-utils.c
@@ -573,8 +573,18 @@ parse_flags_qcs (const char *which_command, const char **str,
gdb_assert_not_reached ("int qcs flag out of bound");
}
- if (flags->cont && flags->silent)
- error (_("%s: -c and -s are mutually exclusive"), which_command);
+ validate_flags_qcs (which_command, flags);
return true;
}
+
+/* See documentation in cli-utils.h. */
+
+void
+validate_flags_qcs (const char *which_command, qcs_flags *flags)
+{
+ if (flags->cont && flags->silent)
+ error (_("%s: -c and -s are mutually exclusive"), which_command);
+}
+
+/* See documentation in cli-utils.h. */
diff --git a/gdb/cli/cli-utils.h b/gdb/cli/cli-utils.h
index 41c2356..e6b877d 100644
--- a/gdb/cli/cli-utils.h
+++ b/gdb/cli/cli-utils.h
@@ -229,13 +229,14 @@ check_for_argument (char **str, const char *arg)
such that FLAGS [N - 1] is the valid found flag. */
extern int parse_flags (const char **str, const char *flags);
-/* qcs_flags struct regroups the flags parsed by parse_flags_qcs. */
+/* qcs_flags struct groups the -q, -c, and -s flags parsed by "thread
+ apply" and "frame apply" commands */
struct qcs_flags
{
- bool quiet = false;
- bool cont = false;
- bool silent = false;
+ int quiet = false;
+ int cont = false;
+ int silent = false;
};
/* A helper function that uses parse_flags to handle the flags qcs :
@@ -259,4 +260,9 @@ struct qcs_flags
extern bool parse_flags_qcs (const char *which_command, const char **str,
qcs_flags *flags);
+/* Validate FLAGS. Throws an error if both FLAGS->CONT and
+ FLAGS->SILENT are true. WHICH_COMMAND is included in the error
+ message. */
+extern void validate_flags_qcs (const char *which_command, qcs_flags *flags);
+
#endif /* CLI_CLI_UTILS_H */