aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/maint-test-options.c12
-rw-r--r--gdb/testsuite/gdb.base/options.exp17
2 files changed, 20 insertions, 9 deletions
diff --git a/gdb/maint-test-options.c b/gdb/maint-test-options.c
index 9d76817..da9765e 100644
--- a/gdb/maint-test-options.c
+++ b/gdb/maint-test-options.c
@@ -137,6 +137,7 @@ struct test_options_opts
int pint_unl_opt = 0;
std::string string_opt;
std::string filename_opt;
+ ui_file_style::color color_opt { ui_file_style::MAGENTA };
test_options_opts () = default;
@@ -149,7 +150,7 @@ struct test_options_opts
gdb_printf (file,
_("-flag %d -xx1 %d -xx2 %d -bool %d "
"-enum %s -uint-unl %s -pint-unl %s -string '%s' "
- "-filename '%s' -- %s\n"),
+ "-filename '%s' -color %s -- %s\n"),
flag_opt,
xx1_opt,
xx2_opt,
@@ -163,6 +164,7 @@ struct test_options_opts
: plongest (pint_unl_opt)),
string_opt.c_str (),
filename_opt.c_str (),
+ color_opt.to_string ().c_str (),
args);
}
};
@@ -245,6 +247,14 @@ static const gdb::option::option_def test_options_option_defs[] = {
nullptr, /* show_cmd_cb */
N_("A filename option."),
},
+
+ /* A color option. */
+ gdb::option::color_option_def<test_options_opts> {
+ "color",
+ [] (test_options_opts *opts) { return &opts->color_opt; },
+ nullptr, /* show_cmd_cb */
+ N_("A color option."),
+ },
};
/* Create an option_def_group for the test_options_opts options, with
diff --git a/gdb/testsuite/gdb.base/options.exp b/gdb/testsuite/gdb.base/options.exp
index a1ca39e..8760a91 100644
--- a/gdb/testsuite/gdb.base/options.exp
+++ b/gdb/testsuite/gdb.base/options.exp
@@ -99,21 +99,21 @@ proc make_cmd {variant} {
# operand.
proc expect_none {operand} {
return "-flag 0 -xx1 0 -xx2 0 -bool 0 -enum xxx -uint-unl 0 -pint-unl 0\
- -string '' -filename '' -- $operand"
+ -string '' -filename '' -color magenta -- $operand"
}
# Return a string for the expected result of running "maint
# test-options xxx", with -flag set. OPERAND is the expected operand.
proc expect_flag {operand} {
return "-flag 1 -xx1 0 -xx2 0 -bool 0 -enum xxx -uint-unl 0 -pint-unl 0\
- -string '' -filename '' -- $operand"
+ -string '' -filename '' -color magenta -- $operand"
}
# Return a string for the expected result of running "maint
# test-options xxx", with -bool set. OPERAND is the expected operand.
proc expect_bool {operand} {
return "-flag 0 -xx1 0 -xx2 0 -bool 1 -enum xxx -uint-unl 0 -pint-unl 0\
- -string '' -filename '' -- $operand"
+ -string '' -filename '' -color magenta -- $operand"
}
# Return a string for the expected result of running "maint
@@ -123,10 +123,10 @@ proc expect_bool {operand} {
proc expect_integer {option val operand} {
if {$option == "uinteger-unlimited"} {
return "-flag 0 -xx1 0 -xx2 0 -bool 0 -enum xxx -uint-unl $val\
- -pint-unl 0 -string '' -filename '' -- $operand"
+ -pint-unl 0 -string '' -filename '' -color magenta -- $operand"
} elseif {$option == "pinteger-unlimited"} {
return "-flag 0 -xx1 0 -xx2 0 -bool 0 -enum xxx -uint-unl 0\
- -pint-unl $val -string '' -filename '' -- $operand"
+ -pint-unl $val -string '' -filename '' -color magenta -- $operand"
} else {
error "unsupported option: $option"
}
@@ -144,7 +144,7 @@ proc expect_string {str operand} {
set str [string range $str 1 end-1]
}
return "-flag 0 -xx1 0 -xx2 0 -bool 0 -enum xxx -uint-unl 0 -pint-unl 0\
- -string '$str' -filename '' -- $operand"
+ -string '$str' -filename '' -color magenta -- $operand"
}
# Return a string for the expected result of running "maint
@@ -159,11 +159,12 @@ proc expect_filename {str operand} {
set str [string range $str 1 end-1]
}
return "-flag 0 -xx1 0 -xx2 0 -bool 0 -enum xxx -uint-unl 0 -pint-unl 0\
- -string '' -filename '$str' -- $operand"
+ -string '' -filename '$str' -color magenta -- $operand"
}
set all_options {
"-bool"
+ "-color"
"-enum"
"-filename"
"-flag"
@@ -628,7 +629,7 @@ proc_with_prefix test-flag {variant} {
# Extract twice the same flag, separated by one space.
gdb_test "$cmd -xx1 -xx2 -xx1 -xx2 -xx1 -- non flags args" \
"-flag 0 -xx1 1 -xx2 1 -bool 0 -enum xxx -uint-unl 0 -pint-unl 0\
- -string '' -filename '' -- non flags args"
+ -string '' -filename '' -color magenta -- non flags args"
# Extract 2 known flags in front of unknown flags.
gdb_test "$cmd -xx1 -xx2 -a -b -c -xx1 --" \