[V2,2/5] gdb/testsuite: Fix style.exp failures on targets without libopcodes styling
Commit Message
Do not expect disassembler output to be styled by libopcodes if GDB
reports the target does not support that.
---
gdb/testsuite/gdb.base/style.exp | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
@@ -24,6 +24,26 @@ if {[build_executable "failed to build" $testfile $srcfile {debug macros}]} {
return -1
}
+# Check whether libopcodes styling is supported for this target.
+set have_libopcodes_styling 1
+proc test_for_libopcodes_styling {} {
+ global binfile
+ global have_libopcodes_styling
+ clean_restart ${binfile}
+
+ gdb_test_multiple "maint set libopcodes-styling enabled on" "" {
+ -re "^maint set libopcodes-styling enabled on\r\n" {
+ exp_continue
+ }
+ -re "Use of libopcodes styling not supported on architecture \[^\r\n\]+\r\n" {
+ set have_libopcodes_styling 0
+ exp_continue
+ }
+ -re "^$::gdb_prompt $" {
+ }
+ }
+}
+
# The tests in this file are run multiple times with GDB's styles
# disabled one at a time. This variable is the style that is
# currently disabled.
@@ -68,6 +88,7 @@ proc clean_restart_and_disable { prefix args } {
proc run_style_tests { } {
global testfile srcfile hex binfile
global currently_disabled_style decimal hex
+ global have_libopcodes_styling
save_vars { env(TERM) } {
# We need an ANSI-capable terminal to get the output.
@@ -195,7 +216,7 @@ proc run_style_tests { } {
# symbol will be styled. However, if pygments is not being
# used then we can know how the symbol name will be styled.
set main [limited_style main function]
- if { $::python_disassembly_styling } {
+ if { $::python_disassembly_styling || !$have_libopcodes_styling } {
set func "some_called_function"
} else {
set func [limited_style some_called_function function]
@@ -495,6 +516,9 @@ if {[allow_python_tests] && [gdb_py_module_available "pygments"]} {
set python_disassembly_styling false
}
+# Check to see if libopcodes styling is available for this target
+test_for_libopcodes_styling
+
# Run tests with all styles in their default state.
with_test_prefix "all styles enabled" {
run_style_tests