| OLD | NEW |
| 1 # Copyright 1992, 1994-2004, 2006-2012 Free Software Foundation, Inc. | 1 # Copyright 1992, 1994-2004, 2006-2012 Free Software Foundation, Inc. |
| 2 | 2 |
| 3 # This program is free software; you can redistribute it and/or modify | 3 # This program is free software; you can redistribute it and/or modify |
| 4 # it under the terms of the GNU General Public License as published by | 4 # it under the terms of the GNU General Public License as published by |
| 5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
| 6 # (at your option) any later version. | 6 # (at your option) any later version. |
| 7 # | 7 # |
| 8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
| 12 # | 12 # |
| 13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
| 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | 15 |
| 16 # This file was written by Fred Fish. (fnf@cygnus.com) | 16 # This file was written by Fred Fish. (fnf@cygnus.com) |
| 17 # And rewritten by Michael Chastain <mec.gnu@mindspring.com>. | 17 # And rewritten by Michael Chastain <mec.gnu@mindspring.com>. |
| 18 | 18 |
| 19 set nl "\[\r\n\]+" | 19 set nl "\[\r\n\]+" |
| 20 | 20 |
| 21 if $tracelevel then { | |
| 22 strace $tracelevel | |
| 23 } | |
| 24 | |
| 25 if { [skip_cplus_tests] } { continue } | 21 if { [skip_cplus_tests] } { continue } |
| 26 | 22 |
| 27 load_lib "cp-support.exp" | 23 load_lib "cp-support.exp" |
| 28 | 24 |
| 29 set testfile "classes" | 25 standard_testfile .cc |
| 30 set srcfile ${testfile}.cc | |
| 31 set binfile ${objdir}/${subdir}/${testfile} | |
| 32 | 26 |
| 33 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug c++}] != "" } { | 27 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { |
| 34 untested classes.exp | 28 return -1 |
| 35 return -1 | |
| 36 } | 29 } |
| 37 | 30 |
| 38 # Test ptype of class objects. | 31 # Test ptype of class objects. |
| 39 | 32 |
| 40 proc test_ptype_class_objects {} { | 33 proc test_ptype_class_objects {} { |
| 41 | 34 |
| 42 # Simple type. | 35 # Simple type. |
| 43 | 36 |
| 44 cp_test_ptype_class \ | 37 cp_test_ptype_class \ |
| 45 "ptype struct default_public_struct" "" "struct" "default_public_struct"
\ | 38 "ptype struct default_public_struct" "" "struct" "default_public_struct"
\ |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 } | 509 } |
| 517 | 510 |
| 518 # Test static members. | 511 # Test static members. |
| 519 | 512 |
| 520 proc test_static_members {} { | 513 proc test_static_members {} { |
| 521 global hex | 514 global hex |
| 522 | 515 |
| 523 gdb_test "print Foo::st" "\\$\[0-9\]+ = 100" | 516 gdb_test "print Foo::st" "\\$\[0-9\]+ = 100" |
| 524 gdb_test_no_output "set foo.st = 200" "" | 517 gdb_test_no_output "set foo.st = 200" "" |
| 525 gdb_test "print bar.st" "\\$\[0-9\]+ = 200" | 518 gdb_test "print bar.st" "\\$\[0-9\]+ = 200" |
| 526 gdb_test "print &foo.st" "\\$\[0-9\]+ = \\(int ?\\*\\) $hex" | 519 gdb_test "print &foo.st" "\\$\[0-9\]+ = \\(int ?\\*\\) $hex <Foo::st>" |
| 527 gdb_test "print &Bar::st" "\\$\[0-9\]+ = \\(int ?\\*\\) $hex" | 520 gdb_test "print &Bar::st" "\\$\[0-9\]+ = \\(int ?\\*\\) $hex <Foo::st>" |
| 528 gdb_test "print *\$" "\\$\[0-9\]+ = 200" | 521 gdb_test "print *\$" "\\$\[0-9\]+ = 200" |
| 529 | 522 |
| 530 gdb_test_no_output "set print static-members off" | 523 gdb_test_no_output "set print static-members off" |
| 531 gdb_test "print csi" \ | 524 gdb_test "print csi" \ |
| 532 "{x = 10, y = 20}" \ | 525 "{x = 10, y = 20}" \ |
| 533 "print csi without static members" | 526 "print csi without static members" |
| 534 gdb_test "print cnsi" \ | 527 gdb_test "print cnsi" \ |
| 535 "{x = 30, y = 40}" \ | 528 "{x = 30, y = 40}" \ |
| 536 "print cnsi without static members" | 529 "print cnsi without static members" |
| 537 | 530 |
| 538 gdb_test_no_output "set print static-members on" | 531 gdb_test_no_output "set print static-members on" |
| 539 gdb_test "print csi" \ | 532 gdb_test "print csi" \ |
| 540 "{x = 10, y = 20, static null = {x = 0, y = 0, static null = <same as st
atic member of an already seen type>}}" \ | 533 "{x = 10, y = 20, static null = {x = 0, y = 0, static null = <same as st
atic member of an already seen type>}}" \ |
| 541 "print csi with static members" | 534 "print csi with static members" |
| 542 gdb_test "print cnsi" \ | 535 gdb_test "print cnsi" \ |
| 543 "{x = 30, y = 40, static null = {x = 0, y = 0, static null = <same as st
atic member of an already seen type>, static yy = {z = 5, static xx = {x = 1, y
= 2, static null = <same as static member of an already seen type>, static yy =
<same as static member of an already seen type>}}}, static yy = <same as static
member of an already seen type>}" \ | 536 "{x = 30, y = 40, static null = {x = 0, y = 0, static null = <same as st
atic member of an already seen type>, static yy = {z = 5, static xx = {x = 1, y
= 2, static null = <same as static member of an already seen type>, static yy =
<same as static member of an already seen type>}}}, static yy = <same as static
member of an already seen type>}" \ |
| 544 "print cnsi with static members" | 537 "print cnsi with static members" |
| 545 } | 538 } |
| 546 | 539 |
| 547 proc do_tests {} { | 540 proc do_tests {} { |
| 548 global subdir | |
| 549 global objdir | |
| 550 global srcdir | |
| 551 global binfile | |
| 552 global gdb_prompt | 541 global gdb_prompt |
| 553 global nl | 542 global nl |
| 554 | 543 |
| 555 | 544 |
| 556 # Start with a fresh gdb. | |
| 557 | |
| 558 gdb_exit | |
| 559 gdb_start | |
| 560 gdb_reinitialize_dir $srcdir/$subdir | |
| 561 gdb_load $binfile | |
| 562 | |
| 563 gdb_test_no_output "set language c++" "" | 545 gdb_test_no_output "set language c++" "" |
| 564 gdb_test_no_output "set width 0" "" | 546 gdb_test_no_output "set width 0" "" |
| 565 | 547 |
| 566 if ![runto_main ] then { | 548 if ![runto_main ] then { |
| 567 perror "couldn't run to breakpoint" | 549 perror "couldn't run to breakpoint" |
| 568 return | 550 return |
| 569 } | 551 } |
| 570 | 552 |
| 571 gdb_breakpoint inheritance2 | 553 gdb_breakpoint inheritance2 |
| 572 gdb_test "continue" ".*Breakpoint .* inheritance2.*" "" | 554 gdb_test "continue" ".*Breakpoint .* inheritance2.*" "" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 } | 611 } |
| 630 | 612 |
| 631 gdb_test "print base1::Base1" "<.*Base1.*>" "print ctor of typedef class" | 613 gdb_test "print base1::Base1" "<.*Base1.*>" "print ctor of typedef class" |
| 632 gdb_test "print base1::~Base1" "<.*~Base1(\\(\\))?>" \ | 614 gdb_test "print base1::~Base1" "<.*~Base1(\\(\\))?>" \ |
| 633 "print dtor of typedef class" | 615 "print dtor of typedef class" |
| 634 | 616 |
| 635 gdb_test "list ByAnyOtherName::times" ".*int Foo::times.*" | 617 gdb_test "list ByAnyOtherName::times" ".*int Foo::times.*" |
| 636 } | 618 } |
| 637 | 619 |
| 638 do_tests | 620 do_tests |
| OLD | NEW |