diff options
author | Jim Blandy <jimb@codesourcery.com> | 2002-05-04 20:51:16 +0000 |
---|---|---|
committer | Jim Blandy <jimb@codesourcery.com> | 2002-05-04 20:51:16 +0000 |
commit | 188baff3f1ae77978360ff2cd61d26ab0fe0fb97 (patch) | |
tree | 895731dd293d2c0857b1a14420b528bd5f32ca54 | |
parent | 0816590b1485694937378a4b76bba0d067689f1b (diff) | |
download | gdb-188baff3f1ae77978360ff2cd61d26ab0fe0fb97.zip gdb-188baff3f1ae77978360ff2cd61d26ab0fe0fb97.tar.gz gdb-188baff3f1ae77978360ff2cd61d26ab0fe0fb97.tar.bz2 |
* gdb.c++/hang.exp: Check for corruption of the cv_type chain.
* gdb.c++/hang3.C: New file.
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/hang.exp | 23 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/hang3.C | 4 |
3 files changed, 28 insertions, 4 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index cafe9c3..5499048 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2002-05-03 Jim Blandy <jimb@redhat.com> + + * gdb.c++/hang.exp: Check for corruption of the cv_type chain. + * gdb.c++/hang3.C: New file. + 2002-05-04 Andrew Cagney <ac131313@redhat.com> * gdb.base/default.exp: Remove obsolete code. diff --git a/gdb/testsuite/gdb.c++/hang.exp b/gdb/testsuite/gdb.c++/hang.exp index 560b3d0..4c117a1 100644 --- a/gdb/testsuite/gdb.c++/hang.exp +++ b/gdb/testsuite/gdb.c++/hang.exp @@ -29,13 +29,13 @@ if { [skip_cplus_tests] } { continue } set testfile hang set binfile ${objdir}/${subdir}/${testfile} -foreach file {hang1 hang2} { - if { [gdb_compile "${srcdir}/${subdir}/${file}.C" "${file}.o" object {debug c++}] != "" } { +foreach file {hang1 hang2 hang3} { + if {[gdb_compile "${srcdir}/${subdir}/${file}.C" "${file}.o" object {c++ debug}] != ""} { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } } -if {[gdb_compile "hang1.o hang2.o" ${binfile} executable {debug c++}] != "" } { +if {[gdb_compile "hang1.o hang2.o hang3.o" ${binfile} executable {c++ debug}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } @@ -110,4 +110,19 @@ gdb_load ${binfile} # in `cleanup_undefined_types' corrupted the target type's `cv_type' # ring, `finish_cv_type' enters an infinite loop. -gdb_test "print var_in_b" " = 1729" "can read debug info" +# This checks that GDB recognizes when a structure is about to be +# overwritten, and refuses, with a complaint. +gdb_test "print var_in_b" " = 1729" "doesn't overwrite struct type" + +# This checks that cleanup_undefined_types doesn't create corrupt +# cv_type chains. Note that var_in_hang3 does need to be declared in +# a separate compilation unit, whose psymtab depends on hang1.o's +# psymtab. Otherwise, GDB won't call cleanup_undefined_types (as it +# finishes hang1.o's symbols) before it calls make_cv_type (while +# reading hang3.o's symbols). +# +# The bug only happens when you compile with -gstabs+; Otherwise, GCC +# won't include the `const' qualifier on `const_B_ptr' in `hang3.o''s +# STABS, so GDB won't try to create a const variant of the smashed +# struct type, and get caught by the corrupted cv_type chain. +gdb_test "print var_in_hang3" " = 42" "doesn't corrupt cv_type chain" diff --git a/gdb/testsuite/gdb.c++/hang3.C b/gdb/testsuite/gdb.c++/hang3.C new file mode 100644 index 0000000..92c82fa --- /dev/null +++ b/gdb/testsuite/gdb.c++/hang3.C @@ -0,0 +1,4 @@ +#include "hang.H" + +const struct B *const_B_ptr; +int var_in_hang3 = 42; |