]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.hp/gdb.objdbg/objdbg04.exp
This commit was manufactured by cvs2svn to create branch 'csl-
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.hp / gdb.objdbg / objdbg04.exp
CommitLineData
7be570e7
JM
1# Test reading debug information from in object files.
2
3if { [skip_hp_tests] } { continue }
4
5if { ![istarget "hppa*-*-hpux*"] } {
6 verbose "HPUX test ignored for non-hppa targets."
7 return 0
8}
9
10set testfile "test"
11set srcsubdir ${srcdir}/${subdir}/objdbg04
12set objdbgdir ${objdir}/${subdir}/objdbg04
13set binfile ${objdbgdir}/${testfile}
14set toolssubdir ${srcdir}/${subdir}/tools
15set 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.
19if [get_compiler_info ${binfile}] {
20 return -1
21}
22
23if {!$hp_aCC_compiler && !$hp_cc_compiler} {
24 return 0
25}
26
7be570e7
JM
27if { [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
31if { [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
36if { [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
41if { [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
46if { [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
55for {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}