mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
3f0cbb04d0
This changes gdb to use the "variable" style when printing field names. I've added new tests for C and Rust, but not other languages. I chose "variable" because that seemed most straightforward. However, another option would be to introduce a new "field" style. Similarly, this patch uses the variable style for enumerator constants -- but again, a new style could be used if that's preferred. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * valprint.c (generic_val_print_enum_1) (val_print_type_code_flags): Style member names. * rust-lang.c (val_print_struct, rust_print_enum) (rust_print_struct_def, rust_internal_print_type): Style member names. * p-valprint.c (pascal_object_print_value_fields): Style member names. Only call fprintf_symbol_filtered for static members. * m2-typeprint.c (m2_record_fields, m2_enum): Style member names. * f-valprint.c (f_val_print): Style member names. * f-typeprint.c (f_type_print_base): Style member names. * cp-valprint.c (cp_print_value_fields): Style member names. Only call fprintf_symbol_filtered for static members. (cp_print_class_member): Style member names. * c-typeprint.c (c_print_type_1, c_type_print_base_1): Style member names. * ada-valprint.c (ada_print_scalar): Style enum names. (ada_val_print_enum): Likewise. * ada-typeprint.c (print_enum_type): Style enum names. gdb/testsuite/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * gdb.rust/rust-style.rs: New file. * gdb.rust/rust-style.exp: New file. * gdb.base/style.exp: Test structure printing. * gdb.base/style.c (struct some_struct): New type. (enum etype): New type. (struct_value): New global. Change-Id: I070e1293c6cc830c9ea916af8243410aa384e944
45 lines
1.3 KiB
Plaintext
45 lines
1.3 KiB
Plaintext
# Copyright 2020 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 <http://www.gnu.org/licenses/>.
|
|
|
|
# Test CLI output styling for Rust.
|
|
|
|
load_lib rust-support.exp
|
|
if {[skip_rust_tests]} {
|
|
continue
|
|
}
|
|
|
|
save_vars { env(TERM) } {
|
|
# We need an ANSI-capable terminal to get the output.
|
|
setenv TERM ansi
|
|
|
|
standard_testfile .rs
|
|
if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
|
|
{debug rust}]} {
|
|
return -1
|
|
}
|
|
|
|
set line [gdb_get_line_number "breakpoint"]
|
|
if {![runto ${srcfile}:$line]} {
|
|
untested "could not run to breakpoint"
|
|
return -1
|
|
}
|
|
|
|
set vfield [style value variable]
|
|
set v2field [style value2 variable]
|
|
gdb_test "print v" \
|
|
"Two\{$vfield: 23, $v2field: 97\}"
|
|
|
|
}
|