aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/rtti.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.cp/rtti.exp')
-rw-r--r--gdb/testsuite/gdb.cp/rtti.exp37
1 files changed, 8 insertions, 29 deletions
diff --git a/gdb/testsuite/gdb.cp/rtti.exp b/gdb/testsuite/gdb.cp/rtti.exp
index ebd8d27..e5a8d3b 100644
--- a/gdb/testsuite/gdb.cp/rtti.exp
+++ b/gdb/testsuite/gdb.cp/rtti.exp
@@ -32,37 +32,16 @@ if { [skip_cplus_tests] } { continue }
# test running programs
#
-set testfile "rtti"
-set srcfile1 "${testfile}1.cc"
-set objfile1 "${testfile}1.o"
-set srcfile2 "${testfile}2.cc"
-set objfile2 "${testfile}2.o"
-set binfile "${objdir}/${subdir}/${testfile}"
-
-if { [gdb_compile "$srcdir/$subdir/$srcfile1" "$objdir/$subdir/$objfile1" object {debug c++}] != "" } {
- untested rtti.exp
- return -1
-}
-
-if { [gdb_compile "$srcdir/$subdir/$srcfile2" "$objdir/$subdir/$objfile2" object {debug c++}] != "" } {
- untested rtti.exp
- return -1
-}
-
-if { [gdb_compile "$objdir/$subdir/$objfile1 $objdir/$subdir/$objfile2" "${binfile}" executable {debug c++}] != "" } {
- untested rtti.exp
- return -1
-}
+standard_testfile rtti1.cc rtti2.cc
if [get_compiler_info "c++"] {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
+if {[prepare_for_testing $testfile.exp $testfile \
+ [list $srcfile $srcfile2] {debug c++}]} {
+ return -1
+}
if ![runto_main] then {
perror "couldn't run to breakpoint"
@@ -71,7 +50,7 @@ if ![runto_main] then {
# First, run to after we've constructed the object:
-gdb_breakpoint [gdb_get_line_number "main-constructs-done" "$srcfile1"]
+gdb_breakpoint [gdb_get_line_number "main-constructs-done" "$srcfile"]
gdb_continue_to_breakpoint "end of constructors in main"
gdb_test_multiple "print *e1" "print *e1" {
@@ -127,12 +106,12 @@ gdb_test_multiple "print *e2" "print *e2" {
# Now we test the hack that's been implemented to get around some
# instances of PR gdb/1511.
-gdb_breakpoint [gdb_get_line_number "func-constructs-done" "$srcfile1"]
+gdb_breakpoint [gdb_get_line_number "func-constructs-done" "$srcfile"]
gdb_continue_to_breakpoint "end of constructors in func"
gdb_test "print *obj" "\\$\[0-9\]* = {<n2::Base2> = .*}"
-gdb_breakpoint [gdb_get_line_number "func3-constructs-done" "$srcfile1"]
+gdb_breakpoint [gdb_get_line_number "func3-constructs-done" "$srcfile"]
gdb_continue_to_breakpoint "end of constructors in func3"
gdb_test "print *obj3" "\\$\[0-9\]* = {<n2::C2> = .*}"