binutils-gdb/gdb/testsuite/gdb.ada/iwide.exp
Tom de Vries f878836265 [gdb/testsuite] Fix FAILs due to PR gcc/101575
When running test-case gdb.ada/formatted_ref.exp with gcc-11 and target board
unix/gdb:debug_flags=-gdwarf-4 we run into:
...
(gdb) print/x s^M
No definition of "s" in current context.^M
(gdb) FAIL: gdb.ada/formatted_ref.exp: print/x s
...
which is caused by "runto defs.adb:20" taking us to defs__struct1IP:
...
(gdb) break defs.adb:20^M
Breakpoint 1 at 0x402cfd: defs.adb:20. (2 locations)^M
(gdb) run ^M
Starting program: formatted_ref ^M
^M
Breakpoint 1, defs__struct1IP () at defs.adb:20^M
20            return s.x;                   -- Set breakpoint marker here.^M
(gdb) print s1'access^M
...
instead of the expected defs.f1:
...
(gdb) break defs.adb:20^M
Breakpoint 1 at 0x402d0e: file defs.adb, line 20.^M
(gdb) run ^M
Starting program: formatted_ref ^M
^M
Breakpoint 1, defs.f1 (s=...) at defs.adb:20^M
20            return s.x;                   -- Set breakpoint marker here.^M
...

This is caused by incorrect line info due to gcc PR 101575 - "[gcc-11,
-gdwarf-4] Missing .file <n> directive causes invalid line info".

Fix this by when landing in defs__struct1IP:
- xfailing the runto, and
- issuing a continue to land in defs.f1.

Likewise in a few other test-cases.

Tested on x86_64-linux, with:
- system gcc.
- gcc-11 and target boards unix/gdb:debug_flags=-gdwarf-4 and
  unix/gdb:debug_flags=-gdwarf-5.

gdb/testsuite/ChangeLog:

2021-07-22  Tom de Vries  <tdevries@suse.de>

	* gdb.ada/formatted_ref.exp: Add xfail for PR gcc/101575.
	* gdb.ada/iwide.exp: Same.
	* gdb.ada/pkd_arr_elem.exp: Same.
2021-07-22 14:36:31 +02:00

66 lines
1.9 KiB
Plaintext

# Copyright 2012-2021 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 p
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnat05 ]] != "" } {
return -1
}
clean_restart ${testfile}
set bp_location p.adb:[gdb_get_line_number "BREAK" ${testdir}/p.adb]
# Workaround gcc PR101575.
#runto "$bp_location"
gdb_breakpoint "$bp_location"
gdb_run_cmd
set re "Breakpoint $decimal, p \\(\\) at .*:$decimal.*"
set re_xfail "Breakpoint $decimal, p__P5b.0 \\(\\) at .*:$decimal.*"
set ok 1
gdb_test_multiple "" "Runto to $bp_location" {
-re -wrap $re {
if { $ok } {
pass $gdb_test_name
} else {
xfail $gdb_test_name
}
}
-re -wrap $re_xfail {
set ok 0
send_gdb "continue\n"
exp_continue
}
}
gdb_test "print My_Drawable" \
"= \\(center => \\(x => 1, y => 2\\), radius => 3\\)"
gdb_test "print s_access.all" \
"\\(center => \\(x => 1, y => 2\\), radius => 3\\)"
gdb_test "print sp_access.all" \
"\\(center => \\(x => 1, y => 2\\), radius => 3\\)"
gdb_test "print d_access.all" \
"\\(center => \\(x => 1, y => 2\\), radius => 3\\)"
gdb_test "print dp_access.all" \
"\\(center => \\(x => 1, y => 2\\), radius => 3\\)"