Upload Tizen:Base source
[external/gdb.git] / gdb / testsuite / gdb.hp / gdb.objdbg / objdbg04.exp
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
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
27 if { [gdb_compile "${toolssubdir}/test-objdbg.cc" "${objdbgdir}/test-objdbg.o" object "debug c++ {additional_flags=-I${toolssubdir} +objdebug}"] != "" } {
28     untested objdbg04.exp
29     return -1
30 }
31
32 if { [gdb_compile "${srcsubdir}/x1.cc" "${objdbgdir}/x1.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
33     perror "Couldn't compile x1.cc"
34     return -1
35 }
36
37 if { [gdb_compile "${srcsubdir}/x2.cc" "${objdbgdir}/x2.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
38     perror "Couldn't compile x2.cc"
39     return -1
40 }
41
42 if { [gdb_compile "${objdbgdir}/x1.o ${objdbgdir}/x2.o" "${binfile}0" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
43     perror "Couldn't compile x1.cc"
44     return -1
45 }
46
47 if { [gdb_compile "${objdbgdir}/x2.o ${objdbgdir}/x1.o" "${binfile}1" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
48     perror "Couldn't compile x1.cc"
49     return -1
50 }
51
52 # Test two executables. The first has x1.cc linked first, the second
53 # has x2.cc linked first.  The difference is which COMDAT section was
54 # picked.
55
56 for {set filenum 0} {$filenum < 2} {incr filenum 1} {
57   gdb_exit
58   gdb_start
59   gdb_reinitialize_dir ${srcsubdir}
60   gdb_load ${binfile}${filenum}
61
62   gdb_test "ptype Adder" "type = template <class T> (class |)Adder {..*T val.*;.*}(.*template instantiations:.*Adder<int>|)"
63   gdb_test "ptype Adder<int>" "type = (class |)Adder<int> {.*private:.*int val;.*public:.*void set( |)\\(int\\);.*int get( |)\\(void\\);.*int add( |)\\(int\\);.*}"
64   gdb_test "ptype Adder" "type = template <class T> (class |)Adder {..*T val.*;.*}(.*template instantiations:.*Adder<int>|)"
65
66 }