import gdb-1999-08-16 snapshot
[deliverable/binutils-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 if { [gdb_compile "${toolssubdir}/test-objdbg.cc" "${objdbgdir}/test-objdbg.o" object "debug c++ {additional_flags=-I${toolssubdir} +objdebug}"] != "" } {
18 gdb_suppress_entire_file "WARNING: +objdebug option is not supported in this compiler version, test ignored."
19 }
20
21 if { [gdb_compile "${srcsubdir}/x1.cc" "${objdbgdir}/x1.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
22 perror "Couldn't compile x1.cc"
23 return -1
24 }
25
26 if { [gdb_compile "${srcsubdir}/x2.cc" "${objdbgdir}/x2.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
27 perror "Couldn't compile x2.cc"
28 return -1
29 }
30
31 if { [gdb_compile "${objdbgdir}/x1.o ${objdbgdir}/x2.o" "${binfile}0" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
32 perror "Couldn't compile x1.cc"
33 return -1
34 }
35
36 if { [gdb_compile "${objdbgdir}/x2.o ${objdbgdir}/x1.o" "${binfile}1" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
37 perror "Couldn't compile x1.cc"
38 return -1
39 }
40
41 # Test two executables. The first has x1.cc linked first, the second
42 # has x2.cc linked first. The difference is which COMDAT section was
43 # picked.
44
45 for {set filenum 0} {$filenum < 2} {incr filenum 1} {
46 gdb_exit
47 gdb_start
48 gdb_reinitialize_dir ${srcsubdir}
49 gdb_load ${binfile}${filenum}
50
51 gdb_test "ptype Adder" "type = template <class T> (class |)Adder {..*T val.*;.*}(.*template instantiations:.*Adder<int>|)"
52 gdb_test "ptype Adder<int>" "type = (class |)Adder<int> {.*private:.*int val;.*public:.*void set( |)\\(int\\);.*int get( |)\\(void\\);.*int add( |)\\(int\\);.*}"
53 gdb_test "ptype Adder" "type = template <class T> (class |)Adder {..*T val.*;.*}(.*template instantiations:.*Adder<int>|)"
54
55 }
This page took 0.040867 seconds and 4 git commands to generate.