Upload Tizen:Base source
[external/gdb.git] / gdb / testsuite / gdb.hp / gdb.base-hp / pxdb.exp
1 # Copyright (C) 1998, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16
17 # This file is part of the gdb testsuite
18
19
20 # pxdb.exp   Test that gdb calls pxdb on an application
21 #            built without it.
22 #
23 if $tracelevel then {
24         strace $tracelevel
25 }
26
27
28 if { [skip_hp_tests] } then { continue }
29
30 set testfile pxdb
31 set srcfile ${testfile}.c
32 set objfile ${objdir}/${subdir}/${testfile}.o
33 set binfile ${objdir}/${subdir}/${testfile}
34
35 if [get_compiler_info ${binfile} "c++"] {
36     return -1;
37 }
38
39 if { $gcc_compiled } then { continue }
40
41 # To build a non-pxdb-ed file, use
42 #
43 #     <compile to .o file>
44 #     export LD_PXDB /dev/null
45 #     ld -o hello_no_pxdb hello.o /opt/langtools/lib/end.o /usr/ccs/lib/crt0.o -lc
46 #
47
48 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
49     untested pxdb.exp
50     return -1
51 }
52
53 #
54 # use this to debug:
55 #log_user 1
56
57
58 # Following should get the error message:
59 #
60 #      ld: (Warning) Can't exec pxdb using path: /dev/null
61 #
62 #execute_anywhere "ksh -c \"export LD_PXDB=/dev/null\""
63
64 if [istarget "hppa64-*-*"] {
65 set cmdline  "ksh -c \"LD_PXDB=/dev/null ld -o ${binfile} ${objfile} /opt/langtools/lib/pa20_64/crt0.o /opt/langtools/lib/pa20_64/end.o -lc\""
66 } else {
67 set cmdline  "ksh -c \"LD_PXDB=/dev/null ld -o ${binfile} ${objfile} /usr/ccs/lib/crt0.o /opt/langtools/lib/end.o -lc\""
68 }
69
70 remote_exec build "rm ${binfile}"
71 remote_exec build $cmdline
72
73 gdb_exit
74 gdb_start
75 gdb_reinitialize_dir $srcdir/$subdir
76
77 # We expect to see this:
78 #
79 #  "warning: File not processed by pxdb--about to process now.
80 #  "
81 #  ".
82 #  "Procedures: 7
83 #  "Files: 2
84 #  "Reading symbols from ~/c_code.dir/hello_no_pxdb...done.
85 #  "(gdb)
86 #
87 send_gdb "file ${binfile}\n"
88 gdb_expect {
89
90     -re ".*warning: File not processed by pxdb.*Procedures: \[0-9\]+.*$gdb_prompt $"\
91                             { pass "PXDB call"        }
92
93     -re "$gdb_prompt $" {
94       if [istarget hppa*-*-hpux*] {
95         pass "Didn't call pxdb"
96       } else { 
97         fail "Didn't call pxdb"
98       }
99     }
100
101     -re ".*$gdb_prompt $"       { fail "Some other message" }
102
103     timeout                 { fail "call pxdb (timeout)" }
104 }
105
106 # Make sure the new data makes sense
107 #
108 if { ![runto callee] } then { return }
109
110 send_gdb "print x\n"
111 gdb_expect {
112    -re ".*= 1.*$gdb_prompt $"    { pass "Good data after pxdb call" }
113    -re ".*$gdb_prompt $"         { fail "No data after pxdb call" }
114    timeout { fail "(timeout)" }
115 }
116
117 gdb_exit
118 return 0
119
120
121
122
123