aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorSiva Chandra <sivachandra@chromium.org>2014-10-16 07:14:13 -0700
committerSiva Chandra <sivachandra@chromium.org>2014-10-24 05:45:06 -0700
commit3433cfa51f6397231ffe2b2c69298eff89179769 (patch)
treea23794d36eba05860099cb464be0fb2f152792bb /gdb/testsuite
parent68fcca92b735bb46e38331485ac2e933e5876b83 (diff)
downloadgdb-3433cfa51f6397231ffe2b2c69298eff89179769.zip
gdb-3433cfa51f6397231ffe2b2c69298eff89179769.tar.gz
gdb-3433cfa51f6397231ffe2b2c69298eff89179769.tar.bz2
Guard a call to TYPE_TARGET_TYPE in gnuv3_pass_by_reference.
gdb/ChangeLog: * gnu-v3-abi.c (gnuv3_pass_by_reference): Call TYPE_TARGET_TYPE on the arg type of a constructor only if it is of reference type. gdb/testsuite/ChangeLog: * gdb.cp/non-trivial-retval.cc: Add a test case. * gdb.cp/non-trivial-retval.exp: Add a test.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.cp/non-trivial-retval.cc33
-rw-r--r--gdb/testsuite/gdb.cp/non-trivial-retval.exp1
3 files changed, 39 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 3b7bb46..b6e3505 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-10-24 Siva Chandra Reddy <sivachandra@google.com>
+
+ * gdb.cp/non-trivial-retval.cc: Add a test case.
+ * gdb.cp/non-trivial-retval.exp: Add a test.
+
2014-10-20 Yao Qi <yao@codesourcery.com>
* gdb.python/py-objfile-script-gdb.py.in: Rename it to ...
diff --git a/gdb/testsuite/gdb.cp/non-trivial-retval.cc b/gdb/testsuite/gdb.cp/non-trivial-retval.cc
index 8382f40..fd1b695 100644
--- a/gdb/testsuite/gdb.cp/non-trivial-retval.cc
+++ b/gdb/testsuite/gdb.cp/non-trivial-retval.cc
@@ -63,6 +63,39 @@ f2 (int i1, int i2)
return b;
}
+class B1
+{
+public:
+ B1 () {}
+ /* This class exists to test that GDB does not trip on other
+ constructors (not copy constructors) which take one
+ argument. Hence, put this decl before the copy-ctor decl.
+ If it is put after copy-ctor decl, then the decision to mark
+ this class as non-trivial will already be made and GDB will
+ not look at this constructor. */
+ B1 (int i);
+ B1 (const B1 &obj);
+
+ int b1;
+};
+
+B1::B1 (const B1 &obj)
+{
+ b1 = obj.b1;
+}
+
+B1::B1 (int i) : b1 (i) { }
+
+B1
+f22 (int i1, int i2)
+{
+ B1 b1;
+
+ b1.b1 = i1 + i2;
+
+ return b1;
+}
+
class C
{
public:
diff --git a/gdb/testsuite/gdb.cp/non-trivial-retval.exp b/gdb/testsuite/gdb.cp/non-trivial-retval.exp
index 7934946..3450a94 100644
--- a/gdb/testsuite/gdb.cp/non-trivial-retval.exp
+++ b/gdb/testsuite/gdb.cp/non-trivial-retval.exp
@@ -32,5 +32,6 @@ gdb_continue_to_breakpoint "Break here"
gdb_test "p f1 (i1, i2)" ".* = {a = 123}" "p f1 (i1, i2)"
gdb_test "p f2 (i1, i2)" ".* = {b = 123}" "p f2 (i1, i2)"
+gdb_test "p f22 (i1, i2)" ".* = {b1 = 123}" "p f22 (i1, i2)"
gdb_test "p f3 (i1, i2)" ".* = {.* c = 123}" "p f3 (i1, i2)"
gdb_test "p f4 (i1, i2)" ".* = {.* e = 123}" "p f4 (i1, i2)"