diff options
author | Joel Brobecker <brobecker@gnat.com> | 2005-10-10 01:11:51 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2005-10-10 01:11:51 +0000 |
commit | 1495de3fd3a10998220fcba6e31c6a5002bb4271 (patch) | |
tree | b48df18d0866d48f0c2fd9d300ea3ae24ea46161 /gdb/testsuite | |
parent | 0e4377e151dc56be7e941e52ebfda65f78da581c (diff) | |
download | gdb-1495de3fd3a10998220fcba6e31c6a5002bb4271.zip gdb-1495de3fd3a10998220fcba6e31c6a5002bb4271.tar.gz gdb-1495de3fd3a10998220fcba6e31c6a5002bb4271.tar.bz2 |
* gdb.ada/array_return/pck.ads: New file.
* gdb.ada/array_return/pck.adb: New file.
* gdb.ada/array_return/p.adb: New file.
* gdb.ada/array_return.exp: New testcase.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/array_return.exp | 78 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/array_return/p.adb | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/array_return/pck.adb | 13 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/array_return/pck.ads | 10 |
5 files changed, 118 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index fdefd44..8e04def 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2005-10-07 Joel Brobecker <brobecker@adacore.com> + + * gdb.ada/array_return/pck.ads: New file. + * gdb.ada/array_return/pck.adb: New file. + * gdb.ada/array_return/p.adb: New file. + * gdb.ada/array_return.exp: New testcase. + 2005-10-03 Joel Brobecker <brobecker@adacore.com> * gdb.base/arrayidx.c: New file. diff --git a/gdb/testsuite/gdb.ada/array_return.exp b/gdb/testsuite/gdb.ada/array_return.exp new file mode 100644 index 0000000..72d8fde --- /dev/null +++ b/gdb/testsuite/gdb.ada/array_return.exp @@ -0,0 +1,78 @@ +# Copyright 2005 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 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA + +if $tracelevel then { + strace $tracelevel +} + +load_lib "ada.exp" + +set testdir "array_return" +set testfile "${testdir}/p" +set srcfile ${srcdir}/${subdir}/${testfile}.adb +set binfile ${objdir}/${subdir}/${testfile} + +file mkdir ${objdir}/${subdir}/${testdir} +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# Start the inferior + +if ![runto_main] then { + fail "Cannot run to main, testcase aborted" + return 0 +} + +# Create a breakpoint in each function from which we want to test +# the "finish" command. + +gdb_test "break create_small" \ + "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \ + "insert breakpoint in create_small" + +gdb_test "break create_large" \ + "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+." \ + "insert breakpoint in create_large" + +# Then continue until reaching the first breakpoint inside Create_Small, +# and then do a "finish". + +gdb_test "cont" \ + "Breakpoint \[0-9\]+, pck.create_small \\(\\).*" \ + "Continuing to Create.Small" + +gdb_test "finish" \ + "Value returned is \\\$\[0-9\]+ = \\(1, 1\\)" \ + "value printed by finish of Create_Small" + +# Now continue until reaching the second breakpoint inside Create_Large, +# and then do another "finish". + +gdb_test "cont" \ + "Breakpoint \[0-9\]+, pck.create_large \\(\\).*" \ + "Continuing to Create.Large" + +gdb_test "finish" \ + "Value returned is \\\$\[0-9\]+ = \\(2, 2, 2, 2\\)" \ + "value printed by finish of Create_Large" + diff --git a/gdb/testsuite/gdb.ada/array_return/p.adb b/gdb/testsuite/gdb.ada/array_return/p.adb new file mode 100644 index 0000000..c465d28 --- /dev/null +++ b/gdb/testsuite/gdb.ada/array_return/p.adb @@ -0,0 +1,10 @@ +with Pck; use Pck; + +procedure P is + Small : Data_Small; + Large : Data_Large; +begin + Small := Create_Small; + Large := Create_Large; + Small (1) := Large (1); +end P; diff --git a/gdb/testsuite/gdb.ada/array_return/pck.adb b/gdb/testsuite/gdb.ada/array_return/pck.adb new file mode 100644 index 0000000..30282d1 --- /dev/null +++ b/gdb/testsuite/gdb.ada/array_return/pck.adb @@ -0,0 +1,13 @@ +package body Pck is + + function Create_Small return Data_Small is + begin + return (others => 1); + end Create_Small; + + function Create_Large return Data_Large is + begin + return (others => 2); + end Create_Large; + +end Pck; diff --git a/gdb/testsuite/gdb.ada/array_return/pck.ads b/gdb/testsuite/gdb.ada/array_return/pck.ads new file mode 100644 index 0000000..2561ac7 --- /dev/null +++ b/gdb/testsuite/gdb.ada/array_return/pck.ads @@ -0,0 +1,10 @@ +package Pck is + + type Data_Small is array (1 .. 2) of Integer; + type Data_Large is array (1 .. 4) of Integer; + + function Create_Small return Data_Small; + function Create_Large return Data_Large; + +end Pck; + |