Commit | Line | Data |
---|---|---|
7be570e7 JM |
1 | # Test reading debug information from in object files. |
2 | ||
3 | if { [skip_hp_tests] } { continue } | |
4 | ||
5 | if { ![istarget "hppa*-*-hpux*"] } { | |
6 | verbose "HPUX test ignored for non-hppa targets." | |
7 | return 0 | |
8 | } | |
9 | ||
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 | |
15 | ||
afabe08c JL |
16 | # Create and source the file that provides information about the compiler |
17 | # used to compile the test case. | |
4c93b1db | 18 | if [get_compiler_info] { |
afabe08c JL |
19 | return -1 |
20 | } | |
21 | ||
22 | if {!$hp_aCC_compiler && !$hp_cc_compiler} { | |
23 | return 0 | |
24 | } | |
25 | ||
7be570e7 | 26 | if { [gdb_compile "${toolssubdir}/test-objdbg.cc" "${objdbgdir}/test-objdbg.o" object "debug c++ {additional_flags=-I${toolssubdir} +objdebug}"] != "" } { |
b60f0898 JB |
27 | untested objdbg02.exp |
28 | return -1 | |
7be570e7 JM |
29 | } |
30 | ||
31 | if { [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 | ||
36 | if { [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 | ||
41 | if { [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 | ||
46 | remote_exec build "rm -f ${objdbgdir}/test.a" | |
47 | set status [remote_exec build "ar cr ${objdbgdir}/test.a ${objdbgdir}/x2.o ${objdbgdir}/x3.o"] | |
48 | if { [lindex $status 0] != 0 } { | |
49 | perror "Couldn't compile test.a" | |
50 | return -1 | |
51 | } | |
52 | remote_exec build "rm -f ${objdbgdir}/x2.o ${objdbgdir}/x3.o" | |
53 | ||
54 | if { [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 | ||
61 | gdb_exit | |
62 | gdb_start | |
63 | gdb_reinitialize_dir ${srcsubdir} | |
64 | gdb_load ${binfile} | |
65 | ||
66 | gdb_test "b main" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file ..*/x1.cc, line 12." | |
67 | gdb_test "run" "Starting program:.*Breakpoint \[0-9\]+, main .*/x1.cc:12.*" | |
68 | gdb_test "s 1" ".*13.*" | |
69 | gdb_test "s 1" "foo1 .*/x2.cc:15.*" | |
70 | gdb_test "s 1" ".*16.*" | |
71 | gdb_test "s 1" "foo2 .*/x2.cc:10.*" | |
72 | gdb_test "s 1" ".*11.*" | |
73 | gdb_test "s 1" "foo1 .*/x2.cc:17.*" | |
74 | gdb_test "s 1" "main .*/x1.cc:14.*" | |
75 | gdb_test "s 1" "foo3 .*/x3.cc:5.*" | |
76 | gdb_test "s 1" ".*6.*" | |
77 | gdb_test "s 1" "main .*/x1.cc:15.*" | |
78 | gdb_test "s 1" ".*16.*" | |
ca344dff | 79 | if [istarget "hppa64-*-*"] { |
7be570e7 | 80 | gdb_test "s 1" "0x\[0-9a-f\]+ in .*START.*" |
fda326dd | 81 | gdb_continue_to_end |
7be570e7 JM |
82 | } else { |
83 | gdb_test "s 1" "0x\[0-9a-f\]+ in _start .*" | |
fda326dd | 84 | gdb_continue_to_end "" "s 1" |
7be570e7 JM |
85 | } |
86 |