# Copyright (C) 1997, 1998, 2007, 2008 Free Software Foundation, Inc.
|
# Copyright (C) 1997, 1998, 2007, 2008 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 3 of the License, or
|
# the Free Software Foundation; either version 3 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, see .
|
# along with this program. If not, see .
|
|
|
# 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
|
|
|
if $tracelevel then {
|
if $tracelevel then {
|
strace $tracelevel
|
strace $tracelevel
|
}
|
}
|
|
|
set prms_id 0
|
set prms_id 0
|
set bug_id 0
|
set bug_id 0
|
|
|
set testfile langs
|
set testfile langs
|
set binfile ${objdir}/${subdir}/${testfile}
|
set binfile ${objdir}/${subdir}/${testfile}
|
|
|
if [is_remote host] {
|
if [is_remote host] {
|
remote_download host ${srcdir}/${subdir}/langs1.f
|
remote_download host ${srcdir}/${subdir}/langs1.f
|
remote_download host ${srcdir}/${subdir}/langs2.cxx
|
remote_download host ${srcdir}/${subdir}/langs2.cxx
|
}
|
}
|
|
|
|
|
if { [gdb_compile "${srcdir}/${subdir}/langs0.c" "${binfile}0.o" object {debug}] != "" } {
|
if { [gdb_compile "${srcdir}/${subdir}/langs0.c" "${binfile}0.o" object {debug}] != "" } {
|
untested langs.exp
|
untested langs.exp
|
return -1
|
return -1
|
}
|
}
|
|
|
if { [gdb_compile "${srcdir}/${subdir}/langs1.c" "${binfile}1.o" object {debug}] != "" } {
|
if { [gdb_compile "${srcdir}/${subdir}/langs1.c" "${binfile}1.o" object {debug}] != "" } {
|
untested langs.exp
|
untested langs.exp
|
return -1
|
return -1
|
}
|
}
|
|
|
if { [gdb_compile "${srcdir}/${subdir}/langs2.c" "${binfile}2.o" object {debug}] != "" } {
|
if { [gdb_compile "${srcdir}/${subdir}/langs2.c" "${binfile}2.o" object {debug}] != "" } {
|
untested langs.exp
|
untested langs.exp
|
return -1
|
return -1
|
}
|
}
|
|
|
if { [gdb_compile "${binfile}0.o ${binfile}1.o ${binfile}2.o" ${binfile} executable {debug}] != "" } {
|
if { [gdb_compile "${binfile}0.o ${binfile}1.o ${binfile}2.o" ${binfile} executable {debug}] != "" } {
|
untested langs.exp
|
untested langs.exp
|
return -1
|
return -1
|
}
|
}
|
|
|
set oldtimeout $timeout
|
set oldtimeout $timeout
|
set timeout 10
|
set timeout 10
|
|
|
|
|
|
|
# Create and source the file that provides information about the compiler
|
# Create and source the file that provides information about the compiler
|
# used to compile the test case.
|
# used to compile the test case.
|
if [get_compiler_info ${binfile}] {
|
if [get_compiler_info ${binfile}] {
|
return -1;
|
return -1;
|
}
|
}
|
|
|
gdb_exit
|
gdb_exit
|
gdb_start
|
gdb_start
|
gdb_reinitialize_dir $srcdir/$subdir
|
gdb_reinitialize_dir $srcdir/$subdir
|
gdb_load $binfile
|
gdb_load $binfile
|
|
|
gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" {
|
gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" {
|
-re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
|
-re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
|
|
|
gdb_test "n" "" "break on nonexistent function in langs.exp"
|
gdb_test "n" "" "break on nonexistent function in langs.exp"
|
}
|
}
|
-re "Breakpoint .* (deferred).*$gdb_prompt $" {
|
-re "Breakpoint .* (deferred).*$gdb_prompt $" {
|
pass "break on nonexistent function in langs.exp"
|
pass "break on nonexistent function in langs.exp"
|
}
|
}
|
}
|
}
|
|
|
if {$hp_aCC_compiler} {
|
if {$hp_aCC_compiler} {
|
set isfixed 1
|
set isfixed 1
|
set lang c\\+\\+
|
set lang c\\+\\+
|
set ext cxx
|
set ext cxx
|
set foo_func foo__Fi__Fi
|
set foo_func foo__Fi__Fi
|
set do_func do::langs0
|
set do_func do::langs0
|
} else {
|
} else {
|
if {$hp_cc_compiler} {
|
if {$hp_cc_compiler} {
|
set isfixed 1
|
set isfixed 1
|
set lang c
|
set lang c
|
set ext c
|
set ext c
|
} else {
|
} else {
|
set isfixed 0
|
set isfixed 0
|
}
|
}
|
set foo_func foo__Fi
|
set foo_func foo__Fi
|
set do_func langs0__2do
|
set do_func langs0__2do
|
}
|
}
|
|
|
if [runto csub] then {
|
if [runto csub] then {
|
|
|
if { !$isfixed } { set lang c }
|
if { !$isfixed } { set lang c }
|
gdb_test "show language" "currently $lang\".*" \
|
gdb_test "show language" "currently $lang\".*" \
|
"show language at csub in langs.exp"
|
"show language at csub in langs.exp"
|
# On some machines, foo doesn't get demangled because the N_SOL for
|
# On some machines, foo doesn't get demangled because the N_SOL for
|
# langs2.cxx is seen only after the function stab for foo. So
|
# langs2.cxx is seen only after the function stab for foo. So
|
# the following regexps are kludged to accept foo__Fi as well as foo,
|
# the following regexps are kludged to accept foo__Fi as well as foo,
|
# even though only the latter is correct. I haven't tried to xfail it
|
# even though only the latter is correct. I haven't tried to xfail it
|
# because it depends on details of the compiler.
|
# because it depends on details of the compiler.
|
|
|
# Take out xfail. This test has been passing for some time now.
|
# Take out xfail. This test has been passing for some time now.
|
#if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
|
#if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
|
gdb_test "bt" "#0.*csub.*#1.*(foo|$foo_func) \\(.*#2.*cppsub_ .*#3.*fsub.*#4.*$do_func \\(.*#5 \[0-9a-fx\]* in main.*" "backtrace in langs.exp"
|
gdb_test "bt" "#0.*csub.*#1.*(foo|$foo_func) \\(.*#2.*cppsub_ .*#3.*fsub.*#4.*$do_func \\(.*#5 \[0-9a-fx\]* in main.*" "backtrace in langs.exp"
|
|
|
if { !$isfixed } { set lang c\\+\\+; set ext cxx }
|
if { !$isfixed } { set lang c\\+\\+; set ext cxx }
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
gdb_test "up" ".* in (foo|$foo_func).* at langs2\\.$ext.*return csub \\(.*" \
|
gdb_test "up" ".* in (foo|$foo_func).* at langs2\\.$ext.*return csub \\(.*" \
|
"up to foo in langs.exp"
|
"up to foo in langs.exp"
|
gdb_test "show language" "currently $lang.*" \
|
gdb_test "show language" "currently $lang.*" \
|
"show language at foo in langs.exp"
|
"show language at foo in langs.exp"
|
|
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
gdb_test "up" ".* in cppsub_ .* at langs2\\.$ext.*return foo \\(.*" \
|
gdb_test "up" ".* in cppsub_ .* at langs2\\.$ext.*return foo \\(.*" \
|
"up to cppsub_ in langs.exp"
|
"up to cppsub_ in langs.exp"
|
gdb_test "show language" "currently $lang.*" \
|
gdb_test "show language" "currently $lang.*" \
|
"show language at cppsub_ in langs.exp"
|
"show language at cppsub_ in langs.exp"
|
|
|
if { !$isfixed } { set lang fortran }
|
if { !$isfixed } { set lang fortran }
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
|
gdb_test "up" ".* in fsub.* at langs1\\.f.*" \
|
gdb_test "up" ".* in fsub.* at langs1\\.f.*" \
|
"up to fsub in langs.exp"
|
"up to fsub in langs.exp"
|
gdb_test "show language" "currently $lang.*" \
|
gdb_test "show language" "currently $lang.*" \
|
"show language at fsub in langs.exp"
|
"show language at fsub in langs.exp"
|
|
|
# Take out xfail. This test has been passing for sometime now.
|
# Take out xfail. This test has been passing for sometime now.
|
#if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
|
#if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
|
if { !$isfixed } { set lang c }
|
if { !$isfixed } { set lang c }
|
gdb_test "up" ".* in $do_func .* at .*langs0\\.c.*return fsub.*" \
|
gdb_test "up" ".* in $do_func .* at .*langs0\\.c.*return fsub.*" \
|
"up to langs0__2do in langs.exp"
|
"up to langs0__2do in langs.exp"
|
gdb_test "show language" "currently $lang\".*" \
|
gdb_test "show language" "currently $lang\".*" \
|
"show language at langs0__2do in langs.exp"
|
"show language at langs0__2do in langs.exp"
|
|
|
gdb_test "up" ".* in main .* at .*langs0\\.c.*if \\(langs0__2do \\(.*" \
|
gdb_test "up" ".* in main .* at .*langs0\\.c.*if \\(langs0__2do \\(.*" \
|
"up to main in langs.exp"
|
"up to main in langs.exp"
|
gdb_test "show language" "currently $lang\".*" \
|
gdb_test "show language" "currently $lang\".*" \
|
"show language at main in langs.exp"
|
"show language at main in langs.exp"
|
|
|
if [target_info exists gdb,noresults] { return }
|
if [target_info exists gdb,noresults] { return }
|
|
|
if [target_info exists use_gdb_stub] {
|
if [target_info exists use_gdb_stub] {
|
gdb_breakpoint "exit"
|
gdb_breakpoint "exit"
|
gdb_test "cont" "Breakpoint .*exit.*" "continue to exit in langs.exp"
|
gdb_test "cont" "Breakpoint .*exit.*" "continue to exit in langs.exp"
|
} else {
|
} else {
|
gdb_test "cont" "Program exited normally\\..*" \
|
gdb_test "cont" "Program exited normally\\..*" \
|
"continue to exit in langs.exp"
|
"continue to exit in langs.exp"
|
}
|
}
|
}
|
}
|
|
|
gdb_exit
|
gdb_exit
|
gdb_start
|
gdb_start
|
gdb_reinitialize_dir $srcdir/$subdir
|
gdb_reinitialize_dir $srcdir/$subdir
|
gdb_load $binfile
|
gdb_load $binfile
|
|
|
# Try exercising the "minimal" language a bit...
|
# Try exercising the "minimal" language a bit...
|
|
|
if [runto csub] then {
|
if [runto csub] then {
|
gdb_test "set lang minimal" \
|
gdb_test "set lang minimal" \
|
"Warning: the current language does not match this frame." \
|
"Warning: the current language does not match this frame." \
|
"set lang to minimal"
|
"set lang to minimal"
|
|
|
gdb_test "print x" " = 5000" "print parameter value"
|
gdb_test "print x" " = 5000" "print parameter value"
|
}
|
}
|
|
|
set timeout $oldtimeout
|
set timeout $oldtimeout
|
return 0
|
return 0
|
|
|