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