* gdb.arch/altivec-abi.exp: Replace gdb_suppress_entire_file with
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.hp / gdb.base-hp / dollar.exp
1 # Copyright (C) 1997, 1998 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 2 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, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
19
20 # GDB tests for names beginning with '$'
21
22 # This is aimed at HP-UX systems where a lot of system
23 # routines and names begin with '$' or '$$'. GDB 4.16 was
24 # unable to deal with these names as they clashed with
25 # convenience variables. Wildebeest should accept such
26 # names in preference to convenience variables.
27
28 # This file was written by Satish Pai <pai@apollo.hp.com>
29 # 1997-09-24
30
31 if $tracelevel then {
32 strace $tracelevel
33 }
34
35 #
36 # test running programs
37 #
38 set prms_id 0
39 set bug_id 0
40
41 if { [skip_hp_tests] } { continue }
42
43 set testfile "dollar"
44 set srcfile ${testfile}.c
45 set binfile ${objdir}/${subdir}/${testfile}
46
47 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
48 untested dollar.exp
49 return -1
50 }
51
52 #source ${binfile}.ci
53
54 gdb_exit
55 gdb_start
56 gdb_reinitialize_dir $srcdir/$subdir
57 gdb_load ${binfile}
58
59 #
60 # set it up at a breakpoint so we can play with the variable values
61 #
62
63 if ![runto_main] then {
64 perror "couldn't run to breakpoint"
65 continue
66 }
67
68 # Test for millicode routines
69 # hppa64 does not support dyncall
70 if ![istarget "hppa64*-*-*"] {
71 send_gdb "print \$\$dyncall\n"
72 gdb_expect {
73 -re "\\$\[0-9\]* = \\{<text variable, no debug info>\\} $hex <>.*$gdb_prompt $" { pass "print \$\$dyncall" }
74 -re "\\$\[0-9\]* = \\{<text variable, no debug info>\\} $hex <.*dyncall>.*$gdb_prompt $" { pass "print \$\$dyncall" }
75 -re "\\$\[0-9\]* = void" { fail "print \$\$dyncall -- interpreted as convenience var" }
76 -re "$gdb_prompt $" { fail "print \$\$dyncall" }
77 timeout { fail "(timeout) print \$\$dyncall" }
78 }
79 send_gdb "print \$\$dyncall_external\n"
80 gdb_expect {
81 -re "\\$\[0-9\]* = \\{<text variable, no debug info>\\} $hex <>.*$gdb_prompt $" { pass "print \$\$dyncall_external" }
82 -re "\\$\[0-9\]* = \\{<text variable, no debug info>\\} $hex <.*dyncall_external>.*$gdb_prompt $" { pass "print \$\$dyncall_external" }
83 -re "\\$\[0-9\]* = void" { fail "print \$\$dyncall_external -- interpreted as convenience var" }
84 -re "$gdb_prompt $" { fail "print \$\$dyncall_external" }
85 timeout { fail "(timeout) print \$\$dyncall_external" }
86 }
87
88 # Set a breakpoint on a millicode routine
89 send_gdb "break \$\$dyncall\n"
90 gdb_expect {
91 -re "Breakpoint \[0-9\]* at $hex.*$gdb_prompt $" { pass "break \$\$dyncall" }
92 -re "Function.*not defined.*$gdb_prompt $" {fail "break \$\$dyncall -- no \$\$dyncall?" }
93 -re "Convenience variables used in line specs must have integer values\\..*$gdb_prompt $" {
94 fail "break \$\$dyncall -- treated as convenince variable"
95 }
96 -re "$gdb_prompt $" { fail "print break \$\$dyncall" }
97 timeout { fail "(timeout) print break \$\$dyncall" }
98 }
99
100 # Disassemble $$dyncall
101 send_gdb "disassemble \$\$dyncall\n"
102 gdb_expect {
103 -re "Dump of assembler code for function.*$gdb_prompt $" { pass "disas \$\$dyncall" }
104 -re "$gdb_prompt $" { fail "disas \$\$dyncall" }
105 timeout { fail "(timeout) disas \$\$dyncall" }
106 }
107
108 # Try to set $$dyncall like a convenience var.
109 send_gdb "set \$\$dyncall = 77\n"
110 gdb_expect {
111 -re "Invalid cast.*$gdb_prompt $" { pass "set \$\$dyncall = 77" }
112 -re "$gdb_prompt $" { fail "set \$\$dyncall = 77" }
113 timeout { fail "(timeout) set \$\$dyncall = 77" }
114 }
115 }
116
117 # Try out some other $ name, not millicode
118 if [istarget "hppa64*-*-*"] {
119 #hppa64 uses __argv instead of $ARGV.
120 send_gdb "print \__argv\n"
121 gdb_expect {
122 -re "\\$\[0-9\]* = \[0-9\]*.*$gdb_prompt $" { pass "print \__argv" }
123 -re "\\$\[0-9\]* = void.*$gdb_prompt $" {
124 fail "print \__argv (interpreted as convenience var)"
125 }
126 -re "$gdb_prompt $" { fail "print \__argv" }
127 timeout { fail "(timeout) print \__argv" }
128 }
129
130 send_gdb "ptype \__argv\n"
131 gdb_expect {
132 -re "type = <data variable, no debug info>.*$gdb_prompt $" {
133 pass "ptype \__argv"
134 }
135 -re "type = void.*$gdb_prompt $" {
136 fail "ptype \__argv (interpreted as convenience var)"
137 }
138 -re "$gdb_prompt $" { fail "ptype \__argv" }
139 timeout { fail "(timeout) ptype \__argv" }
140 }
141 } else {
142 send_gdb "print \$ARGV\n"
143 gdb_expect {
144 -re "\\$\[0-9\]* = \[0-9\]*.*$gdb_prompt $" { pass "print \$ARGV" }
145 -re "\\$\[0-9\]* = void.*$gdb_prompt $" { fail "print \$ARGV (interpreted as convenience var)" }
146 -re "$gdb_prompt $" { fail "print \$ARGV" }
147 timeout { fail "(timeout) print \$ARGV" }
148 }
149 send_gdb "ptype \$ARGV\n"
150 gdb_expect {
151 -re "type = <data variable, no debug info>.*$gdb_prompt $" { pass "ptype \$ARGV" }
152 -re "type = void.*$gdb_prompt $" { fail "ptype \$ARGV (interpreted as convenience var)" }
153 -re "$gdb_prompt $" { fail "ptype \$ARGV" }
154 timeout { fail "(timeout) ptype \$ARGV" }
155 }
156 }
This page took 0.033073 seconds and 4 git commands to generate.