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