-# Copyright (C) 1992, 1994, 1995, 1997, 1998 Free Software Foundation, Inc.
+# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2007, 2008,
+# 2009, 2010 Free Software Foundation, Inc.
# 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
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This file was written by Fred Fish. (fnf@cygnus.com)
strace $tracelevel
}
-set prms_id 0
-set bug_id 0
set testfile "list"
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/list0.c" "${binfile}0.o" object {debug}] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ untested list.exp
+ return -1
}
if { [gdb_compile "${srcdir}/${subdir}/list1.c" "${binfile}1.o" object {debug}] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ untested list.exp
+ return -1
}
if { [gdb_compile "${binfile}0.o ${binfile}1.o" ${binfile} executable {debug}] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ untested list.exp
+ return -1
}
global set_listsize_count;
incr set_listsize_count;
- if [gdb_test "set listsize $arg" "" "setting listsize to $arg #$set_listsize_count"] {
+ if [gdb_test "set listsize $arg" ".*" "setting listsize to $arg #$set_listsize_count"] {
return 0;
}
if { $arg <= 0 } {
gdb_test "show listsize" "Number of source lines gdb will list by default is 10.*" "show default list size"
# Show the default lines
+ # Note that remote targets that have debugging info for _start available will
+ # list the lines there instead of main, so we skip this test for remote targets.
# The second case is for optimized code, it is still correct.
- if ![isnative] {
+ if [target_info exists use_gdb_stub] {
runto_main;
unsupported "list default lines around main";
} else {
# Try just two lines
if [ set_listsize 2 ] {
- gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 2"
+ gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 1 with listsize 2"
gdb_test "list 2" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 2 with listsize 2"
gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+" "list line 3 with listsize 2"
}
# Try small listsize > 1 that is an odd number
if [ set_listsize 3 ] {
- setup_xfail "*-*-*"
- gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"2\[ \t\]+" "list line 1 with listsize 3"
+ gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 1 with listsize 3"
gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 2 with listsize 3"
-
gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[(\]+\[)\]+\r\n4\[ \t\]+\{" "list line 3 with listsize 3"
}
# Try small listsize > 2 that is an even number.
if [ set_listsize 4 ] then {
- gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 1 with listsize 4"
- gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 2 with listsize 4"
+ gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 1 with listsize 4"
+ gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 2 with listsize 4"
gdb_test "list 3" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 3 with listsize 4"
gdb_test "list 4" "2\[ \t\]+\r\n.*5\[ \t\]+int x;.*" "list line 4 with listsize 4"
proc test_list_include_file {} {
global gdb_prompt
- setup_xfail "a29k-*-udi"
- setup_xfail_format "DWARF 1"
setup_xfail_format "COFF"
- gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*4\[ \t\]+.*foo \(.*x.*\).*" "list line 1 in include file"
+ gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*10\[ \t\]+bar \\(x\\+\\+\\);" "list line 1 in include file"
- setup_xfail "a29k-*-udi"
- setup_xfail_format "DWARF 1"
setup_xfail_format "COFF"
gdb_test "list list0.h:100" "Line number 95 out of range; .*list0.h has 3\[67\] lines." "list message for lines past EOF"
}
send_gdb "list list0.c:1\n"
gdb_expect {
- -re "1\[ \t\]+#include \"list0.h\".*5\[ \t\]+int x;\r\n$gdb_prompt $" {
+ -re "1\[ \t\]+#include \"list0.h\".*10\[ \t]+x = 0;\r\n$gdb_prompt $" {
incr testcnt
}
-re ".*$gdb_prompt $" { fail "list list0.c:1" ; gdb_suppress_tests }
proc test_list_function {} {
global gdb_prompt
- global gcc_compiled
# gcc appears to generate incorrect debugging information for code
# in include files, which breaks this test.
# SunPRO cc is the second case below, it's also correct.
- setup_xfail "a29k-*-udi"
- gdb_test "list main" "(5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;|1\[ \t\]+#include .*8\[ \t\]+breakpoint\[(\]\[)\]+;)" "list function in source file 1"
+ gdb_test "list main" "(5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;|1\[ \t\]+#include .*10\[ \t\]+x = 0;)" "list function in source file 1"
# Ultrix gdb takes the second case below; it's also correct.
# SunPRO cc is the third case.
# Test "list function" for C include file
# Ultrix gdb is the second case, still correct.
# SunPRO cc is the third case.
- setup_xfail "powerpc-*-*"
- setup_xfail_format "DWARF 1"
gdb_test "list foo" "(3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;|2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;|1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;)" "list function in include file"
}
# gcc appears to generate incorrect debugging information for code
# in include files, which breaks this test.
# SunPRO cc is the second case below, it's also correct.
- setup_xfail "a29k-*-udi"
send_gdb "list list0.c:main\n"
gdb_expect {
- -re "1\[ \t\]+#include .*8\[ \t\]+breakpoint\[(\]\[)\]+;\r\n$gdb_prompt $" {
+ -re "1\[ \t\]+#include .*10\[ \t\]+x = 0;\r\n$gdb_prompt $" {
incr testcnt
}
-re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
timeout { fail "list list0.c:main (timeout)" }
}
- # The i960 and a29k-amd-udi are the second case
-
# Not sure what the point of having this function be unused is.
# AIX is legitimately removing it.
setup_xfail "rs6000-*-aix*"
# Ultrix gdb is the second case, one line different but still correct.
# SunPRO cc is the third case.
setup_xfail "rs6000-*-*" 1804
- setup_xfail "powerpc-*-*" 1804
- setup_xfail "a29k-*-udi"
- setup_xfail_format "DWARF 1"
setup_xfail_format "COFF"
send_gdb "list list0.h:foo\n"
gdb_expect {
}
# Ultrix gdb is the second case.
- # a29k-amd-udi is the third case.
send_gdb "list list1.c:bar\n"
gdb_expect {
-re "4\[ \t\]+void.*13\[ \t\]+\}\r\n$gdb_prompt $" {
timeout { fail "list list1.c:bar (timeout)" }
}
- # The i960 and a29k-amd-udi are the second case
-
# Not sure what the point of having this function be unused is.
# AIX is legitimately removing it.
setup_xfail "rs6000-*-aix*"
pass "list filename:function ($testcnt tests)"
+ # Test with quoting.
+ gdb_test "list 'list0.c:main'" "int main.*"
+
# Test some invalid specs
# The following test takes the FIXME result on most systems using
# DWARF. It fails to notice that main() is not in the file requested.
gdb_test "list foobar.c:main" "No source file named foobar.c.|Location not found" "list filename:function; nonexistant file"
- setup_xfail_format "DWARF 1"
gdb_test "list list0.h:foobar" "Function \"foobar\" not defined.|Location not found" "list filename:function; nonexistant function"
}
proc test_forward_search {} {
global timeout
- gdb_test "set listsize 4" ""
+ gdb_test_no_output "set listsize 4"
# On SunOS4, this gives us lines 19-22. On AIX, it gives us
# lines 20-23. This depends on whether the line number of a function
# is considered to be the openbrace or the first statement--either one
gdb_step_for_stub;
}
-gdb_test "set width 0" "" "set width 0"
+gdb_test_no_output "set width 0"
test_listsize
get_debug_format