-# Copyright (C) 2010-2013 Free Software Foundation, Inc.
+# Copyright (C) 2010-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
standard_testfile
-if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
return -1
}
if { [skip_python_tests] } { continue }
if ![runto_main ] then {
- fail "Can't run to main"
+ fail "can't run to main"
return -1
}
".*Breakpoint.*"
gdb_test "continue" ".*Breakpoint.*"
-set python_file ${srcdir}/${subdir}/${testfile}.py
+set python_file [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
-gdb_test_no_output "python exec (open ('${python_file}').read ())" ""
+gdb_test_no_output "source ${python_file}" "load python file"
gdb_test "info pretty-printer" \
{.*function_lookup_test.*pp-test.*struct ss.*}
gdb_test "print ss" " = a=<a=<1> b=<$hex>> b=<a=<2> b=<$hex>>" \
"print ss enabled #1"
-set num_pp 6
+set num_pp 7
gdb_test "disable pretty-printer" \
"$num_pp printers disabled.*0 of $num_pp printers enabled"
"1 printer disabled.*[expr $num_pp - 1] of $num_pp printers enabled"
gdb_test "disable pretty-printer global pp-test;.*" \
- "[expr $num_pp - 1] printers disabled.*0 of $num_pp printers enabled"
+ "[expr $num_pp - 2] printers disabled.*1 of $num_pp printers enabled"
gdb_test "info pretty-printer global .*function" \
{.*function_lookup_test \[disabled\].*}
"print ss disabled"
gdb_test "enable pretty-printer global lookup_function_lookup_test" \
- "1 printer enabled.*1 of $num_pp printers enabled"
+ "1 printer enabled.*2 of $num_pp printers enabled"
# This doesn't enable any printers because each subprinter in the collection
# is still individually disabled. But this is still needed, to enable the
# collection itself.
gdb_test "enable pretty-printer global pp-test" \
- "0 printers enabled.*1 of $num_pp printers enabled"
+ "0 printers enabled.*2 of $num_pp printers enabled"
gdb_test "enable pretty-printer global pp-test;.*ss.*" \
"2 printers enabled.*[expr $num_pp - 3] of $num_pp printers enabled"
gdb_test "print ss" " = a=<a=<1> b=<$hex>> b=<a=<2> b=<$hex>>" \
"print ss re-enabled"
-gdb_test "print (enum flag_enum) (FLAG_1)" \
- " = 0x1 .FLAG_1." \
- "print FLAG_1"
+gdb_test_exact "print (enum flag_enum) (FOO_1)" \
+ { = 0x1 [FOO_1]}
-gdb_test "print (enum flag_enum) (FLAG_1 | FLAG_3)" \
- " = 0x5 .FLAG_1 | FLAG_3." \
- "print FLAG_1 | FLAG_3"
+gdb_test_exact "print (enum flag_enum) (BAR_3)" \
+ { = 0x40 [BAR_3]}
-gdb_test "print (enum flag_enum) (4 + 8)" \
- " = 0xc .FLAG_1 | <unknown: 0x8>." \
- "print FLAG_1 | 8"
+gdb_test_exact "print (enum flag_enum) (BAR_2 | FOO_2)" \
+ { = 0x22 [FOO_2 | BAR_2]}
+
+gdb_test_exact "print (enum flag_enum) (FOO_1 | FOO_2 | FOO_3)" \
+ { = 0x7 [FOO_1 | FOO_2 | FOO_3]}
+
+gdb_test_exact "print (enum flag_enum) (FOO_MASK)" \
+ { = 0x7 [FOO_1 | FOO_2 | FOO_3]}
+
+gdb_test_exact "print (enum flag_enum) (FOO_MASK | (BAR_MASK & ~BAR_2))" \
+ { = 0x57 [FOO_1 | FOO_2 | FOO_3 | BAR_1 | BAR_3]}
+
+gdb_test_exact "print (enum flag_enum) (0x4 + 0x8)" \
+ { = 0xc [FOO_3 | <unknown: 0x8>]}