1# Test reading debug information from in object files. 2 3if { [skip_hp_tests] } { continue } 4 5if { ![istarget "hppa*-*-hpux*"] } { 6 verbose "HPUX test ignored for non-hppa targets." 7 return 0 8} 9 10set testfile "test" 11set srcsubdir ${srcdir}/${subdir}/objdbg02 12set objdbgdir ${objdir}/${subdir}/objdbg02 13set binfile ${objdbgdir}/${testfile} 14set toolssubdir ${srcdir}/${subdir}/tools 15 16# Create and source the file that provides information about the compiler 17# used to compile the test case. 18if [get_compiler_info ${binfile}] { 19 return -1 20} 21 22if {!$hp_aCC_compiler && !$hp_cc_compiler} { 23 return 0 24} 25 26if { [gdb_compile "${toolssubdir}/test-objdbg.cc" "${objdbgdir}/test-objdbg.o" object "debug c++ {additional_flags=-I${toolssubdir} +objdebug}"] != "" } { 27 untested objdbg02.exp 28 return -1 29} 30 31if { [gdb_compile "${srcsubdir}/x1.cc" "${objdbgdir}/x1.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } { 32 perror "Couldn't compile x1.cc" 33 return -1 34} 35 36if { [gdb_compile "${srcsubdir}/x2.cc" "${objdbgdir}/x2.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } { 37 perror "Couldn't compile x2.cc" 38 return -1 39} 40 41if { [gdb_compile "${srcsubdir}/x3.cc" "${objdbgdir}/x3.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } { 42 perror "Couldn't compile x3.cc" 43 return -1 44} 45 46remote_exec build "rm -f ${objdbgdir}/test.a" 47set status [remote_exec build "ar cr ${objdbgdir}/test.a ${objdbgdir}/x2.o ${objdbgdir}/x3.o"] 48if { [lindex $status 0] != 0 } { 49 perror "Couldn't compile test.a" 50 return -1 51} 52remote_exec build "rm -f ${objdbgdir}/x2.o ${objdbgdir}/x3.o" 53 54if { [gdb_compile "${objdbgdir}/x1.o ${objdbgdir}/test.a" "$binfile" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } { 55 perror "Couldn't compile ${binfile}" 56 return -1 57} 58 59# Test loading debug information from an archive file 60 61gdb_exit 62gdb_start 63gdb_reinitialize_dir ${srcsubdir} 64gdb_load ${binfile} 65 66gdb_test "b main" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file ..*/x1.cc, line 12." 67gdb_test "run" "Starting program:.*Breakpoint \[0-9\]+, main .*/x1.cc:12.*" 68gdb_test "s 1" ".*13.*" 69gdb_test "s 1" "foo1 .*/x2.cc:15.*" 70gdb_test "s 1" ".*16.*" 71gdb_test "s 1" "foo2 .*/x2.cc:10.*" 72gdb_test "s 1" ".*11.*" 73gdb_test "s 1" "foo1 .*/x2.cc:17.*" 74gdb_test "s 1" "main .*/x1.cc:14.*" 75gdb_test "s 1" "foo3 .*/x3.cc:5.*" 76gdb_test "s 1" ".*6.*" 77gdb_test "s 1" "main .*/x1.cc:15.*" 78gdb_test "s 1" ".*16.*" 79if [istarget "hppa64-*-*"] { 80 gdb_test "s 1" "0x\[0-9a-f\]+ in .*START.*" 81 gdb_continue_to_end 82} else { 83 gdb_test "s 1" "0x\[0-9a-f\]+ in _start .*" 84 gdb_continue_to_end "" "s 1" 85} 86 87