mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 21:41:47 +08:00
New gdb.ada/repeat_dyn testcase.
This patch introduces a testcase that exercises a scenario which used to trigger an internal-error, but no longer does: Consider the following array: type Small is new Integer range Ident (1) .. Ident (10); type Table is array (1 .. 3) of Small; A1 : Table := (3, 5, 8); The particularity of this array is that the type of each element is a range type whose bounds are dynamic, since they depend on the value returned by Ident (1) and Ident (10). Trying to apply the repeat operator ('@') on one of its elements used to yield an internal error: (gdb) p a1(1)@3 $1 = /[...]/gdbtypes.c:4512: internal-error: copy_type: Assertion `TYPE_OBJFILE_OWNED (type)' failed. Although the issue no longer appears, the testcase is still interesting to have. gdb/testsuite/ChangeLog: * gdb.ada/repeat_dyn: New testcase. Tested on x86_64-linux with clean results.
This commit is contained in:
@ -1,3 +1,7 @@
|
||||
2017-11-30 Joel Brobecker <brobecker@adacore.com>
|
||||
|
||||
* gdb.ada/repeat_dyn: New testcase.
|
||||
|
||||
2017-11-30 Ulrich Weigand <uweigand@de.ibm.com>
|
||||
|
||||
* gdb.cell/gcore.exp: Fix typo when setting spu_bin.
|
||||
|
30
gdb/testsuite/gdb.ada/repeat_dyn.exp
Normal file
30
gdb/testsuite/gdb.ada/repeat_dyn.exp
Normal file
@ -0,0 +1,30 @@
|
||||
# Copyright 2016-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/>.
|
||||
|
||||
load_lib "ada.exp"
|
||||
|
||||
standard_ada_testfile foo_oc22_002
|
||||
|
||||
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
|
||||
return -1
|
||||
}
|
||||
|
||||
clean_restart ${testfile}
|
||||
|
||||
set bp_location [gdb_get_line_number "STOP" ${testdir}/foo_oc22_002.adb]
|
||||
runto "foo_oc22_002.adb:$bp_location"
|
||||
|
||||
gdb_test "print a1(1)@3" \
|
||||
" = \\(3, 5, 8\\)"
|
25
gdb/testsuite/gdb.ada/repeat_dyn/foo_oc22_002.adb
Normal file
25
gdb/testsuite/gdb.ada/repeat_dyn/foo_oc22_002.adb
Normal file
@ -0,0 +1,25 @@
|
||||
-- Copyright 2016-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/>.
|
||||
|
||||
with Pck; use Pck;
|
||||
|
||||
procedure Foo_OC22_002 is
|
||||
type Small is new Integer range Ident (1) .. Ident (10);
|
||||
type Table is array (1 .. 3) of Small;
|
||||
|
||||
A1 : Table := (3, 5, 8);
|
||||
begin
|
||||
Do_Nothing (A1'Address); -- STOP
|
||||
end Foo_OC22_002;
|
27
gdb/testsuite/gdb.ada/repeat_dyn/pck.adb
Normal file
27
gdb/testsuite/gdb.ada/repeat_dyn/pck.adb
Normal file
@ -0,0 +1,27 @@
|
||||
-- Copyright 2016-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/>.
|
||||
|
||||
package body Pck is
|
||||
function Ident (I : Integer) return Integer
|
||||
is
|
||||
begin
|
||||
return I;
|
||||
end Ident;
|
||||
|
||||
procedure Do_Nothing (A : System.Address) is
|
||||
begin
|
||||
null;
|
||||
end Do_Nothing;
|
||||
end Pck;
|
22
gdb/testsuite/gdb.ada/repeat_dyn/pck.ads
Normal file
22
gdb/testsuite/gdb.ada/repeat_dyn/pck.ads
Normal file
@ -0,0 +1,22 @@
|
||||
-- Copyright 2016-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/>.
|
||||
|
||||
with System;
|
||||
|
||||
package Pck is
|
||||
function Ident (I : Integer) return Integer;
|
||||
|
||||
procedure Do_Nothing (A : System.Address);
|
||||
end Pck;
|
Reference in New Issue
Block a user