forked from Imagelibrary/binutils-gdb
Changes in v3: - Adjusted some testcases where the message "failed to compile" was not unique. Changes in v2: - Addressed comments from reviewers. - Fixed spurious whitespaces. - Changed compilation failure messages that included source/binary paths to ones that are short and deterministic. --- Another bit of cleanup to the testsuite. We have a number of tests that are not honoring the rule of not outputting their own name as a test name. I fixed up all the offenders i could find with the following regular expression: "(xfail|kfail|kpass|fail|pass|unsupported|untested) ([A-Za-z0-9]+|\\\$(.)*testfile(.)*)\.exp$" gdb/testsuite/ChangeLog: 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names and standardize compilation error messages throughout the following files: * gdb.ada/start.exp * gdb.arch/alpha-step.exp * gdb.arch/e500-prologue.exp * gdb.arch/ftrace-insn-reloc.exp * gdb.arch/gdb1291.exp * gdb.arch/gdb1431.exp * gdb.arch/gdb1558.exp * gdb.arch/i386-dr3-watch.exp * gdb.arch/i386-sse-stack-align.exp * gdb.arch/ia64-breakpoint-shadow.exp * gdb.arch/pa-nullify.exp * gdb.arch/powerpc-aix-prologue.exp * gdb.arch/thumb-bx-pc.exp * gdb.base/annota1.exp * gdb.base/annota3.exp * gdb.base/arrayidx.exp * gdb.base/assign.exp * gdb.base/attach.exp * gdb.base/auxv.exp * gdb.base/bang.exp * gdb.base/bfp-test.exp * gdb.base/bigcore.exp * gdb.base/bitfields2.exp * gdb.base/break-fun-addr.exp * gdb.base/break-probes.exp * gdb.base/call-rt-st.exp * gdb.base/callexit.exp * gdb.base/catch-fork-kill.exp * gdb.base/charset.exp * gdb.base/checkpoint.exp * gdb.base/comprdebug.exp * gdb.base/constvars.exp * gdb.base/coredump-filter.exp * gdb.base/cursal.exp * gdb.base/cvexpr.exp * gdb.base/detach.exp * gdb.base/display.exp * gdb.base/dmsym.exp * gdb.base/dprintf-pending.exp * gdb.base/dso2dso.exp * gdb.base/dtrace-probe.exp * gdb.base/dump.exp * gdb.base/enum_cond.exp * gdb.base/exe-lock.exp * gdb.base/exec-invalid-sysroot.exp * gdb.base/execl-update-breakpoints.exp * gdb.base/exprs.exp * gdb.base/fileio.exp * gdb.base/find.exp * gdb.base/finish.exp * gdb.base/fixsection.exp * gdb.base/foll-vfork.exp * gdb.base/frame-args.exp * gdb.base/gcore.exp * gdb.base/gdb1250.exp * gdb.base/global-var-nested-by-dso.exp * gdb.base/gnu-ifunc.exp * gdb.base/hashline1.exp * gdb.base/hashline2.exp * gdb.base/hashline3.exp * gdb.base/hbreak-in-shr-unsupported.exp * gdb.base/huge.exp * gdb.base/infcall-input.exp * gdb.base/info-fun.exp * gdb.base/info-shared.exp * gdb.base/jit-simple.exp * gdb.base/jit-so.exp * gdb.base/jit.exp * gdb.base/jump.exp * gdb.base/label.exp * gdb.base/lineinc.exp * gdb.base/logical.exp * gdb.base/longjmp.exp * gdb.base/macscp.exp * gdb.base/miscexprs.exp * gdb.base/new-ui-echo.exp * gdb.base/new-ui-pending-input.exp * gdb.base/new-ui.exp * gdb.base/nodebug.exp * gdb.base/nofield.exp * gdb.base/offsets.exp * gdb.base/overlays.exp * gdb.base/pending.exp * gdb.base/pointers.exp * gdb.base/pr11022.exp * gdb.base/printcmds.exp * gdb.base/prologue.exp * gdb.base/ptr-typedef.exp * gdb.base/realname-expand.exp * gdb.base/relativedebug.exp * gdb.base/relocate.exp * gdb.base/remote.exp * gdb.base/reread.exp * gdb.base/return2.exp * gdb.base/savedregs.exp * gdb.base/sep.exp * gdb.base/sepdebug.exp * gdb.base/sepsymtab.exp * gdb.base/set-inferior-tty.exp * gdb.base/setshow.exp * gdb.base/shlib-call.exp * gdb.base/sigaltstack.exp * gdb.base/siginfo-addr.exp * gdb.base/signals.exp * gdb.base/signull.exp * gdb.base/sigrepeat.exp * gdb.base/so-impl-ld.exp * gdb.base/solib-display.exp * gdb.base/solib-overlap.exp * gdb.base/solib-search.exp * gdb.base/solib-symbol.exp * gdb.base/structs.exp * gdb.base/structs2.exp * gdb.base/symtab-search-order.exp * gdb.base/twice.exp * gdb.base/unload.exp * gdb.base/varargs.exp * gdb.base/watchpoint-solib.exp * gdb.base/watchpoint.exp * gdb.base/whatis.exp * gdb.base/wrong_frame_bt_full.exp * gdb.btrace/dlopen.exp * gdb.cell/ea-standalone.exp * gdb.cell/ea-test.exp * gdb.cp/dispcxx.exp * gdb.cp/gdb2384.exp * gdb.cp/method2.exp * gdb.cp/nextoverthrow.exp * gdb.cp/pr10728.exp * gdb.disasm/am33.exp * gdb.disasm/h8300s.exp * gdb.disasm/mn10300.exp * gdb.disasm/sh3.exp * gdb.dwarf2/dw2-dir-file-name.exp * gdb.fortran/complex.exp * gdb.fortran/library-module.exp * gdb.guile/scm-pretty-print.exp * gdb.guile/scm-symbol.exp * gdb.guile/scm-type.exp * gdb.guile/scm-value.exp * gdb.linespec/linespec.exp * gdb.mi/gdb701.exp * gdb.mi/gdb792.exp * gdb.mi/mi-breakpoint-changed.exp * gdb.mi/mi-dprintf-pending.exp * gdb.mi/mi-dprintf.exp * gdb.mi/mi-exit-code.exp * gdb.mi/mi-pending.exp * gdb.mi/mi-solib.exp * gdb.mi/new-ui-mi-sync.exp * gdb.mi/pr11022.exp * gdb.mi/user-selected-context-sync.exp * gdb.opt/solib-intra-step.exp * gdb.python/py-events.exp * gdb.python/py-finish-breakpoint.exp * gdb.python/py-mi.exp * gdb.python/py-prettyprint.exp * gdb.python/py-shared.exp * gdb.python/py-symbol.exp * gdb.python/py-template.exp * gdb.python/py-type.exp * gdb.python/py-value.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/solib-reverse.exp * gdb.server/solib-list.exp * gdb.stabs/weird.exp * gdb.threads/reconnect-signal.exp * gdb.threads/stepi-random-signal.exp * gdb.trace/actions.exp * gdb.trace/ax.exp * gdb.trace/backtrace.exp * gdb.trace/change-loc.exp * gdb.trace/deltrace.exp * gdb.trace/ftrace-lock.exp * gdb.trace/ftrace.exp * gdb.trace/infotrace.exp * gdb.trace/mi-tracepoint-changed.exp * gdb.trace/packetlen.exp * gdb.trace/passcount.exp * gdb.trace/pending.exp * gdb.trace/range-stepping.exp * gdb.trace/report.exp * gdb.trace/stap-trace.exp * gdb.trace/tfind.exp * gdb.trace/trace-break.exp * gdb.trace/trace-condition.exp * gdb.trace/trace-enable-disable.exp * gdb.trace/trace-mt.exp * gdb.trace/tracecmd.exp * gdb.trace/tspeed.exp * gdb.trace/tsv.exp * lib/perftest.exp
292 lines
8.0 KiB
Plaintext
292 lines
8.0 KiB
Plaintext
# Copyright 1992-2016 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/>.
|
|
|
|
# This file was adapted from bitfields.exp by Paul Hilfinger
|
|
# (Hilfinger@gnat.com)
|
|
|
|
#
|
|
# Tests for bit-fields that do not fit in type (unsigned) int, but do fit
|
|
# in type (unsigned) long long. We perform essentially the same tests as
|
|
# in bitfields.c, which considers only bit-fields that are <= 9 bits long.
|
|
#
|
|
|
|
|
|
standard_testfile .c
|
|
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
|
untested "failed to compile"
|
|
return -1
|
|
}
|
|
|
|
set has_signed_bitfields 1
|
|
|
|
#
|
|
# Continue to expected breakpoint at FUNCTION. Append TAG to make pass/fail
|
|
# messages (to make them unique). Suppress tests on failure.
|
|
#
|
|
proc continue_test { function tag } {
|
|
global decimal
|
|
global srcfile
|
|
|
|
if [gdb_test "cont" "Break.*$function \\(\\) at .*$srcfile:$decimal.*" "continuing to $function $tag"] {
|
|
gdb_suppress_tests
|
|
}
|
|
}
|
|
|
|
#
|
|
# Start next test by running to tester and then to FUNCTION. Suppresses
|
|
# tests on failure.
|
|
#
|
|
proc start_test { function } {
|
|
delete_breakpoints
|
|
if [gdb_test "break tester" ".*" "break tester prior to $function"] {
|
|
gdb_suppress_tests
|
|
}
|
|
continue_test "tester" "prior to $function"
|
|
if ![gdb_breakpoint $function] {
|
|
gdb_suppress_tests
|
|
}
|
|
continue_test $function "#0"
|
|
}
|
|
|
|
|
|
#
|
|
# Test bitfield locating and uniqueness.
|
|
# For each member, set that member to 1 and verify that the member (and only
|
|
# that member) is 1, then reset it back to 0.
|
|
#
|
|
|
|
proc bitfield_uniqueness {} {
|
|
global decimal
|
|
global hex
|
|
global gdb_prompt
|
|
global srcfile
|
|
|
|
start_test break1
|
|
|
|
if [gdb_test "print flags" ".*u1 = 0, u2 = 0, u3 = 0, s1 = 1, s2 = 0, s3 = 0.*" "bitfield uniqueness; flags.s1 = 1"] {
|
|
gdb_suppress_tests
|
|
}
|
|
continue_test break1 "#1"
|
|
if [gdb_test "print flags" ".*u1 = 1, u2 = 0, u3 = 0, s1 = 0, s2 = 0, s3 = 0.*" "bitfield uniqueness; flags.u1 = 1"] {
|
|
gdb_suppress_tests
|
|
}
|
|
continue_test break1 "#2"
|
|
if [gdb_test "print flags" ".*u1 = 0, u2 = 0, u3 = 0, s1 = 0, s2 = 1, s3 = 0.*" "bitfield uniqueness; flags.s2 = 1"] {
|
|
gdb_suppress_tests
|
|
}
|
|
continue_test break1 "#3"
|
|
if [gdb_test "print flags" ".*u1 = 0, u2 = 1, u3 = 0, s1 = 0, s2 = 0, s3 = 0.*" "bitfield uniqueness; flags.u2 = 1"] {
|
|
gdb_suppress_tests
|
|
}
|
|
continue_test break1 "#4"
|
|
if [gdb_test "print flags" ".*u1 = 0, u2 = 0, u3 = 0, s1 = 0, s2 = 0, s3 = 1.*" "bitfield uniqueness; flags.s3 = 1"] {
|
|
gdb_suppress_tests
|
|
}
|
|
continue_test break1 "#5"
|
|
if [gdb_test "print flags" ".*u1 = 0, u2 = 0, u3 = 1, s1 = 0, s2 = 0, s3 = 0.*" "bitfield uniqueness; flags.u3 = 1"] {
|
|
gdb_suppress_tests
|
|
}
|
|
gdb_stop_suppressing_tests
|
|
}
|
|
|
|
|
|
#
|
|
# Test bitfield containment.
|
|
# Fill alternating fields with all 1's and verify that none of the bits
|
|
# "bleed over" to the other fields.
|
|
#
|
|
|
|
proc bitfield_containment {} {
|
|
global decimal
|
|
global hex
|
|
global gdb_prompt
|
|
global srcfile
|
|
|
|
start_test break2
|
|
|
|
# If program is compiled with Sun CC, signed fields print out as their
|
|
# actual sizes; if compiled with gcc, they print out as 0xffffffff.
|
|
if [gdb_test "print/x flags" "= {u1 = 0x7fff, u2 = 0x0, u3 = 0xffff, s1 = 0x0, s2 = 0x(1ffffffff|f*), s3 = 0x0}" "bitfield containment; flags.u1, flags.u3, and flags.s3 to all 1s"] {
|
|
gdb_suppress_tests
|
|
}
|
|
|
|
continue_test break2 "#1"
|
|
|
|
if [gdb_test "print/x flags" "= {u1 = 0x0, u2 = 0x1ffffffff, u3 = 0x0, s1 = 0x(7fff|f*), s2 = 0x0, s3 = 0xf*}" "bitfield containment; flags.u2, flags.s1, flags.s2 to all 1s"] {
|
|
gdb_suppress_tests
|
|
}
|
|
gdb_stop_suppressing_tests
|
|
}
|
|
|
|
# Test unsigned bitfields for unsignedness and range.
|
|
# Fill the unsigned fields with the maximum positive value and verify that
|
|
# the values are printed correctly.
|
|
|
|
proc bitfield_unsignedness {} {
|
|
global decimal
|
|
global hex
|
|
global gdb_prompt
|
|
global srcfile
|
|
|
|
start_test break3
|
|
|
|
if [gdb_test "print flags" ".*u1 = 32767, u2 = 8589934591, u3 = 65535, s1 = 0, s2 = 0, s3 = 0.*" "maximum unsigned bitfield values"] {
|
|
gdb_suppress_tests
|
|
}
|
|
gdb_stop_suppressing_tests
|
|
}
|
|
|
|
#
|
|
# Test signed bitfields for signedness and range.
|
|
# Fill the signed fields with the maximum positive value, then the maximally
|
|
# negative value, then -1, and verify in each case that the values are
|
|
# printed correctly.
|
|
#
|
|
|
|
proc bitfield_signedness {} {
|
|
global decimal
|
|
global hex
|
|
global gdb_prompt
|
|
global srcfile
|
|
global has_signed_bitfields
|
|
|
|
start_test break4
|
|
|
|
if [gdb_test "print flags" "= {.*u1 = 0, u2 = 0, u3 = 0, s1 = 16383, s2 = 4294967295, s3 = 32767.*}" "maximum signed bitfield values"] {
|
|
gdb_suppress_tests
|
|
}
|
|
|
|
continue_test break4 "#1"
|
|
|
|
# Determine if the target has signed bitfields so we can skip
|
|
# the signed bitfield tests if it doesn't.
|
|
set test "determining signed-ness of bitfields"
|
|
set has_signed_bitfields 0
|
|
gdb_test_multiple "print i" $test {
|
|
-re ".* = -32768.*$gdb_prompt $" {
|
|
set has_signed_bitfields 1
|
|
pass "determining signed-ness of bitfields"
|
|
}
|
|
-re ".* = 32768.*$gdb_prompt $" {
|
|
pass "determining signed-ness of bitfields"
|
|
}
|
|
-re ".*$gdb_prompt $" {
|
|
fail "determining signed-ness of bitfields"
|
|
gdb_suppress_tests
|
|
}
|
|
}
|
|
|
|
set test "most negative signed bitfield values"
|
|
if $has_signed_bitfields then {
|
|
if [gdb_test "print flags" "u1 = 0, u2 = 0, u3 = 0, s1 = -16384, s2 = -4294967296, s3 = -32768.*" $test ] {
|
|
gdb_suppress_tests
|
|
}
|
|
} else {
|
|
unsupported $test
|
|
}
|
|
|
|
continue_test break4 "#2"
|
|
|
|
set test "signed bitfields containing -1"
|
|
if $has_signed_bitfields then {
|
|
if [gdb_test "print flags" "u1 = 0, u2 = 0, u3 = 0, s1 = -1, s2 = -1, s3 = -1.*" $test ] {
|
|
gdb_suppress_tests
|
|
}
|
|
} else {
|
|
unsupported $test
|
|
}
|
|
|
|
gdb_stop_suppressing_tests
|
|
}
|
|
|
|
|
|
# Test setting of long long bit fields from within GDB.
|
|
|
|
proc bitfield_set {} {
|
|
global decimal
|
|
global hex
|
|
global gdb_prompt
|
|
global srcfile
|
|
global has_signed_bitfields
|
|
|
|
start_test break5
|
|
|
|
set big_set_failed 0
|
|
set test "set long long unsigned bitfield"
|
|
gdb_test_multiple "print flags.u2 = 0x100000000" $test {
|
|
-re "warning: Value does not fit.*$gdb_prompt $" {
|
|
fail "$test"
|
|
gdb_suppress_tests
|
|
}
|
|
-re "= 4294967296.*$gdb_prompt $" {
|
|
pass "$test"
|
|
}
|
|
}
|
|
|
|
set test "set long long signed bitfield positive"
|
|
gdb_test_multiple "print flags.s2 = 0x80000000" $test {
|
|
-re "warning: Value does not fit.*$gdb_prompt $" {
|
|
fail "$test"
|
|
gdb_suppress_tests
|
|
}
|
|
-re "= 2147483648.*$gdb_prompt $" {
|
|
pass "$test"
|
|
}
|
|
}
|
|
|
|
if [gdb_test "print flags" "u1 = 0, u2 = 4294967296, u3 = 0, s1 = 0, s2 = 2147483648, s3 = 0.*" "long long bitfield values after set"] {
|
|
gdb_suppress_tests
|
|
}
|
|
|
|
set test "set long long signed bitfield negative"
|
|
if $has_signed_bitfields then {
|
|
gdb_test_multiple "print flags.s2 = -1" $test {
|
|
-re "warning: Value does not fit.*$gdb_prompt $" {
|
|
fail "$test"
|
|
gdb_suppress_tests
|
|
}
|
|
-re "= -1.*$gdb_prompt $" {
|
|
pass "$test"
|
|
}
|
|
}
|
|
} else {
|
|
unsupported $test
|
|
}
|
|
|
|
set test "long long bitfield values after set negative"
|
|
if $has_signed_bitfields then {
|
|
if [gdb_test "print flags" "u1 = 0, u2 = 4294967296, u3 = 0, s1 = 0, s2 = -1, s3 = 0.*" $test] {
|
|
gdb_suppress_tests
|
|
}
|
|
} else {
|
|
unsupported $test
|
|
}
|
|
|
|
gdb_stop_suppressing_tests
|
|
}
|
|
|
|
clean_restart ${binfile}
|
|
|
|
gdb_test_no_output "set print sevenbit-strings"
|
|
runto_main
|
|
|
|
bitfield_uniqueness
|
|
bitfield_containment
|
|
bitfield_unsignedness
|
|
bitfield_signedness
|
|
bitfield_set
|
|
|