]>
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}/objdbg04 | |
12 | set objdbgdir ${objdir}/${subdir}/objdbg04 | |
13 | set binfile ${objdbgdir}/${testfile} | |
14 | set toolssubdir ${srcdir}/${subdir}/tools | |
15 | set symaddrfile ${toolssubdir}/symaddr | |
16 | ||
afabe08c JL |
17 | # Create and source the file that provides information about the compiler |
18 | # used to compile the test case. | |
19 | if [get_compiler_info ${binfile}] { | |
20 | return -1 | |
21 | } | |
22 | ||
23 | if {!$hp_aCC_compiler && !$hp_cc_compiler} { | |
24 | return 0 | |
25 | } | |
26 | ||
7be570e7 JM |
27 | if { [gdb_compile "${toolssubdir}/test-objdbg.cc" "${objdbgdir}/test-objdbg.o" object "debug c++ {additional_flags=-I${toolssubdir} +objdebug}"] != "" } { |
28 | gdb_suppress_entire_file "WARNING: +objdebug option is not supported in this compiler version, test ignored." | |
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 "${objdbgdir}/x1.o ${objdbgdir}/x2.o" "${binfile}0" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } { | |
42 | perror "Couldn't compile x1.cc" | |
43 | return -1 | |
44 | } | |
45 | ||
46 | if { [gdb_compile "${objdbgdir}/x2.o ${objdbgdir}/x1.o" "${binfile}1" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } { | |
47 | perror "Couldn't compile x1.cc" | |
48 | return -1 | |
49 | } | |
50 | ||
51 | # Test two executables. The first has x1.cc linked first, the second | |
52 | # has x2.cc linked first. The difference is which COMDAT section was | |
53 | # picked. | |
54 | ||
55 | for {set filenum 0} {$filenum < 2} {incr filenum 1} { | |
56 | gdb_exit | |
57 | gdb_start | |
58 | gdb_reinitialize_dir ${srcsubdir} | |
59 | gdb_load ${binfile}${filenum} | |
60 | ||
61 | gdb_test "ptype Adder" "type = template <class T> (class |)Adder {..*T val.*;.*}(.*template instantiations:.*Adder<int>|)" | |
62 | gdb_test "ptype Adder<int>" "type = (class |)Adder<int> {.*private:.*int val;.*public:.*void set( |)\\(int\\);.*int get( |)\\(void\\);.*int add( |)\\(int\\);.*}" | |
63 | gdb_test "ptype Adder" "type = template <class T> (class |)Adder {..*T val.*;.*}(.*template instantiations:.*Adder<int>|)" | |
64 | ||
65 | } |