gdb:
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / list.exp
index f319ba07c94acdc76d1873df62041c88d31f0177..e0e35b3a4691b12d5e928ad99dd9e9be793252df 100644 (file)
@@ -1,21 +1,18 @@
-# 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)
 
@@ -23,8 +20,6 @@ if $tracelevel then {
        strace $tracelevel
 }
 
-set prms_id 0
-set bug_id 0
 
 set testfile "list"
 set binfile ${objdir}/${subdir}/${testfile}
@@ -34,15 +29,18 @@ remote_download host ${srcdir}/${subdir}/list0.h list0.h
 
 
 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
 }
 
 
@@ -65,7 +63,7 @@ proc set_listsize { arg } {
     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 } {
@@ -92,9 +90,11 @@ proc test_listsize {} {
     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 {
@@ -111,7 +111,7 @@ proc test_listsize {} {
     # 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"
     }
@@ -119,18 +119,16 @@ proc test_listsize {} {
     # 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"
@@ -163,13 +161,9 @@ proc test_listsize {} {
 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"
 }
@@ -185,7 +179,7 @@ proc test_list_filename_and_number {} {
 
     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 }
@@ -225,13 +219,11 @@ proc test_list_filename_and_number {} {
 
 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.
@@ -240,8 +232,6 @@ proc test_list_function {} {
     # 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"
 }
 
@@ -395,10 +385,9 @@ proc test_list_filename_and_function {} {
     # 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 $" {
@@ -408,8 +397,6 @@ proc test_list_filename_and_function {} {
        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*"
@@ -431,9 +418,6 @@ proc test_list_filename_and_function {} {
     # 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 {
@@ -454,7 +438,6 @@ proc test_list_filename_and_function {} {
     }
 
     # 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 $" {
@@ -470,8 +453,6 @@ proc test_list_filename_and_function {} {
        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*"
@@ -490,6 +471,9 @@ proc test_list_filename_and_function {} {
 
     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.
@@ -505,7 +489,6 @@ proc test_list_filename_and_function {} {
 
     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"
 
 }
@@ -513,7 +496,7 @@ proc test_list_filename_and_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
@@ -545,7 +528,7 @@ if [target_info exists gdb_stub] {
     gdb_step_for_stub;
 }
 
-gdb_test "set width 0" "" "set width 0"
+gdb_test_no_output "set width 0"
 
 test_listsize
 get_debug_format
This page took 0.026967 seconds and 4 git commands to generate.