diff options
author | Paul Pluzhnikov <ppluzhnikov@google.com> | 2008-07-14 18:28:57 +0000 |
---|---|---|
committer | Paul Pluzhnikov <ppluzhnikov@google.com> | 2008-07-14 18:28:57 +0000 |
commit | 7093c834d701edb312386d6953c47c50924a2628 (patch) | |
tree | 55141ad44cc3308fbd2546024b55d1da61ea8db1 /gdb/testsuite | |
parent | 5651477109e89a1a78c5c28cfac55c6141000754 (diff) | |
download | gdb-7093c834d701edb312386d6953c47c50924a2628.zip gdb-7093c834d701edb312386d6953c47c50924a2628.tar.gz gdb-7093c834d701edb312386d6953c47c50924a2628.tar.bz2 |
Fix for PR gdb/2477
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/class2.cc | 11 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/class2.exp | 7 |
3 files changed, 21 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 4aacf9b..51b55bb 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2008-07-14 Paul Pluzhnikov <ppluzhnikov@google.com> + + * gdb.cp/class2.exp, gdb.cp/class2.cc: Test for PR2477. + 2008-07-13 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.base/randomize.exp: Catch non-Linux targets as untested. diff --git a/gdb/testsuite/gdb.cp/class2.cc b/gdb/testsuite/gdb.cp/class2.cc index 8aba5c3..9a34309 100644 --- a/gdb/testsuite/gdb.cp/class2.cc +++ b/gdb/testsuite/gdb.cp/class2.cc @@ -41,6 +41,12 @@ B::~B() b2 = 902; } +struct C : public B +{ + A *c1; + A *c2; +}; + // Stop the compiler from optimizing away data. void refer (A *) { @@ -57,16 +63,19 @@ void refer (empty *) int main (void) { - A alpha, *aap, *abp; + A alpha, *aap, *abp, *acp; B beta, *bbp; + C gamma; empty e; alpha.a1 = 100; beta.a1 = 200; beta.b1 = 201; beta.b2 = 202; + gamma.c1 = 0; gamma.c2 = (A *) ~0UL; aap = α refer (aap); abp = β refer (abp); bbp = β refer (bbp); + acp = γ refer (acp); refer (&e); return 0; // marker return 0 diff --git a/gdb/testsuite/gdb.cp/class2.exp b/gdb/testsuite/gdb.cp/class2.exp index 4ae0947..d39130d 100644 --- a/gdb/testsuite/gdb.cp/class2.exp +++ b/gdb/testsuite/gdb.cp/class2.exp @@ -117,3 +117,10 @@ gdb_test "print * (B *) abp" \ # Printing the value of an object containing no data fields: gdb_test "p e" "= \{<No data fields>\}" "print object with no data fields" + +# Printing NULL pointers with "set print object on" + +gdb_test "set print object on" "" +gdb_test "p acp" "= \\(C \\*\\) 0x\[a-f0-9\]+" +gdb_test "p acp->c1" "\\(A \\*\\) 0x0" +gdb_test "p acp->c2" "\\(A \\*\\) 0xf+" |