From: Andrew Burgess Date: Mon, 17 Feb 2025 10:51:30 +0000 (+0000) Subject: gdb/tui: use correct setting to control asm window styling X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dbfac07a71613288529d4b40c9a48ad76c19b360;p=thirdparty%2Fbinutils-gdb.git gdb/tui: use correct setting to control asm window styling Currently the TUI's asm window uses `source_styling` to control styling. This setting is supposed to be for styling of source files though, and the asm window displays disassembler output. We have a different setting for this `disassemble_styling`, which is controlled with 'set style disassembler enabled on|off'. Switch to use the correct control variable. I've written a new test for this, but this required some additions to the tuiterm library in order to grab character attributes for a screen region. Approved-By: Tom Tromey --- diff --git a/gdb/testsuite/gdb.tui/tui-disasm-styling.exp b/gdb/testsuite/gdb.tui/tui-disasm-styling.exp new file mode 100644 index 00000000000..513d787b4b7 --- /dev/null +++ b/gdb/testsuite/gdb.tui/tui-disasm-styling.exp @@ -0,0 +1,65 @@ +# Copyright 2025 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 +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test that disassembler styling can be switched off. + +require allow_tui_tests + +tuiterm_env + +standard_testfile tui-layout.c + +if {[build_executable "failed to build" ${testfile} ${srcfile}] == -1} { + return +} + +# Grab the contents of the asm box and check for styling. If +# EXPECT_STYLED is true then expect styling in the asm box, otherwise, +# don't expect styling. + +proc check_asm_output { expect_styled testname } { + set asm_output [Term::get_region 1 1 78 13 "\n" true] + set has_styling [regexp -- "can_emit_style_escape (); + bool term_out = disassembler_styling && gdb_stdout->can_emit_style_escape (); string_file gdb_dis_out (term_out); /* Must start with an empty list. */