aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2008-10-03 22:02:20 +0000
committerPaul Pluzhnikov <ppluzhnikov@google.com>2008-10-03 22:02:20 +0000
commit4fc5b2085878cffdc16f6ca7cbcb27cbdb12f11a (patch)
tree4a7cc78ac020ed32fcaffa602b48d42c4bfd1945 /gdb
parent5ef737906e22d88134542767e0382c35b30d1a6c (diff)
downloadgdb-4fc5b2085878cffdc16f6ca7cbcb27cbdb12f11a.zip
gdb-4fc5b2085878cffdc16f6ca7cbcb27cbdb12f11a.tar.gz
gdb-4fc5b2085878cffdc16f6ca7cbcb27cbdb12f11a.tar.bz2
2008-10-03 Paul Pluzhnikov <ppluzhnikov@google.com>
PR gdb/2384: * gdb.cp/gdb2384.exp: Extended to test more cases. * gdb.cp/gdb2384.cc: Likewise. * gdb.cp/gdb2384-base.h: Likewise. * gdb.cp/gdb2384-base.cc: Likewise.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/gdb.cp/gdb2384-base.cc5
-rw-r--r--gdb/testsuite/gdb.cp/gdb2384-base.h6
-rw-r--r--gdb/testsuite/gdb.cp/gdb2384.cc23
-rw-r--r--gdb/testsuite/gdb.cp/gdb2384.exp65
5 files changed, 67 insertions, 40 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index ad4b5df..7681b2a 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2008-10-03 Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ PR gdb/2384:
+ * gdb.cp/gdb2384.exp: Extended to test more cases.
+ * gdb.cp/gdb2384.cc: Likewise.
+ * gdb.cp/gdb2384-base.h: Likewise.
+ * gdb.cp/gdb2384-base.cc: Likewise.
+
2008-10-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/maint.exp (maint print type): Remove printing
diff --git a/gdb/testsuite/gdb.cp/gdb2384-base.cc b/gdb/testsuite/gdb.cp/gdb2384-base.cc
index 76b24db..44a133d 100644
--- a/gdb/testsuite/gdb.cp/gdb2384-base.cc
+++ b/gdb/testsuite/gdb.cp/gdb2384-base.cc
@@ -28,3 +28,8 @@ base::meth ()
{
return x;
}
+
+derived::derived (int _x)
+ : base (_x)
+{
+}
diff --git a/gdb/testsuite/gdb.cp/gdb2384-base.h b/gdb/testsuite/gdb.cp/gdb2384-base.h
index 945ca81..f32cff4 100644
--- a/gdb/testsuite/gdb.cp/gdb2384-base.h
+++ b/gdb/testsuite/gdb.cp/gdb2384-base.h
@@ -23,3 +23,9 @@ class base
int x;
virtual int meth ();
};
+
+class derived : public base
+{
+ public:
+ derived (int _x);
+};
diff --git a/gdb/testsuite/gdb.cp/gdb2384.cc b/gdb/testsuite/gdb.cp/gdb2384.cc
index 74e725d..d7d5928 100644
--- a/gdb/testsuite/gdb.cp/gdb2384.cc
+++ b/gdb/testsuite/gdb.cp/gdb2384.cc
@@ -18,23 +18,36 @@
#include "gdb2384-base.h"
-class derived : public base
+class derived1 : public base
{
public:
- derived (int);
+ derived1 (int);
};
-derived::derived (int _x)
+derived1::derived1 (int _x)
: base (_x)
{
}
+class derived2 : public derived
+{
+ public:
+ derived2 (int);
+};
+
+derived2::derived2 (int _x)
+ : derived (_x)
+{
+}
+
int g;
int
main ()
{
- derived d (42);
- g = d.meth (); // set breakpoint here
+ derived1 d1 (42);
+ derived2 d2 (24);
+ g = d1.meth (); // set breakpoint here
+ g = d2.meth (); // set breakpoint here (second)
return 0;
}
diff --git a/gdb/testsuite/gdb.cp/gdb2384.exp b/gdb/testsuite/gdb.cp/gdb2384.exp
index 370c65b..3ae7957 100644
--- a/gdb/testsuite/gdb.cp/gdb2384.exp
+++ b/gdb/testsuite/gdb.cp/gdb2384.exp
@@ -55,46 +55,41 @@ gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
gdb_load_shlibs ${sofile}
-set bp_location [gdb_get_line_number "set breakpoint here"]
-
-# Set a breakpoint with multiple locations.
-
-gdb_test "break $srcfile:$bp_location" \
- "Breakpoint.*at.* file .*$srcfile, line.*" \
- "set breakpoint"
-
-gdb_run_cmd
-gdb_expect {
- -re "Breakpoint \[0-9\]+,.*main \\(.*\\).*$gdb_prompt $" {
- pass "run to breakpoint"
- }
- -re "$gdb_prompt $" {
- fail "run to breakpoint"
- }
- timeout {
- fail "run to breakpoint (timeout)"
- }
+
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ return -1
}
-gdb_test "print d.meth ()" \
+gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
+gdb_continue_to_breakpoint "set breakpoint here"
+
+gdb_test "print d1.meth ()" \
".*42.*" \
- "print d.meth ()"
+ "print d1.meth ()"
# Now try again. gdb's without the fix will hopefully segv here
-gdb_run_cmd
-gdb_expect {
- -re "Breakpoint \[0-9\]+,.*main \\(.*\\).*$gdb_prompt $" {
- pass "run to breakpoint #2"
- }
- -re "$gdb_prompt $" {
- fail "run to breakpoint #2"
- }
- timeout {
- fail "run to breakpoint #2 (timeout)"
- }
-}
-
-gdb_test "print d.meth ()" \
+runto_main
+gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
+gdb_continue_to_breakpoint "set breakpoint here"
+gdb_test "print d1.meth ()" \
".*42.*" \
"gdb2384"
+
+# second case
+
+runto_main
+gdb_breakpoint [gdb_get_line_number "set breakpoint here (second)"]
+gdb_continue_to_breakpoint "set breakpoint here (second)"
+gdb_test "print d2.meth ()" \
+ ".*24.*" \
+ "print d2.meth()"
+
+runto_main
+gdb_breakpoint [gdb_get_line_number "set breakpoint here (second)"]
+gdb_continue_to_breakpoint "set breakpoint here (second)"
+gdb_test "print d2.meth ()" \
+ ".*24.*" \
+ "gdb2384 (second)"
+