Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA/testsuite/ada] finish in function returning array
@ 2005-10-08  7:56 Joel Brobecker
  2005-10-09 19:55 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2005-10-08  7:56 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 701 bytes --]

Hello,

Here is a new testcase for the patch submitted in:

        http://sources.redhat.com/ml/gdb-patches/2005-10/msg00068.html

Without the patch above, I get two FAILs:

    FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small
    FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Large (GDB internal error)

Once the patch is applied, I get all 6 PASSes.

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.

Tested on x86-linux. OK to apply?

Thanks,
-- 
Joel

[-- Attachment #2: pck.ads --]
[-- Type: text/plain, Size: 214 bytes --]

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;


[-- Attachment #3: pck.adb --]
[-- Type: text/plain, Size: 240 bytes --]

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;

[-- Attachment #4: p.adb --]
[-- Type: text/plain, Size: 173 bytes --]

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;

[-- Attachment #5: array_return.exp --]
[-- Type: text/plain, Size: 2389 bytes --]

# 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"


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA/testsuite/ada] finish in function returning array
  2005-10-08  7:56 [RFA/testsuite/ada] finish in function returning array Joel Brobecker
@ 2005-10-09 19:55 ` Daniel Jacobowitz
  2005-10-10  1:20   ` Joel Brobecker
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2005-10-09 19:55 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On Sat, Oct 08, 2005 at 12:56:19AM -0700, Joel Brobecker wrote:
> 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.
> 
> Tested on x86-linux. OK to apply?

This is fine too.  I bet it's going to turn up problems on a lot of
other platforms too.


-- 
Daniel Jacobowitz
CodeSourcery, LLC


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA/testsuite/ada] finish in function returning array
  2005-10-09 19:55 ` Daniel Jacobowitz
@ 2005-10-10  1:20   ` Joel Brobecker
  0 siblings, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2005-10-10  1:20 UTC (permalink / raw)
  To: gdb-patches

> On Sat, Oct 08, 2005 at 12:56:19AM -0700, Joel Brobecker wrote:
> > 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.
> > 
> > Tested on x86-linux. OK to apply?
> 
> This is fine too.  I bet it's going to turn up problems on a lot of
> other platforms too.

Thanks. Checked in too.

You're quite right to bet. I think I've seen at least a couple of
targets where the test fails. I can't have a look at it just now,
though :-/.

-- 
Joel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-10-10  1:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-08  7:56 [RFA/testsuite/ada] finish in function returning array Joel Brobecker
2005-10-09 19:55 ` Daniel Jacobowitz
2005-10-10  1:20   ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox