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