Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / testsuite / gdb.hp / gdb.objdbg / objdbg02.exp
blobfcd0fdc9b44e707605c450671714ce0151e229ff
1 # Test reading debug information from in object files.
3 if { [skip_hp_tests] } { continue }
5 if { ![istarget "hppa*-*-hpux*"] } {
6 verbose "HPUX test ignored for non-hppa targets."
7 return 0
10 set testfile "test"
11 set srcsubdir ${srcdir}/${subdir}/objdbg02
12 set objdbgdir ${objdir}/${subdir}/objdbg02
13 set binfile ${objdbgdir}/${testfile}
14 set toolssubdir ${srcdir}/${subdir}/tools
16 # Create and source the file that provides information about the compiler
17 # used to compile the test case.
18 if [get_compiler_info ${binfile}] {
19 return -1
22 if {!$hp_aCC_compiler && !$hp_cc_compiler} {
23 return 0
26 if { [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."
30 if { [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
35 if { [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
40 if { [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
45 remote_exec build "rm -f ${objdbgdir}/test.a"
46 set status [remote_exec build "ar cr ${objdbgdir}/test.a ${objdbgdir}/x2.o ${objdbgdir}/x3.o"]
47 if { [lindex $status 0] != 0 } {
48 perror "Couldn't compile test.a"
49 return -1
51 remote_exec build "rm -f ${objdbgdir}/x2.o ${objdbgdir}/x3.o"
53 if { [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
58 # Test loading debug information from an archive file
60 gdb_exit
61 gdb_start
62 gdb_reinitialize_dir ${srcsubdir}
63 gdb_load ${binfile}
65 gdb_test "b main" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file ..*/x1.cc, line 12."
66 gdb_test "run" "Starting program:.*Breakpoint \[0-9\]+, main .*/x1.cc:12.*"
67 gdb_test "s 1" ".*13.*"
68 gdb_test "s 1" "foo1 .*/x2.cc:15.*"
69 gdb_test "s 1" ".*16.*"
70 gdb_test "s 1" "foo2 .*/x2.cc:10.*"
71 gdb_test "s 1" ".*11.*"
72 gdb_test "s 1" "foo1 .*/x2.cc:17.*"
73 gdb_test "s 1" "main .*/x1.cc:14.*"
74 gdb_test "s 1" "foo3 .*/x3.cc:5.*"
75 gdb_test "s 1" ".*6.*"
76 gdb_test "s 1" "main .*/x1.cc:15.*"
77 gdb_test "s 1" ".*16.*"
78 if [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.*"