# Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
# Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
|
|
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 2 of the License, or
|
# (at your option) any later version.
|
# (at your option) any later version.
|
#
|
#
|
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
#
|
#
|
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
# Please email any bugs, comments, and/or additions to this file to:
|
# bug-gdb@prep.ai.mit.edu
|
# bug-gdb@prep.ai.mit.edu
|
|
|
# GDB tests for names beginning with '$'
|
# GDB tests for names beginning with '$'
|
|
|
# This is aimed at HP-UX systems where a lot of system
|
# This is aimed at HP-UX systems where a lot of system
|
# routines and names begin with '$' or '$$'. GDB 4.16 was
|
# routines and names begin with '$' or '$$'. GDB 4.16 was
|
# unable to deal with these names as they clashed with
|
# unable to deal with these names as they clashed with
|
# convenience variables. Wildebeest should accept such
|
# convenience variables. Wildebeest should accept such
|
# names in preference to convenience variables.
|
# names in preference to convenience variables.
|
|
|
# This file was written by Satish Pai
|
# This file was written by Satish Pai
|
# 1997-09-24
|
# 1997-09-24
|
|
|
if $tracelevel then {
|
if $tracelevel then {
|
strace $tracelevel
|
strace $tracelevel
|
}
|
}
|
|
|
#
|
#
|
# test running programs
|
# test running programs
|
#
|
#
|
set prms_id 0
|
set prms_id 0
|
set bug_id 0
|
set bug_id 0
|
|
|
if { [skip_hp_tests] } { continue }
|
if { [skip_hp_tests] } { continue }
|
|
|
set testfile "dollar"
|
set testfile "dollar"
|
set srcfile ${testfile}.c
|
set srcfile ${testfile}.c
|
set binfile ${objdir}/${subdir}/${testfile}
|
set binfile ${objdir}/${subdir}/${testfile}
|
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
}
|
}
|
|
|
#source ${binfile}.ci
|
#source ${binfile}.ci
|
|
|
gdb_exit
|
gdb_exit
|
gdb_start
|
gdb_start
|
gdb_reinitialize_dir $srcdir/$subdir
|
gdb_reinitialize_dir $srcdir/$subdir
|
gdb_load ${binfile}
|
gdb_load ${binfile}
|
|
|
#
|
#
|
# set it up at a breakpoint so we can play with the variable values
|
# set it up at a breakpoint so we can play with the variable values
|
#
|
#
|
|
|
if ![runto_main] then {
|
if ![runto_main] then {
|
perror "couldn't run to breakpoint"
|
perror "couldn't run to breakpoint"
|
continue
|
continue
|
}
|
}
|
|
|
# Test for millicode routines
|
# Test for millicode routines
|
# hppa2.0w does not support dyncall
|
# hppa2.0w does not support dyncall
|
if ![istarget "hppa2.0w*-*-*"] {
|
if ![istarget "hppa2.0w*-*-*"] {
|
send_gdb "print \$\$dyncall\n"
|
send_gdb "print \$\$dyncall\n"
|
gdb_expect {
|
gdb_expect {
|
-re "\\$\[0-9\]* = \\{\\} $hex <>.*$gdb_prompt $" { pass "print \$\$dyncall" }
|
-re "\\$\[0-9\]* = \\{\\} $hex <>.*$gdb_prompt $" { pass "print \$\$dyncall" }
|
-re "\\$\[0-9\]* = \\{\\} $hex <.*dyncall>.*$gdb_prompt $" { pass "print \$\$dyncall" }
|
-re "\\$\[0-9\]* = \\{\\} $hex <.*dyncall>.*$gdb_prompt $" { pass "print \$\$dyncall" }
|
-re "\\$\[0-9\]* = void" { fail "print \$\$dyncall -- interpreted as convenience var" }
|
-re "\\$\[0-9\]* = void" { fail "print \$\$dyncall -- interpreted as convenience var" }
|
-re "$gdb_prompt $" { fail "print \$\$dyncall" }
|
-re "$gdb_prompt $" { fail "print \$\$dyncall" }
|
timeout { fail "(timeout) print \$\$dyncall" }
|
timeout { fail "(timeout) print \$\$dyncall" }
|
}
|
}
|
send_gdb "print \$\$dyncall_external\n"
|
send_gdb "print \$\$dyncall_external\n"
|
gdb_expect {
|
gdb_expect {
|
-re "\\$\[0-9\]* = \\{\\} $hex <>.*$gdb_prompt $" { pass "print \$\$dyncall_external" }
|
-re "\\$\[0-9\]* = \\{\\} $hex <>.*$gdb_prompt $" { pass "print \$\$dyncall_external" }
|
-re "\\$\[0-9\]* = \\{\\} $hex <.*dyncall_external>.*$gdb_prompt $" { pass "print \$\$dyncall_external" }
|
-re "\\$\[0-9\]* = \\{\\} $hex <.*dyncall_external>.*$gdb_prompt $" { pass "print \$\$dyncall_external" }
|
-re "\\$\[0-9\]* = void" { fail "print \$\$dyncall_external -- interpreted as convenience var" }
|
-re "\\$\[0-9\]* = void" { fail "print \$\$dyncall_external -- interpreted as convenience var" }
|
-re "$gdb_prompt $" { fail "print \$\$dyncall_external" }
|
-re "$gdb_prompt $" { fail "print \$\$dyncall_external" }
|
timeout { fail "(timeout) print \$\$dyncall_external" }
|
timeout { fail "(timeout) print \$\$dyncall_external" }
|
}
|
}
|
|
|
# Set a breakpoint on a millicode routine
|
# Set a breakpoint on a millicode routine
|
send_gdb "break \$\$dyncall\n"
|
send_gdb "break \$\$dyncall\n"
|
gdb_expect {
|
gdb_expect {
|
-re "Breakpoint \[0-9\]* at $hex.*$gdb_prompt $" { pass "break \$\$dyncall" }
|
-re "Breakpoint \[0-9\]* at $hex.*$gdb_prompt $" { pass "break \$\$dyncall" }
|
-re "Function.*not defined.*$gdb_prompt $" {fail "break \$\$dyncall -- no \$\$dyncall?" }
|
-re "Function.*not defined.*$gdb_prompt $" {fail "break \$\$dyncall -- no \$\$dyncall?" }
|
-re "Convenience variables used in line specs must have integer values\\..*$gdb_prompt $" {
|
-re "Convenience variables used in line specs must have integer values\\..*$gdb_prompt $" {
|
fail "break \$\$dyncall -- treated as convenince variable"
|
fail "break \$\$dyncall -- treated as convenince variable"
|
}
|
}
|
-re "$gdb_prompt $" { fail "print break \$\$dyncall" }
|
-re "$gdb_prompt $" { fail "print break \$\$dyncall" }
|
timeout { fail "(timeout) print break \$\$dyncall" }
|
timeout { fail "(timeout) print break \$\$dyncall" }
|
}
|
}
|
|
|
# Disassemble $$dyncall
|
# Disassemble $$dyncall
|
send_gdb "disassemble \$\$dyncall\n"
|
send_gdb "disassemble \$\$dyncall\n"
|
gdb_expect {
|
gdb_expect {
|
-re "Dump of assembler code for function.*$gdb_prompt $" { pass "disas \$\$dyncall" }
|
-re "Dump of assembler code for function.*$gdb_prompt $" { pass "disas \$\$dyncall" }
|
-re "$gdb_prompt $" { fail "disas \$\$dyncall" }
|
-re "$gdb_prompt $" { fail "disas \$\$dyncall" }
|
timeout { fail "(timeout) disas \$\$dyncall" }
|
timeout { fail "(timeout) disas \$\$dyncall" }
|
}
|
}
|
|
|
# Try to set $$dyncall like a convenience var.
|
# Try to set $$dyncall like a convenience var.
|
send_gdb "set \$\$dyncall = 77\n"
|
send_gdb "set \$\$dyncall = 77\n"
|
gdb_expect {
|
gdb_expect {
|
-re "Invalid cast.*$gdb_prompt $" { pass "set \$\$dyncall = 77" }
|
-re "Invalid cast.*$gdb_prompt $" { pass "set \$\$dyncall = 77" }
|
-re "$gdb_prompt $" { fail "set \$\$dyncall = 77" }
|
-re "$gdb_prompt $" { fail "set \$\$dyncall = 77" }
|
timeout { fail "(timeout) set \$\$dyncall = 77" }
|
timeout { fail "(timeout) set \$\$dyncall = 77" }
|
}
|
}
|
}
|
}
|
|
|
# Try out some other $ name, not millicode
|
# Try out some other $ name, not millicode
|
if [istarget "hppa2.0w*-*-*"] {
|
if [istarget "hppa2.0w*-*-*"] {
|
#hppa2.0w uses __argv instead of $ARGV.
|
#hppa2.0w uses __argv instead of $ARGV.
|
send_gdb "print \__argv\n"
|
send_gdb "print \__argv\n"
|
gdb_expect {
|
gdb_expect {
|
-re "\\$\[0-9\]* = \[0-9\]*.*$gdb_prompt $" { pass "print \__argv" }
|
-re "\\$\[0-9\]* = \[0-9\]*.*$gdb_prompt $" { pass "print \__argv" }
|
-re "\\$\[0-9\]* = void.*$gdb_prompt $" {
|
-re "\\$\[0-9\]* = void.*$gdb_prompt $" {
|
fail "print \__argv (interpreted as convenience var)"
|
fail "print \__argv (interpreted as convenience var)"
|
}
|
}
|
-re "$gdb_prompt $" { fail "print \__argv" }
|
-re "$gdb_prompt $" { fail "print \__argv" }
|
timeout { fail "(timeout) print \__argv" }
|
timeout { fail "(timeout) print \__argv" }
|
}
|
}
|
|
|
send_gdb "ptype \__argv\n"
|
send_gdb "ptype \__argv\n"
|
gdb_expect {
|
gdb_expect {
|
-re "type = .*$gdb_prompt $" {
|
-re "type = .*$gdb_prompt $" {
|
pass "ptype \__argv"
|
pass "ptype \__argv"
|
}
|
}
|
-re "type = void.*$gdb_prompt $" {
|
-re "type = void.*$gdb_prompt $" {
|
fail "ptype \__argv (interpreted as convenience var)"
|
fail "ptype \__argv (interpreted as convenience var)"
|
}
|
}
|
-re "$gdb_prompt $" { fail "ptype \__argv" }
|
-re "$gdb_prompt $" { fail "ptype \__argv" }
|
timeout { fail "(timeout) ptype \__argv" }
|
timeout { fail "(timeout) ptype \__argv" }
|
}
|
}
|
} else {
|
} else {
|
send_gdb "print \$ARGV\n"
|
send_gdb "print \$ARGV\n"
|
gdb_expect {
|
gdb_expect {
|
-re "\\$\[0-9\]* = \[0-9\]*.*$gdb_prompt $" { pass "print \$ARGV" }
|
-re "\\$\[0-9\]* = \[0-9\]*.*$gdb_prompt $" { pass "print \$ARGV" }
|
-re "\\$\[0-9\]* = void.*$gdb_prompt $" { fail "print \$ARGV (interpreted as convenience var)" }
|
-re "\\$\[0-9\]* = void.*$gdb_prompt $" { fail "print \$ARGV (interpreted as convenience var)" }
|
-re "$gdb_prompt $" { fail "print \$ARGV" }
|
-re "$gdb_prompt $" { fail "print \$ARGV" }
|
timeout { fail "(timeout) print \$ARGV" }
|
timeout { fail "(timeout) print \$ARGV" }
|
}
|
}
|
send_gdb "ptype \$ARGV\n"
|
send_gdb "ptype \$ARGV\n"
|
gdb_expect {
|
gdb_expect {
|
-re "type = .*$gdb_prompt $" { pass "ptype \$ARGV" }
|
-re "type = .*$gdb_prompt $" { pass "ptype \$ARGV" }
|
-re "type = void.*$gdb_prompt $" { fail "ptype \$ARGV (interpreted as convenience var)" }
|
-re "type = void.*$gdb_prompt $" { fail "ptype \$ARGV (interpreted as convenience var)" }
|
-re "$gdb_prompt $" { fail "ptype \$ARGV" }
|
-re "$gdb_prompt $" { fail "ptype \$ARGV" }
|
timeout { fail "(timeout) ptype \$ARGV" }
|
timeout { fail "(timeout) ptype \$ARGV" }
|
}
|
}
|
}
|
}
|
|
|