- Separate out test patches.

This commit is contained in:
cagney 2005-02-04 21:01:49 +00:00
parent 4bf80fb89a
commit 6cc37db5c7
4 changed files with 306 additions and 206 deletions

View File

@ -3,196 +3,7 @@
* linespec.c (collect_methods): Don't do special processing for
destructors as this will be handled in find_methods.
(find_methods): Fix ctor check to also check for dtor.
* testsuite/gdb.cp/constructortest.exp: New test.
* testsuite/gdb.cp/constructortest.cc: Ditto.
* testsuite/gdb.cp/templates.exp: Change break of dtor to
be fully quoted.
--- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc.fix Fri Jan 21 17:06:56 2005
+++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc Fri Jan 21 17:05:18 2005
@@ -0,0 +1,64 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+class A
+{
+ public:
+ A();
+ ~A();
+ int k;
+ private:
+ int x;
+};
+
+class B: public A
+{
+ public:
+ B();
+ private:
+ int y;
+};
+
+int main(int argc, char *argv[])
+{
+ A* a = new A;
+ B* b = new B;
+ delete a;
+ delete b;
+ return 0;
+}
+
+A::A() /* Constructor A */
+{
+ x = 1; /* First line A */
+ k = 4; /* Second line A */
+}
+
+A::~A() /* Destructor A */
+{
+ x = 3; /* First line ~A */
+ k = 6; /* Second line ~A */
+}
+
+B::B()
+{
+ y = 2; /* First line B */
+ k = 5;
+}
+
--- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp.fix Fri Jan 21 17:07:02 2005
+++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp Fri Jan 21 17:05:29 2005
@@ -0,0 +1,98 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Check that GDB can break at multiple forms of constructors.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "constructortest"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+#
+# Run to `main' where we begin our tests.
+#
+
+if ![runto_main] then {
+ gdb_suppress_tests
+}
+
+# Break on the various forms of the A::A constructor
+gdb_test_multiple "break A\:\:A" "breaking on A::A" {
+ -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. A::A\\(\\) at .*\[\r\n\]*.3. A::A\\\$base\\(\\) at .*\[\r\n\]*> $" {
+ gdb_test "1" \
+ ".*Multiple breakpoints were set.*" \
+ "break on multiple constructors"
+ }
+}
+
+# Verify that we break for the A constructor two times
+# Once for new A and once for new B
+gdb_continue_to_breakpoint "First line A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A"
+gdb_continue_to_breakpoint "First line A"
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A"
+
+# Now do the same for destructors
+gdb_test "break 'A::~A()'" ""
+gdb_test "break 'A::~A\$base()'" ""
+
+# Verify that we break for the A destructor two times
+# Once for delete a and once for delete b
+gdb_continue_to_breakpoint "First line ~A"
+gdb_test "bt" "#0.*~A.*#1.*main.*" "Verify in in-charge A::~A"
+gdb_continue_to_breakpoint "First line ~A"
+gdb_test "bt" "#0.*~A.*#1.*~B.*#2.*main.*" "Verify in not-in-charge A::~A"
+
+
+# Verify that we can break by line number in a constructor and find
+# both occurrences
+runto_main
+gdb_test "break 'A::A()'" "" "break in constructor A 2"
+gdb_continue_to_breakpoint "First line A"
+set second_line [gdb_get_line_number "Second line A"]
+gdb_test "break $second_line" ".*$second_line.*$second_line.*Multiple breakpoints were set.*" "break by line in constructor"
+gdb_continue_to_breakpoint "Second line A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A second line"
+gdb_continue_to_breakpoint "Second line A"
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A second line"
+
+# Verify that we can break by line number in a destructor and find
+# both occurrences
+gdb_test "break 'A::~A()'" "" "break in constructor ~A 2"
+gdb_continue_to_breakpoint "First line ~A"
+set second_line_dtor [gdb_get_line_number "Second line ~A"]
+gdb_test "break $second_line_dtor" ".*$second_line_dtor.*$second_line_dtor.*Multiple breakpoints were set.*" "break by line in destructor"
+gdb_continue_to_breakpoint "Second line ~A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::~A second line"
+gdb_continue_to_breakpoint "Second line ~A"
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::~A second line"
+
--- gdb-6.3/gdb/testsuite/gdb.cp/templates.exp.fix Fri Jan 21 17:07:10 2005
+++ gdb-6.3/gdb/testsuite/gdb.cp/templates.exp Fri Jan 21 17:09:09 2005
@@ -1,4 +1,4 @@
-# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003, 2004
+# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -142,7 +142,7 @@ proc test_template_breakpoints {} {
# See CLLbs14792
if {$hp_aCC_compiler} {setup_xfail hppa*-*-* CLLbs14792}
- gdb_test_multiple "break T5<int>::~T5" "destructor_breakpoint" {
+ gdb_test_multiple "break 'T5<int>::~T5()'" "destructor_breakpoint" {
-re "Breakpoint.*at.* file .*${testfile}.cc, line.*$gdb_prompt $"
{
pass "destructor breakpoint"
--- gdb-6.3/gdb/linespec.c.fix Fri Jan 21 17:03:18 2005
+++ gdb-6.3/gdb/linespec.c Fri Jan 21 17:04:39 2005
@@ -375,12 +375,14 @@ add_matching_methods (int method_counter

View File

@ -0,0 +1,192 @@
Index: gdb/testsuite/ChangeLog
2005-01-21 Jeff Johnston <jjohnstn@redhat.com>
* gdb.cp/constructortest.exp: New test.
* gdb.cp/constructortest.cc: Ditto.
* gdb.cp/templates.exp: Change break of dtor to be fully quoted.
--- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc.fix Fri Jan 21 17:06:56 2005
+++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc Fri Jan 21 17:05:18 2005
@@ -0,0 +1,64 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+class A
+{
+ public:
+ A();
+ ~A();
+ int k;
+ private:
+ int x;
+};
+
+class B: public A
+{
+ public:
+ B();
+ private:
+ int y;
+};
+
+int main(int argc, char *argv[])
+{
+ A* a = new A;
+ B* b = new B;
+ delete a;
+ delete b;
+ return 0;
+}
+
+A::A() /* Constructor A */
+{
+ x = 1; /* First line A */
+ k = 4; /* Second line A */
+}
+
+A::~A() /* Destructor A */
+{
+ x = 3; /* First line ~A */
+ k = 6; /* Second line ~A */
+}
+
+B::B()
+{
+ y = 2; /* First line B */
+ k = 5;
+}
+
--- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp.fix Fri Jan 21 17:07:02 2005
+++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp Fri Jan 21 17:05:29 2005
@@ -0,0 +1,98 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Check that GDB can break at multiple forms of constructors.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "constructortest"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+#
+# Run to `main' where we begin our tests.
+#
+
+if ![runto_main] then {
+ gdb_suppress_tests
+}
+
+# Break on the various forms of the A::A constructor
+gdb_test_multiple "break A\:\:A" "breaking on A::A" {
+ -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. A::A\\(\\) at .*\[\r\n\]*.3. A::A\\\$base\\(\\) at .*\[\r\n\]*> $" {
+ gdb_test "1" \
+ ".*Multiple breakpoints were set.*" \
+ "break on multiple constructors"
+ }
+}
+
+# Verify that we break for the A constructor two times
+# Once for new A and once for new B
+gdb_continue_to_breakpoint "First line A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A"
+gdb_continue_to_breakpoint "First line A"
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A"
+
+# Now do the same for destructors
+gdb_test "break 'A::~A()'" ""
+gdb_test "break 'A::~A\$base()'" ""
+
+# Verify that we break for the A destructor two times
+# Once for delete a and once for delete b
+gdb_continue_to_breakpoint "First line ~A"
+gdb_test "bt" "#0.*~A.*#1.*main.*" "Verify in in-charge A::~A"
+gdb_continue_to_breakpoint "First line ~A"
+gdb_test "bt" "#0.*~A.*#1.*~B.*#2.*main.*" "Verify in not-in-charge A::~A"
+
+
+# Verify that we can break by line number in a constructor and find
+# both occurrences
+runto_main
+gdb_test "break 'A::A()'" "" "break in constructor A 2"
+gdb_continue_to_breakpoint "First line A"
+set second_line [gdb_get_line_number "Second line A"]
+gdb_test "break $second_line" ".*$second_line.*$second_line.*Multiple breakpoints were set.*" "break by line in constructor"
+gdb_continue_to_breakpoint "Second line A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A second line"
+gdb_continue_to_breakpoint "Second line A"
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A second line"
+
+# Verify that we can break by line number in a destructor and find
+# both occurrences
+gdb_test "break 'A::~A()'" "" "break in constructor ~A 2"
+gdb_continue_to_breakpoint "First line ~A"
+set second_line_dtor [gdb_get_line_number "Second line ~A"]
+gdb_test "break $second_line_dtor" ".*$second_line_dtor.*$second_line_dtor.*Multiple breakpoints were set.*" "break by line in destructor"
+gdb_continue_to_breakpoint "Second line ~A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::~A second line"
+gdb_continue_to_breakpoint "Second line ~A"
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::~A second line"
+
--- gdb-6.3/gdb/testsuite/gdb.cp/templates.exp.fix Fri Jan 21 17:07:10 2005
+++ gdb-6.3/gdb/testsuite/gdb.cp/templates.exp Fri Jan 21 17:09:09 2005
@@ -1,4 +1,4 @@
-# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003, 2004
+# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -142,7 +142,7 @@ proc test_template_breakpoints {} {
# See CLLbs14792
if {$hp_aCC_compiler} {setup_xfail hppa*-*-* CLLbs14792}
- gdb_test_multiple "break T5<int>::~T5" "destructor_breakpoint" {
+ gdb_test_multiple "break 'T5<int>::~T5()'" "destructor_breakpoint" {
-re "Breakpoint.*at.* file .*${testfile}.cc, line.*$gdb_prompt $"
{
pass "destructor breakpoint"

View File

@ -0,0 +1,98 @@
2005-01-25 Elena Zannoni <ezannoni@redhat.com>
* gdb.base/move-dir.exp: New test.
* gdb.base/move-dir.c: Ditto.
* gdb.base/move-dir.h: Ditto.
--- gdb-6.3/gdb/testsuite/gdb.base/move-dir.c.fix Tue Jan 25 19:13:14 2005
+++ gdb-6.3/gdb/testsuite/gdb.base/move-dir.c Tue Jan 25 19:12:40 2005
@@ -0,0 +1,9 @@
+#include <stdlib.h>
+#include "move-dir.h"
+
+int main() {
+ const char* hw = "hello world.";
+ printf ("%s\n", hw);;
+ other();
+}
+
--- gdb-6.3/gdb/testsuite/gdb.base/move-dir.exp.fix Tue Jan 25 19:13:21 2005
+++ gdb-6.3/gdb/testsuite/gdb.base/move-dir.exp Tue Jan 25 19:12:40 2005
@@ -0,0 +1,67 @@
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "move-dir"
+set srcfile ${testfile}.c
+set incfile ${testfile}.h
+set binfile ${objdir}/${subdir}/${testfile}
+
+set testdir "${objdir}/${subdir}/incdir"
+
+remote_exec build "mkdir $testdir"
+remote_exec build "cp ${srcdir}/${subdir}/${srcfile} ${objdir}/${subdir}"
+remote_exec build "cp ${srcdir}/${subdir}/${incfile} ${testdir}"
+
+set additional_flags "additional_flags=-I${subdir}/incdir"
+
+if { [gdb_compile "${objdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+# Create and source the file that provides information about the compiler
+# used to compile the test case.
+
+if [get_compiler_info ${binfile}] {
+ return -1;
+}
+
+
+set oldtimeout $timeout
+set timeout [expr "$timeout + 60"]
+
+# Start with a fresh gdb.
+
+gdb_exit
+gdb_start
+gdb_test "cd ../.." "" ""
+gdb_load ${binfile}
+gdb_test "list main" ".*hw.*other.*" "found main"
+gdb_test "list other" ".*ostring.*" "found include file"
+
+
+set timeout $oldtimeout
+return 0
--- gdb-6.3/gdb/testsuite/gdb.base/move-dir.h.fix Tue Jan 25 19:17:50 2005
+++ gdb-6.3/gdb/testsuite/gdb.base/move-dir.h Tue Jan 25 19:19:20 2005
@@ -0,0 +1,7 @@
+#include <stdlib.h>
+
+void other() {
+ const char* ostring = "other";
+ printf ("%s\n", ostring);;
+}
+

View File

@ -11,7 +11,7 @@ Name: gdb
Version: 6.3.0.0
# The release always contains a leading reserved number, start it at 0.
Release: 0.13
Release: 0.14
License: GPL
Group: Development/Debuggers
@ -131,12 +131,8 @@ Patch120: gdb-6.3-type-fix-20041213.patch
Patch121: gdb-6.3-backtrace-20041216.patch
# VSYSCALL and PIE
Patch122: gdb-6.3-vsyscall-20041216.patch
# Pie test
Patch123: gdb-6.3-test-pie-20050107.patch
# Pie support
Patch122: gdb-6.3-test-pie-20050107.patch
Patch123: gdb-6.3-vsyscall-20041216.patch
Patch124: gdb-6.3-pie-20050110.patch
# Get selftest working with sep-debug-info
@ -159,18 +155,21 @@ Patch130: gdb-6.3-ctorline-20050120.patch
# Handle nested, and back-to-back signals when stepping.
Patch131: gdb-6.3-sigrepeats-20050121.patch
Patch132: gdb-6.3-test-sigrepeats-20050121.patch
# Fix to support multiple destructors just like multiple constructors
Patch132: gdb-6.3-dtorfix-20050121.patch
Patch133: gdb-6.3-test-dtorfix-20050121.patch
Patch134: gdb-6.3-dtorfix-20050121.patch
# Fix for ia64 to prevent SIGSEGV in debugger
Patch133: gdb-6.3-ia64fix-20050121.patch
Patch135: gdb-6.3-ia64fix-20050121.patch
# Fix to support executable moving
Patch134: gdb-6.3-movedir-20050125.patch
Patch136: gdb-6.3-test-movedir-20050125.patch
Patch137: gdb-6.3-movedir-20050125.patch
# Fix to support unwinding syscalls in ia64 corefiles
Patch135: gdb-6.3-ia64-corefile-fix-20050127.patch
Patch138: gdb-6.3-ia64-corefile-fix-20050127.patch
%ifarch ia64
BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu libunwind >= 0.96-3
@ -222,21 +221,15 @@ and printing their data.
%patch115 -p1
%patch116 -p1
%patch117 -p1
%patch118 -p1
%patch119 -p1
%patch120 -p1
%patch121 -p1
%patch122 -p1
%patch123 -p1
%patch124 -p1
%patch125 -p1
%patch126 -p1
%patch127 -p1
%patch128 -p1
%patch129 -p1
@ -246,6 +239,9 @@ and printing their data.
%patch133 -p1
%patch134 -p1
%patch135 -p1
%patch136 -p1
%patch137 -p1
%patch138 -p1
# Change the version that gets printed at GDB startup, so it is RedHat
# specific.
@ -414,6 +410,9 @@ fi
# don't include the files in include, they are part of binutils
%changelog
* Thu Feb 3 2005 Andrew Cagney <cagney@redhat.com> 6.3.0.0-0.14
- Separate out test patches.
* Thu Jan 27 2005 Jeff Johnston <jjohnstn@redhat.com> 6.3.0.0-0.13
- Fix to allow ia64 gdb to backtrace from syscalls in a corefile.
- Bugzilla 145092.