aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/gdbtypes.c7
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.ada/n_arr_bound.exp32
-rw-r--r--gdb/testsuite/gdb.ada/n_arr_bound/foo.adb23
-rw-r--r--gdb/testsuite/gdb.ada/n_arr_bound/pck.adb21
-rw-r--r--gdb/testsuite/gdb.ada/n_arr_bound/pck.ads19
7 files changed, 111 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a716030..ec5325e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-21 Joel Brobecker <brobecker@adacore.com>
+
+ * gdbtypes.c (create_range_type): Unset RESULT_TYPE's
+ flag_unsigned if HIGH_BOUND is constant and negative.
+
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 8e44b7c..b921c64 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -821,6 +821,13 @@ create_range_type (struct type *result_type, struct type *index_type,
if (low_bound->kind == PROP_CONST && low_bound->data.const_val >= 0)
TYPE_UNSIGNED (result_type) = 1;
+ /* Ada allows the declaration of range types whose upper bound is
+ less than the lower bound, so checking the lower bound is not
+ enough. Make sure we do not mark a range type whose upper bound
+ is negative as unsigned. */
+ if (high_bound->kind == PROP_CONST && high_bound->data.const_val < 0)
+ TYPE_UNSIGNED (result_type) = 0;
+
return result_type;
}
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 908ea49..4b4d881 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2014-11-21 Joel Brobecker <brobecker@adacore.com>
+
+ * gdb.ada/n_arr_bound: New testcase.
+
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
diff --git a/gdb/testsuite/gdb.ada/n_arr_bound.exp b/gdb/testsuite/gdb.ada/n_arr_bound.exp
new file mode 100644
index 0000000..52044eb
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/n_arr_bound.exp
@@ -0,0 +1,32 @@
+# 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"
+
+if { [skip_ada_tests] } { return -1 }
+
+standard_ada_testfile foo
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
+ return -1
+}
+
+clean_restart ${testfile}
+
+set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.adb]
+runto "foo.adb:$bp_location"
+
+gdb_test "ptype var" \
+ "= array \\(0 .. -1\\) of integer"
diff --git a/gdb/testsuite/gdb.ada/n_arr_bound/foo.adb b/gdb/testsuite/gdb.ada/n_arr_bound/foo.adb
new file mode 100644
index 0000000..d9c6fe6
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/n_arr_bound/foo.adb
@@ -0,0 +1,23 @@
+-- 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
+ type Array_Type is array (Integer range <>) of Integer;
+ Var: Array_Type (0 .. -1);
+begin
+ Do_Nothing (Var'Address); -- STOP
+end Foo;
diff --git a/gdb/testsuite/gdb.ada/n_arr_bound/pck.adb b/gdb/testsuite/gdb.ada/n_arr_bound/pck.adb
new file mode 100644
index 0000000..2b31332
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/n_arr_bound/pck.adb
@@ -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/>.
+
+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/n_arr_bound/pck.ads b/gdb/testsuite/gdb.ada/n_arr_bound/pck.ads
new file mode 100644
index 0000000..100d7d5
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/n_arr_bound/pck.ads
@@ -0,0 +1,19 @@
+-- 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
+ procedure Do_Nothing (A : System.Address);
+end Pck;