forked from Imagelibrary/binutils-gdb
A user found that gdb would not correctly print a field from an Ada
record using the scalar storage order feature. We tracked this down
to a combination of problems.
First, GCC did not emit DW_AT_endianity on the enumeration type.
DWARF does not specify this, but it is an obvious and harmless
extension. This was fixed in GCC recently:
https://gcc.gnu.org/pipermail/gcc-patches/2024-January/642347.html
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5d8b60effc7268448a94fbbbad923ab6871252cd
Second, GDB did not handle this attribute on enumeration types. This
patch makes this change and adds a test case that will pass with the
patched GCC.
So far, the GCC patch isn't on the gcc-13 branch; but if it ever goes
in, the test case in this patch can be updated to reflect that.
Reviewed-By: Keith Seitz <keiths@redhat.com>
43 lines
1.4 KiB
Plaintext
43 lines
1.4 KiB
Plaintext
# Copyright 2019-2024 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 that range types with scalar storage order are handled
|
|
# properly.
|
|
|
|
load_lib "ada.exp"
|
|
|
|
require allow_ada_tests
|
|
|
|
standard_ada_testfile storage
|
|
|
|
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
|
|
return -1
|
|
}
|
|
|
|
clean_restart ${testfile}
|
|
|
|
set bp_location [gdb_get_line_number "START" ${testdir}/storage.adb]
|
|
if {![runto "storage.adb:$bp_location"]} {
|
|
return
|
|
}
|
|
|
|
gdb_test "print V_LE" "= \\(value => 126, another_value => 12, color => green\\)"
|
|
|
|
# This requires a compiler fix that is in GCC 14.
|
|
if {[gcc_major_version] < 14} {
|
|
setup_kfail "DW_AT_endianity on enum types" *-*-*
|
|
}
|
|
gdb_test "print V_BE" "= \\(value => 126, another_value => 12, color => green\\)"
|