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 gdb_suppress_entire_file "WARNING: +objdebug option is not supported in this compiler version, test ignored." 28} 29 30if { [gdb_compile "${srcsubdir}/x1.cc" "${objdbgdir}/x1.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } { 31 perror "Couldn't compile x1.cc" 32 return -1 33} 34 35if { [gdb_compile "${srcsubdir}/x2.cc" "${objdbgdir}/x2.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } { 36 perror "Couldn't compile x2.cc" 37 return -1 38} 39 40if { [gdb_compile "${srcsubdir}/x3.cc" "${objdbgdir}/x3.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } { 41 perror "Couldn't compile x3.cc" 42 return -1 43} 44 45remote_exec build "rm -f ${objdbgdir}/test.a" 46set status [remote_exec build "ar cr ${objdbgdir}/test.a ${objdbgdir}/x2.o ${objdbgdir}/x3.o"] 47if { [lindex $status 0] != 0 } { 48 perror "Couldn't compile test.a" 49 return -1 50} 51remote_exec build "rm -f ${objdbgdir}/x2.o ${objdbgdir}/x3.o" 52 53if { [gdb_compile "${objdbgdir}/x1.o ${objdbgdir}/test.a" "$binfile" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } { 54 perror "Couldn't compile ${binfile}" 55 return -1 56} 57 58# Test loading debug information from an archive file 59 60gdb_exit 61gdb_start 62gdb_reinitialize_dir ${srcsubdir} 63gdb_load ${binfile} 64 65gdb_test "b main" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file ..*/x1.cc, line 12." 66gdb_test "run" "Starting program:.*Breakpoint \[0-9\]+, main .*/x1.cc:12.*" 67gdb_test "s 1" ".*13.*" 68gdb_test "s 1" "foo1 .*/x2.cc:15.*" 69gdb_test "s 1" ".*16.*" 70gdb_test "s 1" "foo2 .*/x2.cc:10.*" 71gdb_test "s 1" ".*11.*" 72gdb_test "s 1" "foo1 .*/x2.cc:17.*" 73gdb_test "s 1" "main .*/x1.cc:14.*" 74gdb_test "s 1" "foo3 .*/x3.cc:5.*" 75gdb_test "s 1" ".*6.*" 76gdb_test "s 1" "main .*/x1.cc:15.*" 77gdb_test "s 1" ".*16.*" 78if [istarget "hppa64-*-*"] { 79 gdb_test "s 1" "0x\[0-9a-f\]+ in .*START.*" 80 gdb_test "c" ".*Program exited normally.*" 81} else { 82 gdb_test "s 1" "0x\[0-9a-f\]+ in _start .*" 83 gdb_test "s 1" ".*Program exited normally.*" 84} 85 86