diff options
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/ada-lang.c | 13 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/rec_comp.exp | 37 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/rec_comp/bar_o203_012.adb | 32 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/rec_comp/pck.adb | 23 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/rec_comp/pck.ads | 22 |
7 files changed, 134 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7e16be1..37e25a3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2015-04-27 Joel Brobecker <brobecker@adacore.com> + + * ada-lang.c (ada_is_tagged_type): Add call to ada_check_typedef. + (ada_lookup_struct_elt_type): Remove calls to ada_check_typedef. + (template_to_static_fixed_type): Call ada_check_typedef only + when necessary. + 2015-04-24 Andrew Burgess <andrew.burgess@embecosm.com> * cli/cli-dump.c (srec_dump_command): Add internationalization diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 124e370..e147d5a 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -6399,6 +6399,8 @@ ada_is_tagged_type (struct type *type, int refok) int ada_is_tag_type (struct type *type) { + type = ada_check_typedef (type); + if (type == NULL || TYPE_CODE (type) != TYPE_CODE_PTR) return 0; else @@ -7322,7 +7324,7 @@ ada_lookup_struct_elt_type (struct type *type, char *name, int refok, { if (dispp != NULL) *dispp += TYPE_FIELD_BITPOS (type, i) / 8; - return ada_check_typedef (TYPE_FIELD_TYPE (type, i)); + return TYPE_FIELD_TYPE (type, i); } else if (ada_is_wrapper_field (type, i)) @@ -7354,7 +7356,7 @@ ada_lookup_struct_elt_type (struct type *type, char *name, int refok, disp = 0; if (v_field_name != NULL && field_name_match (v_field_name, name)) - t = ada_check_typedef (TYPE_FIELD_TYPE (field_type, j)); + t = TYPE_FIELD_TYPE (field_type, j); else t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (field_type, j), @@ -8177,11 +8179,14 @@ template_to_static_fixed_type (struct type *type0) for (f = 0; f < nfields; f += 1) { - struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type0, f)); + struct type *field_type = TYPE_FIELD_TYPE (type0, f); struct type *new_type; if (is_dynamic_field (type0, f)) - new_type = to_static_fixed_type (TYPE_TARGET_TYPE (field_type)); + { + field_type = ada_check_typedef (field_type); + new_type = to_static_fixed_type (TYPE_TARGET_TYPE (field_type)); + } else new_type = static_unwrap_type (field_type); if (type == type0 && new_type != field_type) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c620043..89773a1 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-04-27 Joel Brobecker <brobecker@adacore.com> + + * gdb.ada/rec_comp: New testcase. + 2015-04-26 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.base/coredump-filter.exp: Clear variable "coredump_var_addr" diff --git a/gdb/testsuite/gdb.ada/rec_comp.exp b/gdb/testsuite/gdb.ada/rec_comp.exp new file mode 100644 index 0000000..c462643 --- /dev/null +++ b/gdb/testsuite/gdb.ada/rec_comp.exp @@ -0,0 +1,37 @@ +# Copyright 2015 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 bar_o203_012 + +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } { + return -1 +} + +clean_restart ${testfile} + +set bp_location [gdb_get_line_number "STOP" ${testdir}/bar_o203_012.adb] +if ![runto "bar_o203_012.adb:$bp_location" ] then { + perror "Couldn't run ${testfile}" + return +} + +gdb_test "whatis r.ia" " = bar_o203_012.int_access" + +gdb_test "ptype r" \ + " = record\r\n *ia: bar_o203_012\.int_access;\r\nend record" + +gdb_test "ptype r.ia" " = access <$decimal-byte integer>" diff --git a/gdb/testsuite/gdb.ada/rec_comp/bar_o203_012.adb b/gdb/testsuite/gdb.ada/rec_comp/bar_o203_012.adb new file mode 100644 index 0000000..9783f51 --- /dev/null +++ b/gdb/testsuite/gdb.ada/rec_comp/bar_o203_012.adb @@ -0,0 +1,32 @@ +-- Copyright 2015 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 Bar_O203_012 is + type Int_Access is access Integer; + type Record_Type is record + IA : Int_Access; + end record; + + R : Record_Type; + IA : Int_Access; +begin + R.IA := new Integer'(3); -- STOP + IA := R.IA; + Do_Nothing (R'Address); + Do_Nothing (IA'Address); +end Bar_O203_012; + diff --git a/gdb/testsuite/gdb.ada/rec_comp/pck.adb b/gdb/testsuite/gdb.ada/rec_comp/pck.adb new file mode 100644 index 0000000..c0465af --- /dev/null +++ b/gdb/testsuite/gdb.ada/rec_comp/pck.adb @@ -0,0 +1,23 @@ +-- Copyright 2011-2015 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 + + procedure Do_Nothing (A : System.Address) is + begin + null; + end Do_Nothing; + +end Pck; diff --git a/gdb/testsuite/gdb.ada/rec_comp/pck.ads b/gdb/testsuite/gdb.ada/rec_comp/pck.ads new file mode 100644 index 0000000..594847c --- /dev/null +++ b/gdb/testsuite/gdb.ada/rec_comp/pck.ads @@ -0,0 +1,22 @@ +-- Copyright 2011-2015 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 + + procedure Do_Nothing (A : System.Address); + +end Pck; |