From: Sandra Loosemore <sandra@codesourcery.com>
To: <gdb-patches@sourceware.org>
Cc: <tom@tromey.com>
Subject: [PATCH V2 2/5] gdb/testsuite: Fix style.exp failures on targets without libopcodes styling
Date: Sun, 23 Apr 2023 13:31:56 -0600 [thread overview]
Message-ID: <20230423193159.576300-3-sandra@codesourcery.com> (raw)
In-Reply-To: <20230423193159.576300-1-sandra@codesourcery.com>
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(-)
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index 60f909e2402..94c9dc46d73 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -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
--
2.31.1
next prev parent reply other threads:[~2023-04-23 19:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-23 19:31 [PATCH V2 0/5] gdb/testsuite: Miscelleanous fixes Sandra Loosemore
2023-04-23 19:31 ` [PATCH V2 1/5] gdb/testsuite: Fix style.exp failures on targets without argc/argv support Sandra Loosemore
2023-04-23 19:31 ` Sandra Loosemore [this message]
2023-04-23 19:31 ` [PATCH V2 3/5] gdb/testsuite: Adjust some testcases to allow Windows pathnames Sandra Loosemore
2023-04-24 17:16 ` [PATCH V2 0/5] gdb/testsuite: Miscelleanous fixes Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230423193159.576300-3-sandra@codesourcery.com \
--to=sandra@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).