new file mode 100644
@@ -0,0 +1,52 @@
+# Copyright 2014 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
+}
+
+load_lib mi-support.exp
+set MIFLAGS "-i=mi"
+
+gdb_exit
+if [mi_gdb_start] {
+ continue
+}
+
+mi_delete_breakpoints
+mi_gdb_reinitialize_dir $srcdir/$subdir
+mi_gdb_load ${binfile}
+
+if ![mi_run_to_main] then {
+ fail "Cannot run to main, testcase aborted"
+ return 0
+}
+
+set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.adb]
+mi_continue_to_line \
+ "foo.adb:$bp_location" \
+ "stop at start of main Ada procedure"
+
+mi_gdb_test "-var-create bt * bt" \
+ "\\^done,name=\"bt\",numchild=\"3\",.*" \
+ "Create bt varobj"
+
+mi_gdb_test "-var-update 1 *" \
+ "\\^done,changelist=\\\[\\\]" \
+ "list ggg1's children"
new file mode 100644
@@ -0,0 +1,24 @@
+-- Copyright 2014 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 is
+ -- The goal here is to have an array whose bounds are not
+ -- known at compile time.
+ BT : Bounded := New_Bounded (Low => 1, High => 3);
+begin
+ Do_Nothing (BT'Address); -- STOP
+end Foo;
+
new file mode 100644
@@ -0,0 +1,30 @@
+-- Copyright 2014 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 New_Bounded (Low, High : Integer) return Bounded is
+ Result : Bounded (Low .. High);
+ begin
+ for J in Low .. High loop
+ Result (J) := J;
+ end loop;
+ return Result;
+ end New_Bounded;
+
+ procedure Do_Nothing (A : System.Address) is
+ begin
+ null;
+ end Do_Nothing;
+end Pck;
new file mode 100644
@@ -0,0 +1,21 @@
+-- Copyright 2014 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
+ type Bounded is array (Integer range <>) of Integer;
+ function New_Bounded (Low, High : Integer) return Bounded;
+ procedure Do_Nothing (A : System.Address);
+end Pck;
@@ -1649,7 +1649,16 @@ varobj_value_has_mutated (struct varobj *var, struct value *new_value,
return 0;
if (var->root->lang_ops->value_has_mutated)
- return var->root->lang_ops->value_has_mutated (var, new_value, new_type);
+ {
+ /* The varobj module, when installing new values, explicitly strips
+ references, saying that we're not interested in those addresses.
+ But detection of mutation happens before installing the new
+ value, so our value may be a reference that we need to strip
+ in order to remain consistent. */
+ if (new_value != NULL)
+ new_value = coerce_ref (new_value);
+ return var->root->lang_ops->value_has_mutated (var, new_value, new_type);
+ }
else
return 0;
}