| OLD | NEW |
| 1 # Copyright 1998-1999, 2003-2004, 2006-2012 Free Software Foundation, | 1 # Copyright 1998-1999, 2003-2004, 2006-2012 Free Software Foundation, |
| 2 # Inc. | 2 # Inc. |
| 3 | 3 |
| 4 # This file is part of the gdb testsuite | 4 # This file is part of the gdb testsuite |
| 5 | 5 |
| 6 # This program is free software; you can redistribute it and/or modify | 6 # This program is free software; you can redistribute it and/or modify |
| 7 # it under the terms of the GNU General Public License as published by | 7 # it under the terms of the GNU General Public License as published by |
| 8 # the Free Software Foundation; either version 3 of the License, or | 8 # the Free Software Foundation; either version 3 of the License, or |
| 9 # (at your option) any later version. | 9 # (at your option) any later version. |
| 10 # | 10 # |
| 11 # This program is distributed in the hope that it will be useful, | 11 # This program is distributed in the hope that it will be useful, |
| 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 # GNU General Public License for more details. | 14 # GNU General Public License for more details. |
| 15 # | 15 # |
| 16 # You should have received a copy of the GNU General Public License | 16 # You should have received a copy of the GNU General Public License |
| 17 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | 18 |
| 19 # Tests for pointer-to-member support | 19 # Tests for pointer-to-member support |
| 20 # Written by Satish Pai <pai@apollo.hp.com> 1997-08-19 | 20 # Written by Satish Pai <pai@apollo.hp.com> 1997-08-19 |
| 21 # Rewritten by Michael Chastain <mec.gnu@mindspring.com> 2004-01-11 | 21 # Rewritten by Michael Chastain <mec.gnu@mindspring.com> 2004-01-11 |
| 22 | 22 |
| 23 set vhn "\\$\[0-9\]+" | 23 set vhn "\\$\[0-9\]+" |
| 24 | 24 |
| 25 if $tracelevel then { | |
| 26 strace $tracelevel | |
| 27 } | |
| 28 | |
| 29 if { [skip_cplus_tests] } { continue } | 25 if { [skip_cplus_tests] } { continue } |
| 30 | 26 |
| 31 | 27 |
| 32 set testfile "member-ptr" | 28 standard_testfile .cc |
| 33 set srcfile ${testfile}.cc | |
| 34 set binfile ${objdir}/${subdir}/${testfile} | |
| 35 | 29 |
| 36 if [get_compiler_info ${binfile} "c++"] { | 30 if [get_compiler_info "c++"] { |
| 37 return -1 | 31 return -1 |
| 38 } | 32 } |
| 39 | 33 |
| 40 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug c++}] != "" } { | 34 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { |
| 41 untested member-ptr.exp | 35 return -1 |
| 42 return -1 | |
| 43 } | 36 } |
| 44 | 37 |
| 45 gdb_exit | |
| 46 gdb_start | |
| 47 gdb_reinitialize_dir $srcdir/$subdir | |
| 48 gdb_load ${binfile} | |
| 49 | |
| 50 if ![runto_main] then { | 38 if ![runto_main] then { |
| 51 perror "couldn't run to breakpoint" | 39 perror "couldn't run to breakpoint" |
| 52 continue | 40 continue |
| 53 } | 41 } |
| 54 | 42 |
| 55 gdb_breakpoint [gdb_get_line_number "Breakpoint 1 here"] | 43 gdb_breakpoint [gdb_get_line_number "Breakpoint 1 here"] |
| 56 gdb_continue_to_breakpoint "continue to pmi = NULL" | 44 gdb_continue_to_breakpoint "continue to pmi = NULL" |
| 57 | 45 |
| 58 # ====================== | 46 # ====================== |
| 59 # pointer to member data | 47 # pointer to member data |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 # Double-check by printing a. | 242 # Double-check by printing a. |
| 255 | 243 |
| 256 set name "print a (j = 33)" | 244 set name "print a (j = 33)" |
| 257 gdb_test_multiple "print a" $name { | 245 gdb_test_multiple "print a" $name { |
| 258 -re "$vhn = \{c = 120 'x', j = 33, jj = 1331, (static|static int) s = 10, (_
vptr.A|_vptr\\$) = ($hex|$hex <A virtual table>)\}\r\n$gdb_prompt $" { | 246 -re "$vhn = \{c = 120 'x', j = 33, jj = 1331, (static|static int) s = 10, (_
vptr.A|_vptr\\$) = ($hex|$hex <A virtual table>)\}\r\n$gdb_prompt $" { |
| 259 pass $name | 247 pass $name |
| 260 } | 248 } |
| 261 -re "$vhn = \{c = 120 'x', j = 33, jj = 1331, (static|static int) s = 10, Vi
rtual table at $hex\}\r\n$gdb_prompt $" { | 249 -re "$vhn = \{c = 120 'x', j = 33, jj = 1331, (static|static int) s = 10, Vi
rtual table at $hex\}\r\n$gdb_prompt $" { |
| 262 pass $name | 250 pass $name |
| 263 } | 251 } |
| 264 -re "$vhn = \{(_vptr.A|_vptr\\$) = $hex, c = 120 'x', j = 33, jj = 1331, (st
atic|static int) s = 10\}\r\n$gdb_prompt $" { | 252 -re "$vhn = \{(_vptr.A|_vptr\\$) = ${hex}( <vtable for A.*>)?, c = 120 'x',
j = 33, jj = 1331, (static|static int) s = 10\}\r\n$gdb_prompt $" { |
| 265 pass $name | 253 pass $name |
| 266 } | 254 } |
| 267 -re "$vhn = \{(_vptr.A|_vptr\\$) = $hex, c = 120 'x', j = 121, jj = 1331, (s
tatic|static int) s = 10\}\r\n$gdb_prompt $" { | 255 -re "$vhn = \{(_vptr.A|_vptr\\$) = $hex, c = 120 'x', j = 121, jj = 1331, (s
tatic|static int) s = 10\}\r\n$gdb_prompt $" { |
| 268 # gcc HEAD 2004-01-10 -gdwarf-2 | 256 # gcc HEAD 2004-01-10 -gdwarf-2 |
| 269 # gcc HEAD 2004-01-10 -gstabs+ | 257 # gcc HEAD 2004-01-10 -gstabs+ |
| 270 kfail "gdb/NNNN" $name | 258 kfail "gdb/NNNN" $name |
| 271 } | 259 } |
| 272 } | 260 } |
| 273 | 261 |
| 274 # Set the data member pointed to, using ->* | 262 # Set the data member pointed to, using ->* |
| (...skipping 27 matching lines...) Expand all Loading... |
| 302 # Double-check by printing a. | 290 # Double-check by printing a. |
| 303 | 291 |
| 304 set name "print a (j = 44)" | 292 set name "print a (j = 44)" |
| 305 gdb_test_multiple "print a" $name { | 293 gdb_test_multiple "print a" $name { |
| 306 -re "$vhn = \{c = 120 'x', j = 44, jj = 1331, (static|static int) s = 10, (_
vptr.A|_vptr\\$) = ($hex|$hex <A virtual table>)\}\r\n$gdb_prompt $" { | 294 -re "$vhn = \{c = 120 'x', j = 44, jj = 1331, (static|static int) s = 10, (_
vptr.A|_vptr\\$) = ($hex|$hex <A virtual table>)\}\r\n$gdb_prompt $" { |
| 307 pass $name | 295 pass $name |
| 308 } | 296 } |
| 309 -re "$vhn = \{c = 120 'x', j = 44, jj = 1331, (static|static int) s = 10, Vi
rtual table at $hex\}\r\n$gdb_prompt $" { | 297 -re "$vhn = \{c = 120 'x', j = 44, jj = 1331, (static|static int) s = 10, Vi
rtual table at $hex\}\r\n$gdb_prompt $" { |
| 310 pass $name | 298 pass $name |
| 311 } | 299 } |
| 312 -re "$vhn = \{(_vptr.A|_vptr\\$) = $hex, c = 120 'x', j = 44, jj = 1331, (st
atic|static int) s = 10\}\r\n$gdb_prompt $" { | 300 -re "$vhn = \{(_vptr.A|_vptr\\$) = ${hex}( <vtable for A.*>), c = 120 'x', j
= 44, jj = 1331, (static|static int) s = 10\}\r\n$gdb_prompt $" { |
| 313 pass $name | 301 pass $name |
| 314 } | 302 } |
| 315 -re "$vhn = \{(_vptr.A|_vptr\\$) = $hex, c = 120 'x', j = 121, jj = 1331, (s
tatic|static int) s = 10\}\r\n$gdb_prompt $" { | 303 -re "$vhn = \{(_vptr.A|_vptr\\$) = $hex, c = 120 'x', j = 121, jj = 1331, (s
tatic|static int) s = 10\}\r\n$gdb_prompt $" { |
| 316 # gcc HEAD 2004-01-10 -gdwarf-2 | 304 # gcc HEAD 2004-01-10 -gdwarf-2 |
| 317 # gcc HEAD 2004-01-10 -gstabs+ | 305 # gcc HEAD 2004-01-10 -gstabs+ |
| 318 kfail "gdb/NNNN" $name | 306 kfail "gdb/NNNN" $name |
| 319 } | 307 } |
| 320 } | 308 } |
| 321 | 309 |
| 322 # ptype the dereferenced pointer to member. | 310 # ptype the dereferenced pointer to member. |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 "Invalid data type for function to be called\\." | 641 "Invalid data type for function to be called\\." |
| 654 | 642 |
| 655 # NULL pointer to member tests. | 643 # NULL pointer to member tests. |
| 656 gdb_test "print null_pmi" "$vhn = NULL" | 644 gdb_test "print null_pmi" "$vhn = NULL" |
| 657 gdb_test "print null_pmi = &A::j" "$vhn = &A::j" | 645 gdb_test "print null_pmi = &A::j" "$vhn = &A::j" |
| 658 gdb_test "print null_pmi = 0" "$vhn = NULL" | 646 gdb_test "print null_pmi = 0" "$vhn = NULL" |
| 659 | 647 |
| 660 gdb_test "print null_pmf" "$vhn = NULL" | 648 gdb_test "print null_pmf" "$vhn = NULL" |
| 661 gdb_test "print null_pmf = &A::foo" "$vhn = \\(int \\(A::\\*\\)\\(A \\*( const)?
, int\\)\\) $hex <A::foo ?\\(int\\)>" | 649 gdb_test "print null_pmf = &A::foo" "$vhn = \\(int \\(A::\\*\\)\\(A \\*( const)?
, int\\)\\) $hex <A::foo ?\\(int\\)>" |
| 662 gdb_test "print null_pmf = 0" "$vhn = NULL" | 650 gdb_test "print null_pmf = 0" "$vhn = NULL" |
| OLD | NEW |