+2015-09-23 Pierre-Marie de Rodat <derodat@adacore.com>
+
+ * ada-lang.c (ada_evaluate_subexp) <OP_FUNCALL>: When the input
+ value is a reference, actually dereference it in order to get
+ the underlying value.
+
2015-09-22 Simon Marchi <simon.marchi@ericsson.com>
* stap-probe.c (handle_stap_probe): Remove unnecessary cast.
therefore already coerced to a simple array. Nothing further
to do. */
;
- else if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_REF
- || (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_ARRAY
- && VALUE_LVAL (argvec[0]) == lval_memory))
- argvec[0] = value_addr (argvec[0]);
+ else if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_REF)
+ {
+ /* Make sure we dereference references so that all the code below
+ feels like it's really handling the referenced value. Wrapping
+ types (for alignment) may be there, so make sure we strip them as
+ well. */
+ argvec[0] = ada_to_fixed_value (coerce_ref (argvec[0]));
+ }
+ else if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_ARRAY
+ && VALUE_LVAL (argvec[0]) == lval_memory)
+ argvec[0] = value_addr (argvec[0]);
type = ada_check_typedef (value_type (argvec[0]));
+2015-09-23 Pierre-Marie de Rodat <derodat@adacore.com>
+
+ * gdb.ada/array_ptr_renaming.exp: New testcase.
+ * gdb.ada/array_ptr_renaming/foo.adb: New file.
+ * gdb.ada/array_ptr_renaming/pack.ads: New file.
+
2015-09-21 Pierre Langlois <pierre.langlois@arm.com>
* gdb.trace/ftrace-lock.c: New file.
--- /dev/null
+# 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 foo
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
+ return -1
+}
+
+clean_restart ${testfile}
+
+set bp_location [gdb_get_line_number "BREAK" ${testdir}/foo.adb]
+runto "foo.adb:$bp_location"
+
+gdb_test "print nt" " = \\(10, 20\\)"
+gdb_test "print nt(1)" " = 10"
+
+# Accesses to arrays and unconstrained arrays have the same runtime
+# representation with GNAT (fat pointers). In this case, GDB "forgets" that
+# it's dealing with an access and prints directly the array contents. This
+# should be fixed some day.
+setup_kfail "gdb/NNNN" *-*-*
+gdb_test "print ntp" " = \\(access pack\\.table_type\\) $hex.*"
+gdb_test "print ntp.all" " = \\(3 => 30, 40\\)"
+gdb_test "print ntp(3)" " = 30"
--- /dev/null
+-- 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 System;
+with Pack;
+
+procedure Foo is
+ NT : Pack.Table_Type renames Pack.Table;
+ NTP : Pack.Table_Ptr_Type renames Pack.Table_Ptr;
+begin
+ NT := NT; -- BREAK
+ NTP := NTP;
+end Foo;
--- /dev/null
+-- 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/>.
+
+package Pack is
+
+ type Table_Type is
+ array (Natural range <>) of Integer;
+ type Table_Ptr_Type is access all Table_Type;
+
+ Table : Table_Type := (1 => 10, 2 => 20);
+ Table_Ptr : aliased Table_Ptr_Type := new Table_Type'(3 => 30, 4 => 40);
+
+end Pack;