129 lines
3.7 KiB
Plaintext
129 lines
3.7 KiB
Plaintext
# Copyright 1999-2017 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/>.
|
|
|
|
# Tests for reference types with short type variables in GDB, based on
|
|
# gdb.cp/ref-types.exp.
|
|
|
|
if { [skip_cplus_tests] } { continue }
|
|
|
|
standard_testfile .cc
|
|
|
|
if {[prepare_for_testing $testfile.exp $testfile $srcfile \
|
|
{debug c++ additional_flags="-std=gnu++11"}]} {
|
|
return -1
|
|
}
|
|
|
|
#
|
|
# Set it up at a breakpoint so we can play with the variable values.
|
|
#
|
|
if {![runto_main]} {
|
|
untested "couldn't run to breakpoint"
|
|
return -1
|
|
}
|
|
|
|
if {![runto 'marker1']} {
|
|
untested "couldn't run to marker1"
|
|
return -1
|
|
}
|
|
|
|
gdb_test "up" ".*main.*" "up from marker1 1"
|
|
|
|
gdb_test "print rrt" " = \\(short( int)? &&\\) @$hex: -1" "print value of rrt"
|
|
|
|
gdb_test "ptype rrt" "type = short( int)? &&" "ptype rrt"
|
|
|
|
gdb_test "print *rrpt" ".$decimal = -1" "print value of *rrpt"
|
|
|
|
# gdb had a bug about dereferencing a pointer type
|
|
# that would lead to wrong results
|
|
# if we try to examine memory at pointer value.
|
|
|
|
gdb_test "x /hd rrpt" "$hex:\[ \t\]*-1" "examine value at rrpt"
|
|
|
|
gdb_test "ptype rrpt" "type = short( int)? \\*&&" "ptype rrpt"
|
|
|
|
gdb_test "print rrat\[0\]" ".$decimal = 0" "print value of rrat\[0\]"
|
|
|
|
gdb_test "ptype rrat" "type = short( int)? \\\(&&\\\)\\\[4\\\]" "ptype rrat"
|
|
|
|
gdb_test "print rrat\[1\]" ".$decimal = 1" "print value of rrat\[1\]"
|
|
gdb_test "print rrat\[2\]" ".$decimal = 2" "print value of rrat\[2\]"
|
|
gdb_test "print rrat\[3\]" ".$decimal = 3" "print value of rrat\[3\]"
|
|
|
|
|
|
if {![runto 'f']} then {
|
|
perror "couldn't run to f"
|
|
continue
|
|
}
|
|
|
|
gdb_test "up" ".main2.*" "up from f"
|
|
|
|
gdb_test "ptype rrC" "type = char &&"
|
|
|
|
gdb_test "ptype rrUC" "type = unsigned char &&"
|
|
|
|
gdb_test "ptype rrS" "type = short( int)? &&" "ptype rrS"
|
|
|
|
gdb_test "ptype rrUS" "type = unsigned short( int)? &&" "ptype rrUS"
|
|
|
|
gdb_test "ptype rrI" "type = int &&"
|
|
|
|
gdb_test "ptype rrUI" "type = unsigned int &&"
|
|
|
|
gdb_test "ptype rrL" "type = long( int)? &&" "ptype rrL"
|
|
|
|
gdb_test "ptype rrUL" "type = unsigned long( int)? &&" "ptype rrUL"
|
|
|
|
gdb_test "ptype rrF" "type = float &&"
|
|
|
|
gdb_test "ptype rrD" "type = double &&"
|
|
|
|
gdb_test "print rrC" "$decimal = \\(char &&\\) @$hex: 65 \'A\'" \
|
|
"print value of rrC"
|
|
|
|
gdb_test "print rrUC" \
|
|
"$decimal = \\(unsigned char &&\\) @$hex: 21 \'.025\'" \
|
|
"print value of rrUC"
|
|
|
|
gdb_test "print rrS" "$decimal = \\(short( int)? &&\\) @$hex: -14" \
|
|
"print value of rrS"
|
|
|
|
gdb_test "print rrUS" \
|
|
"$decimal = \\(unsigned short( int)? &&\\) @$hex: 7" \
|
|
"print value of rrUS"
|
|
|
|
gdb_test "print rrI" "$decimal = \\(int &&\\) @$hex: 102" \
|
|
"print value of rrI"
|
|
|
|
gdb_test "print rrUI" \
|
|
"$decimal = \\(unsigned int &&\\) @$hex: 1002" \
|
|
"print value of rrUI"
|
|
|
|
gdb_test "print rrL" \
|
|
"$decimal = \\(long( int)? &&\\) @$hex: -234" \
|
|
"print value of rrL"
|
|
|
|
gdb_test "print rrUL" \
|
|
"$decimal = \\((unsigned long|long unsigned int)? &&\\) @$hex: 234" \
|
|
"print value of rrUL"
|
|
|
|
gdb_test "print rrF" \
|
|
"$decimal = \\(float &&\\) @$hex: 1.2${decimal}e\\+0?10.*" \
|
|
"print value of rrF"
|
|
|
|
gdb_test "print rrD" \
|
|
"$decimal = \\(double &&\\) @$hex: -1.375e-123.*" \
|
|
"print value of rrD"
|