forked from Imagelibrary/binutils-gdb
Note that the ptype information printed for types described
via pure DWARF debug info is slightly less informative as
the one printed when the information is encoded in the type's
name, via the GNAT encoding. As a result, the output in
the case of DWARF-described fixed point types is slightly
different. In pratice, this is no real loss because the information
not available in DWARF has no bearing on how the type is actually
stored in memory.
gdb/ChangeLog:
* ada-typeprint.c (ada_print_type): Add handing of fixed-point
range types.
* c-typeprint.c (c_type_print_varspec_prefix)
(c_type_print_varspec_suffix, c_type_print_base_1): Add
TYPE_CODE_FIXED_POINT handling.
* p-typeprint.c (pascal_type_print_varspec_prefix)
(pascal_type_print_varspec_suffix): Likewise.
* typeprint.c (print_type_fixed_point): New function.
* typeprint.h (print_type_fixed_point): Add declaration.
gdb/testsuite/ChangeLog:
* gdb.ada/fixed_points.exp: Add ptype tests.
* gdb.dwarf2/dw2-fixed-point.exp: Likewise.
99 lines
2.9 KiB
Plaintext
99 lines
2.9 KiB
Plaintext
# Copyright 2004-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/>.
|
|
|
|
load_lib "ada.exp"
|
|
|
|
if { [skip_ada_tests] } { return -1 }
|
|
|
|
standard_ada_testfile fixed_points
|
|
|
|
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
|
|
return -1
|
|
}
|
|
|
|
clean_restart ${testfile}
|
|
|
|
set bp_location [gdb_get_line_number "Set breakpoint here" ${testdir}/fixed_points.adb]
|
|
runto "fixed_points.adb:$bp_location"
|
|
|
|
# Fixed point subtypes:
|
|
|
|
gdb_test "print base_object" \
|
|
"= -50" \
|
|
"p on a fixed point type"
|
|
|
|
gdb_test "print subtype_object" \
|
|
"= -50" \
|
|
"p on a subtype fixed point type"
|
|
|
|
gdb_test "print new_type_object" \
|
|
"= -50" \
|
|
"p on a new fixed point type"
|
|
|
|
# Overprecise delta:
|
|
|
|
gdb_test "print Overprecise_Object" \
|
|
"= 0.13579135791"
|
|
|
|
gdb_test "ptype Overprecise_Object" \
|
|
"= delta 0.135791"
|
|
|
|
# FP*_Var...
|
|
|
|
gdb_test "print fp1_var" \
|
|
" = 0.25"
|
|
|
|
gdb_test_multiple "ptype fp1_var" "" {
|
|
-re "type = <1-byte fixed point \\(small = 0\\.0625\\)>\r\n$gdb_prompt $" {
|
|
pass $gdb_test_name
|
|
}
|
|
-re "type = delta 0\\.1 <'small = 0\\.0625>\r\n$gdb_prompt $" {
|
|
# The (legacy) output we obtain when the compiler described
|
|
# our fixed point types using the GNAT encodings rather than
|
|
# standard DWARF. OK as well.
|
|
pass $gdb_test_name
|
|
}
|
|
}
|
|
|
|
gdb_test "print fp2_var" \
|
|
" = -0.01"
|
|
|
|
gdb_test_multiple "ptype fp2_var" "" {
|
|
-re "type = <8-byte fixed point \\(small = 0\\.01\\)>\r\n$gdb_prompt $" {
|
|
pass $gdb_test_name
|
|
}
|
|
-re "type = delta 0\\.01\r\n$gdb_prompt $" {
|
|
# The (legacy) output we obtain when the compiler described
|
|
# our fixed point types using the GNAT encodings rather than
|
|
# standard DWARF. OK as well.
|
|
pass $gdb_test_name
|
|
}
|
|
}
|
|
|
|
gdb_test "print fp3_var" \
|
|
" = 0.1"
|
|
|
|
gdb_test_multiple "ptype fp3_var" "" {
|
|
-re "type = <1-byte fixed point \\(small = 0\\.0333333\\)>\r\n$gdb_prompt $" {
|
|
pass $gdb_test_name
|
|
}
|
|
-re "type = delta 0\\.1 <'small = 0\\.0333333>\r\n$gdb_prompt $" {
|
|
# The (legacy) output we obtain when the compiler described
|
|
# our fixed point types using the GNAT encodings rather than
|
|
# standard DWARF. OK as well.
|
|
pass $gdb_test_name
|
|
}
|
|
}
|