diff options
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/ada-lang.c | 11 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/fin_fun_out.exp | 38 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/fin_fun_out/bar.adb | 23 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/fin_fun_out/bar.ads | 25 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/fin_fun_out/foo_o525_013.adb | 23 |
7 files changed, 129 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e198c93..beb604f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2015-11-09 Joel Brobecker <brobecker@adacore.com> + + * ada-lang.c (ada_is_wrapper_field): Add special handling + for fields called "RETVAL". + 2015-11-09 Yao Qi <yao.qi@linaro.org> * arm-tdep.c (arm_exidx_new_objfile): Use diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index fff4862..1f2d014 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -6984,6 +6984,17 @@ ada_is_wrapper_field (struct type *type, int field_num) { const char *name = TYPE_FIELD_NAME (type, field_num); + if (name != NULL && strcmp (name, "RETVAL") == 0) + { + /* This happens in functions with "out" or "in out" parameters + which are passed by copy. For such functions, GNAT describes + the function's return type as being a struct where the return + value is in a field called RETVAL, and where the other "out" + or "in out" parameters are fields of that struct. This is not + a wrapper. */ + return 0; + } + return (name != NULL && (startswith (name, "PARENT") || strcmp (name, "REP") == 0 diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 31a59f4..dfc9b77 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-11-09 Joel Brobecker <brobecker@adacore.com> + + * gdb.ada/fin_fun_out: New testcase. + 2015-11-07 Kevin Buettner <kevinb@redhat.com> * gdb.dwarf2/data-loc.exp (Dwarf::assemble): Don't hardcode diff --git a/gdb/testsuite/gdb.ada/fin_fun_out.exp b/gdb/testsuite/gdb.ada/fin_fun_out.exp new file mode 100644 index 0000000..e989d87 --- /dev/null +++ b/gdb/testsuite/gdb.ada/fin_fun_out.exp @@ -0,0 +1,38 @@ +# 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_o525_013 + +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } { + return -1 +} + +clean_restart ${testfile} + +runto "bar.f" + +# Perform a "finish". The output, and in particular the value of +# the return value depends on the target, as sometime the compiler +# will transform it into a struct, which we may or may not be able +# to display, depending on the ABI. The objective of the test is +# to verify that we don't crash, so keep the expected output simple... +gdb_test "finish" \ + ".*Value returned.*" + +# Verify that GDB is still alive... +gdb_test "print 1" \ + "= 1" diff --git a/gdb/testsuite/gdb.ada/fin_fun_out/bar.adb b/gdb/testsuite/gdb.ada/fin_fun_out/bar.adb new file mode 100644 index 0000000..1b74f13 --- /dev/null +++ b/gdb/testsuite/gdb.ada/fin_fun_out/bar.adb @@ -0,0 +1,23 @@ +-- 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 body Bar is + function F (R : out Rec_Type) return Enum_Type + is + begin + R.Cur := 0; + return A; + end F; +end Bar; diff --git a/gdb/testsuite/gdb.ada/fin_fun_out/bar.ads b/gdb/testsuite/gdb.ada/fin_fun_out/bar.ads new file mode 100644 index 0000000..cbd6504 --- /dev/null +++ b/gdb/testsuite/gdb.ada/fin_fun_out/bar.ads @@ -0,0 +1,25 @@ +-- 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 Bar is + type Enum_Type is (A, B, C); + + type Rec_Type is record + Cur : Integer; + end record; + + function F (R : out Rec_Type) return Enum_Type; + +end Bar; diff --git a/gdb/testsuite/gdb.ada/fin_fun_out/foo_o525_013.adb b/gdb/testsuite/gdb.ada/fin_fun_out/foo_o525_013.adb new file mode 100644 index 0000000..46f89ec --- /dev/null +++ b/gdb/testsuite/gdb.ada/fin_fun_out/foo_o525_013.adb @@ -0,0 +1,23 @@ +-- 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 Bar; use Bar; + +procedure Foo_O525_013 is + R : Rec_Type; + I : Enum_Type := F (R); +begin + null; +end Foo_O525_013; |