* gdb.base/interp.exp: Remove trailing n in gdb_test commands.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / printcmds.exp
index 3ea3b90b2629ef99d820f1a9aca410d5af64ca0f..e532d71de09a4a9f3325bb40e0593ef3b6f9ab8a 100644 (file)
@@ -1,4 +1,7 @@
-# Copyright (C) 1992, 1994, 1995, 1997 Free Software Foundation, Inc.
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003, 2004
+# 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
@@ -15,7 +18,7 @@
 # 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
+# bug-gdb@gnu.org
 
 # This file was written by Fred Fish. (fnf@cygnus.com)
 
@@ -97,8 +100,8 @@ proc test_integer_literals_rejected {} {
     global gdb_prompt
 
     test_print_reject "p 0x" 
-    gdb_test "p ''" "Empty character constant\\."
-    gdb_test "p '''" "Empty character constant\\."
+    gdb_test "p ''" "(Empty character constant\\.|A character constant must contain at least one character\\.)"
+    gdb_test "p '''" "(Empty character constant\\.|A character constant must contain at least one character\\.)"
     test_print_reject "p '\\'"
 
     # Note that this turns into "p '\\\'" at gdb's input.
@@ -133,7 +136,7 @@ proc test_integer_literals_rejected {} {
 proc test_print_all_chars {} {
     global gdb_prompt
 
-    gdb_test "p ctable1\[0\]"   " = 0 '\\\\000'"
+    gdb_test "p ctable1\[0\]"   " = 0 '\\\\0'"
     gdb_test "p ctable1\[1\]"   " = 1 '\\\\001'"
     gdb_test "p ctable1\[2\]"   " = 2 '\\\\002'"
     gdb_test "p ctable1\[3\]"   " = 3 '\\\\003'"
@@ -144,7 +147,7 @@ proc test_print_all_chars {} {
     gdb_test "p ctable1\[8\]"   " = 8 '\\\\b'"
     gdb_test "p ctable1\[9\]"   " = 9 '\\\\t'"
     gdb_test "p ctable1\[10\]"  " = 10 '\\\\n'"
-    gdb_test "p ctable1\[11\]"  " = 11 '\\\\013'"
+    gdb_test "p ctable1\[11\]"  " = 11 '\\\\v'"
     gdb_test "p ctable1\[12\]"  " = 12 '\\\\f'"
     gdb_test "p ctable1\[13\]"  " = 13 '\\\\r'"
     gdb_test "p ctable1\[14\]"  " = 14 '\\\\016'"
@@ -160,7 +163,7 @@ proc test_print_all_chars {} {
     gdb_test "p ctable1\[24\]"  " = 24 '\\\\030'"
     gdb_test "p ctable1\[25\]"  " = 25 '\\\\031'"
     gdb_test "p ctable1\[26\]"  " = 26 '\\\\032'"
-    gdb_test "p ctable1\[27\]"  " = 27 '\\\\e'"
+    gdb_test "p ctable1\[27\]"  " = 27 '\\\\033'"
     gdb_test "p ctable1\[28\]"  " = 28 '\\\\034'"
     gdb_test "p ctable1\[29\]"  " = 29 '\\\\035'"
     gdb_test "p ctable1\[30\]"  " = 30 '\\\\036'"
@@ -474,11 +477,11 @@ proc test_print_strings {} {
     gdb_test "p &ctable1\[1\]" \
        " = \\(unsigned char \\*\\) \"\\\\001\\\\002\\\\003\\\\004\\\\005\\\\006\\\\a\\\\b\"..."
     gdb_test "p &ctable1\[1*8\]" \
-       " = \\(unsigned char \\*\\) \"\\\\b\\\\t\\\\n\\\\013\\\\f\\\\r\\\\016\\\\017\"..."
+       " = \\(unsigned char \\*\\) \"\\\\b\\\\t\\\\n\\\\v\\\\f\\\\r\\\\016\\\\017\"..."
     gdb_test "p &ctable1\[2*8\]" \
        " = \\(unsigned char \\*\\) \"\\\\020\\\\021\\\\022\\\\023\\\\024\\\\025\\\\026\\\\027\"..."
     gdb_test "p &ctable1\[3*8\]" \
-       " = \\(unsigned char \\*\\) \"\\\\030\\\\031\\\\032\\\\e\\\\034\\\\035\\\\036\\\\037\"..."
+       " = \\(unsigned char \\*\\) \"\\\\030\\\\031\\\\032\\\\033\\\\034\\\\035\\\\036\\\\037\"..."
     gdb_test "p &ctable1\[4*8\]" \
        " = \\(unsigned char \\*\\) \" !\\\\\"#\\\$%&'\"..."
     gdb_test "p &ctable1\[5*8\]" \
@@ -542,13 +545,13 @@ proc test_print_int_arrays {} {
 
     gdb_test "set print elements 24" ""
 
-    gdb_test "p int1dim" \
+    gdb_test_escape_braces "p int1dim" \
        " = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}"
-    gdb_test "p int2dim" \
+    gdb_test_escape_braces "p int2dim" \
        " = {{0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11}}"
-    gdb_test "p int3dim" \
+    gdb_test_escape_braces "p int3dim" \
        " = {{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}"
-    gdb_test "p int4dim" \
+    gdb_test_escape_braces "p int4dim" \
        " = {{{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}}"
 }
 
@@ -557,7 +560,7 @@ proc test_print_typedef_arrays {} {
 
     gdb_test "set print elements 24" ""
 
-    gdb_test "p a1" \
+    gdb_test_escape_braces "p a1" \
        " = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}"
     gdb_test "p a1\[0\]" " = 2"
     gdb_test "p a1\[9\]" " = 20"
@@ -570,11 +573,11 @@ proc test_print_typedef_arrays {} {
 
 proc test_artificial_arrays {} {
     # Send \026@ instead of just @ in case the kill character is @.
-    gdb_test "p int1dim\[0\]\026@2" " = {0, 1}" {p int1dim[0]@2}
-    gdb_test "p int1dim\[0\]\026@2\026@3" \
+    gdb_test_escape_braces "p int1dim\[0\]\026@2" " = {0, 1}" {p int1dim[0]@2}
+    gdb_test_escape_braces "p int1dim\[0\]\026@2\026@3" \
        "({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \
        {p int1dim[0]@2@3}
-    gdb_test {p/x (short [])0x12345678} \
+    gdb_test_escape_braces {p/x (short [])0x12345678} \
        " = ({0x1234, 0x5678}|{0x5678, 0x1234})"
 }
 
@@ -618,25 +621,16 @@ proc test_print_string_constants {} {
     # (Test may involve inferior malloc() calls).
     set timeout 60;
 
-    setup_xfail "a29k-*-udi" 2416
     gdb_test "p \"a string\""          " = \"a string\""
-    setup_xfail "a29k-*-udi" 2416
     gdb_test "p \"embedded \\000 null\"" " = \"embedded \\\\000 null\""
-    setup_xfail "a29k-*-udi" 2416
     gdb_test "p \"abcd\"\[2\]" " = 99 'c'"
-    setup_xfail "a29k-*-udi" 2416
     gdb_test "p sizeof (\"abcdef\")"   " = 7"
-    setup_xfail "a29k-*-udi" 2416
     gdb_test "ptype \"foo\""           " = char \\\[4\\\]"
-    setup_xfail "a29k-*-udi" 2416
     gdb_test "p *\"foo\""              " = 102 'f'"
-    setup_xfail "a29k-*-udi" 2416
     gdb_test "ptype *\"foo\""          " = char"
-    setup_xfail "a29k-*-udi" 2416
     gdb_test "p &*\"foo\""             " = \"foo\""
-    setup_xfail "*-*-*"
+    setup_kfail "gdb/538" *-*-*
     gdb_test "ptype &*\"foo\"" "type = char \\*"
-    setup_xfail "a29k-*-udi" 2416
     gdb_test "p (char *)\"foo\""       " = \"foo\""
 }
 
@@ -652,17 +646,11 @@ proc test_print_array_constants {} {
     # (Test may involve inferior malloc() calls).
     set timeout 60;
 
-    setup_xfail "a29k-*-udi" 2416
     gdb_test "print {'a','b','c'}"     " = \"abc\""
-    setup_xfail "a29k-*-udi" 2416
-    gdb_test "print {0,1,2}"           " = {0, 1, 2}"
-    setup_xfail "a29k-*-udi" 2416
-    gdb_test "print {(long)0,(long)1,(long)2}" " = {0, 1, 2}"
-    setup_xfail "a29k-*-udi" 2416
-    gdb_test "print {{0,1,2},{3,4,5}}"  " = {{0, 1, 2}, {3, 4, 5}}"
-    setup_xfail "a29k-*-udi" 2416
+    gdb_test_escape_braces "print {0,1,2}"    " = {0, 1, 2}"
+    gdb_test_escape_braces "print {(long)0,(long)1,(long)2}"  " = {0, 1, 2}"
+    gdb_test_escape_braces "print {{0,1,2},{3,4,5}}"  " = {{0, 1, 2}, {3, 4, 5}}"
     gdb_test "print {4,5,6}\[2\]"      " = 6"
-    setup_xfail "a29k-*-udi" 2416
     gdb_test "print *&{4,5,6}\[1\]"    " = 5"
 }
 
@@ -680,6 +668,15 @@ proc test_printf {} {
 0xfeedface, 0xdeadbeef, 5.0" "bad -99.54\[0-9\]+, z feedface, deadbeef, 5.0+"
 }
 
+# Escape a left curly brace to prevent it from being interpreted as 
+# the beginning of a bound
+proc gdb_test_escape_braces { args } {
+
+    set pattern [lindex $args 1]
+    regsub -all {\{[0-9]} $pattern {\\&} esc_pattern
+    gdb_test [lindex $args 0] $esc_pattern [lindex $args 2]
+}
+
 # Start with a fresh gdb.
 
 gdb_exit
This page took 0.030477 seconds and 4 git commands to generate.