]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/dollar.exp
Initial creation of sourceware repository
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / 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 ![ istarget "*-*-hpux*" ] then {
32 return
33 }
34
35 if $tracelevel then {
36 strace $tracelevel
37 }
38
39 #
40 # test running programs
41 #
42 set prms_id 0
43 set bug_id 0
44
45 set testfile "exprs"
46 set srcfile ${testfile}.c
47 set binfile ${objdir}/${subdir}/${testfile}
48
49 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
50 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
51 }
52
53 #source ${binfile}.ci
54
55 gdb_exit
56 gdb_start
57 gdb_reinitialize_dir $srcdir/$subdir
58 gdb_load ${binfile}
59
60 #
61 # set it up at a breakpoint so we can play with the variable values
62 #
63
64 if ![runto_main] then {
65 perror "couldn't run to breakpoint"
66 continue
67 }
68
69 # Test for millicode routines
70 send_gdb "print \$\$dyncall\n"
71 gdb_expect {
72 -re "\\$\[0-9\]* = \\{<text variable, no debug info>\\} $hex <>.*$gdb_prompt $" { pass "print \$\$dyncall" }
73 -re "\\$\[0-9\]* = void" { fail "print \$\$dyncall -- interpreted as convenience var" }
74 -re "$gdb_prompt $" { fail "print \$\$dyncall" }
75 timeout { fail "(timeout) print \$\$dyncall" }
76 }
77 send_gdb "print \$\$dyncall_external\n"
78 gdb_expect {
79 -re "\\$\[0-9\]* = \\{<text variable, no debug info>\\} $hex <>.*$gdb_prompt $" { pass "print \$\$dyncall_external" }
80 -re "\\$\[0-9\]* = void" { fail "print \$\$dyncall_external -- interpreted as convenience var" }
81 -re "$gdb_prompt $" { fail "print \$\$dyncall_external" }
82 timeout { fail "(timeout) print \$\$dyncall_external" }
83 }
84
85 # Set a breakpoint on a millicode routine
86 send_gdb "break \$\$dyncall\n"
87 gdb_expect {
88 -re "Breakpoint \[0-9\]* at $hex.*$gdb_prompt $" { pass "break \$\$dyncall" }
89 -re "Function.*not defined.*$gdb_prompt $" {fail "break \$\$dyncall -- no \$\$dyncall?" }
90 -re "Convenience variables used in line specs must have integer values\\..*$gdb_prompt $" {
91 fail "break \$\$dyncall -- treated as convenince variable"
92 }
93 -re "$gdb_prompt $" { fail "print break \$\$dyncall" }
94 timeout { fail "(timeout) print break \$\$dyncall" }
95 }
96
97 # Disassemble $$dyncall
98 send_gdb "disassemble \$\$dyncall\n"
99 gdb_expect {
100 -re "Dump of assembler code for function.*$gdb_prompt $" { pass "disas \$\$dyncall" }
101 -re "$gdb_prompt $" { fail "disas \$\$dyncall" }
102 timeout { fail "(timeout) disas \$\$dyncall" }
103 }
104
105 # Try to set $$dyncall like a convenience var.
106 send_gdb "set \$\$dyncall = 77\n"
107 gdb_expect {
108 -re "Invalid cast.*$gdb_prompt $" { pass "set \$\$dyncall = 77" }
109 -re "$gdb_prompt $" { fail "set \$\$dyncall = 77" }
110 timeout { fail "(timeout) set \$\$dyncall = 77" }
111 }
112
113 # Try out some other $ name, not millicode
114 send_gdb "print \$ARGV\n"
115 gdb_expect {
116 -re "\\$\[0-9\]* = \[0-9\]*.*$gdb_prompt $" { pass "print \$ARGV" }
117 -re "\\$\[0-9\]* = void.*$gdb_prompt $" { fail "print \$ARGV (interpreted as convenience var)" }
118 -re "$gdb_prompt $" { fail "print \$ARGV" }
119 timeout { fail "(timeout) print \$ARGV" }
120 }
121 send_gdb "ptype \$ARGV\n"
122 gdb_expect {
123 -re "type = <data variable, no debug info>.*$gdb_prompt $" { pass "ptype \$ARGV" }
124 -re "type = void.*$gdb_prompt $" { fail "ptype \$ARGV (interpreted as convenience var)" }
125 -re "$gdb_prompt $" { fail "ptype \$ARGV" }
126 timeout { fail "(timeout) ptype \$ARGV" }
127 }
128