From: Jerome Guitton <guitton@adacore.com>
To: gdb-patches@sourceware.org
Cc: Joel Brobecker <brobecker@adacore.com>
Subject: [RFA/testsuite 3/4] New testcase for interface type printing
Date: Thu, 29 Nov 2012 13:37:00 -0000 [thread overview]
Message-ID: <1354196235-8414-3-git-send-email-guitton@adacore.com> (raw)
In-Reply-To: <1354196235-8414-1-git-send-email-guitton@adacore.com>
From: Joel Brobecker <brobecker@adacore.com>
gdb/testsuite/ChangeLog:
* gdb.ada/iwide: New testcase.
OK to apply?
---
gdb/testsuite/gdb.ada/iwide.exp | 42 ++++++++++++++++++++++
gdb/testsuite/gdb.ada/iwide/classes.adb | 23 ++++++++++++
gdb/testsuite/gdb.ada/iwide/classes.ads | 59 +++++++++++++++++++++++++++++++
gdb/testsuite/gdb.ada/iwide/p.adb | 25 +++++++++++++
4 files changed, 149 insertions(+)
create mode 100644 gdb/testsuite/gdb.ada/iwide.exp
create mode 100644 gdb/testsuite/gdb.ada/iwide/classes.adb
create mode 100644 gdb/testsuite/gdb.ada/iwide/classes.ads
create mode 100644 gdb/testsuite/gdb.ada/iwide/p.adb
diff --git a/gdb/testsuite/gdb.ada/iwide.exp b/gdb/testsuite/gdb.ada/iwide.exp
new file mode 100644
index 0000000..836b551
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/iwide.exp
@@ -0,0 +1,42 @@
+# Copyright 2012 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 p
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnat05 ]] != "" } {
+ return -1
+}
+
+clean_restart ${testfile}
+
+set bp_location [gdb_get_line_number "BREAK" ${testdir}/p.adb]
+runto "p.adb:$bp_location"
+
+gdb_test "print My_Drawable" \
+ "= \\(center => \\(x => 1, y => 2\\), radius => 3\\)"
+
+gdb_test "print s_access.all" \
+ "\\(center => \\(x => 1, y => 2\\), radius => 3\\)"
+
+gdb_test "print sp_access.all" \
+ "\\(center => \\(x => 1, y => 2\\), radius => 3\\)"
+
+gdb_test "print d_access.all" \
+ "\\(center => \\(x => 1, y => 2\\), radius => 3\\)"
+
+gdb_test "print dp_access.all" \
+ "\\(center => \\(x => 1, y => 2\\), radius => 3\\)"
diff --git a/gdb/testsuite/gdb.ada/iwide/classes.adb b/gdb/testsuite/gdb.ada/iwide/classes.adb
new file mode 100644
index 0000000..5af1114
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/iwide/classes.adb
@@ -0,0 +1,23 @@
+-- Copyright 2012 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 Classes is
+
+ procedure Draw (R : Circle) is
+ begin
+ null;
+ end Draw;
+
+end Classes;
diff --git a/gdb/testsuite/gdb.ada/iwide/classes.ads b/gdb/testsuite/gdb.ada/iwide/classes.ads
new file mode 100644
index 0000000..f305ed2
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/iwide/classes.ads
@@ -0,0 +1,59 @@
+-- Copyright 2012 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 Classes is
+
+ type Point is record
+ X : Integer;
+ Y : Integer;
+ end record;
+
+ type Shape is abstract tagged null record;
+
+ type Shape_Access is access all Shape'Class;
+
+ type Drawable is interface;
+
+ type Drawable_Access is access all Drawable'Class;
+
+ procedure Draw (D : Drawable) is abstract;
+
+ type Circle is new Shape and Drawable with record
+ Center : Point;
+ Radius : Natural;
+ end record;
+
+ procedure Draw (R : Circle);
+
+ My_Circle : Circle := ((1, 2), 3);
+ My_Shape : Shape'Class := Shape'Class (My_Circle);
+ My_Drawable : Drawable'Class := Drawable'Class (My_Circle);
+
+ S_Access : Shape_Access := new Circle'(My_Circle);
+ D_Access : Drawable_Access := new Circle'(My_Circle);
+
+ type R (MS : Shape_Access; MD : Drawable_Access) is record
+ E : Integer;
+ end record;
+
+ MR : R := (MS => S_Access, MD => D_Access, E => 42);
+
+ type Shape_Array is array (1 .. 4) of Shape_Access;
+ type Drawable_Array is array (1 .. 4) of Drawable_Access;
+
+ S_Array : Shape_Array := (others => S_Access);
+ D_Array : Drawable_Array := (others => D_Access);
+
+end Classes;
diff --git a/gdb/testsuite/gdb.ada/iwide/p.adb b/gdb/testsuite/gdb.ada/iwide/p.adb
new file mode 100644
index 0000000..a4f2a5a
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/iwide/p.adb
@@ -0,0 +1,25 @@
+-- Copyright 2012 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 Classes; use Classes;
+
+procedure P is
+ SP_Access : Shape_Access := new Circle'(My_Circle);
+ DP_Access : Drawable_Access := new Circle'(My_Circle);
+ SP_Array : Shape_Array := (others => S_Access);
+ DP_Array : Drawable_Array := (others => D_Access);
+begin
+ null; -- BREAK
+end P;
--
1.7.10.4
next prev parent reply other threads:[~2012-11-29 13:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-29 13:37 [RFA/Ada 1/4] Full view of interface-wide types Jerome Guitton
2012-11-29 13:37 ` [RFA/Ada 2/4] Strip interface tags from visible fields Jerome Guitton
2012-11-29 14:20 ` Joel Brobecker
2012-11-29 13:37 ` [RFA/testsuite 4/4] update ptype_tagged_param.exp Jerome Guitton
2012-11-29 14:22 ` Joel Brobecker
2012-11-29 16:36 ` Jerome Guitton
2012-11-29 13:37 ` Jerome Guitton [this message]
2012-11-29 14:20 ` [RFA/testsuite 3/4] New testcase for interface type printing Joel Brobecker
2012-11-29 14:20 ` [RFA/Ada 1/4] Full view of interface-wide types Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1354196235-8414-3-git-send-email-guitton@adacore.com \
--to=guitton@adacore.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox