1 # Copyright
(C
) 1997, 1998 Free Software Foundation
, Inc.
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.
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.
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.
17 # Please email
any bugs
, comments
, and
/or additions to this file to
:
18 # bug
-gdb@prep.ai.mit.edu
20 # GDB tests
for names beginning with
'$'
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.
28 # This file was written by Satish Pai
<pai@apollo.hp.com
>
36 # test running programs
41 if { [skip_hp_tests
] } { continue }
44 set srcfile $
{testfile
}.c
45 set binfile $
{objdir
}/$
{subdir
}/$
{testfile
}
47 if { [gdb_compile
"${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
48 gdb_suppress_entire_file
"Testcase compile failed, so all tests in this file will automatically fail."
55 gdb_reinitialize_dir $srcdir
/$subdir
59 #
set it up at a breakpoint so we can play with the
variable values
62 if ![runto_main
] then {
63 perror
"couldn't run to breakpoint"
67 # Test
for millicode routines
68 # hppa64 does not support dyncall
69 if ![istarget
"hppa64*-*-*"] {
70 send_gdb
"print \$\$dyncall\n"
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" }
78 send_gdb
"print \$\$dyncall_external\n"
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" }
87 #
Set a breakpoint
on a millicode routine
88 send_gdb
"break \$\$dyncall\n"
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"
95 -re
"$gdb_prompt $" { fail "print break \$\$dyncall" }
96 timeout
{ fail
"(timeout) print break \$\$dyncall" }
99 # Disassemble $$dyncall
100 send_gdb
"disassemble \$\$dyncall\n"
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" }
107 # Try to
set $$dyncall like a convenience var.
108 send_gdb
"set \$\$dyncall = 77\n"
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" }
116 # Try out some other $
name, not millicode
117 if [istarget
"hppa64*-*-*"] {
118 #hppa64 uses __argv instead of $ARGV.
119 send_gdb
"print \__argv\n"
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)"
125 -re
"$gdb_prompt $" { fail "print \__argv" }
126 timeout
{ fail
"(timeout) print \__argv" }
129 send_gdb
"ptype \__argv\n"
131 -re
"type = <data variable, no debug info>.*$gdb_prompt $" {
134 -re
"type = void.*$gdb_prompt $" {
135 fail
"ptype \__argv (interpreted as convenience var)"
137 -re
"$gdb_prompt $" { fail "ptype \__argv" }
138 timeout
{ fail
"(timeout) ptype \__argv" }
141 send_gdb
"print \$ARGV\n"
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" }
148 send_gdb
"ptype \$ARGV\n"
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" }