This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] printcmds.exp: escape curly braces in array print pattern match


Orjan Friberg wrote:
> 
> The following patch fixes a problem with matching output from printing
> arrays in printcmds.exp. A left curly brace '{' followed by a number
> must be escaped, to avoid it being interpreted as the beginning of a
> bound. I escape it with \\. A right curly brace '}' does not seem to
> have any special meaning unless preceded by '{', but for consistency I
> escaped those as well (to indicate that it's not part of a bound).
> However, it does clutter the exp-file, so it might not be the best way
> to do it. I'm awaiting comments before submitting the corresponding
> patch for setvar.exp.

Verified that it does not cause any additional fails on Solaris.
I would recommend accepting the patch (though I don't know if 
there is a preferable way of doing it).

Stan?  Fernando?

> On a native gdb, i686-pc-linux-gnu, before the patch:
> 
> # of expected passes            658
> # of expected failures          1
> # of unresolved testcases       11
> 
> After the patch:
> 
> # of expected passes            669
> # of expected failures          1
> 
> 2000-09-29  Orjan Friberg  <orjanf@axis.com>
> 
>         * gdb.base/printcmds.exp: Escaped curly braces in array print pattern
> match.
> 
> -- ***
> /home/orjanf/gdb-5.0-latest/src/gdb/testsuite/gdb.base/printcmds.exp
> Tue Mar 14 18:01:05 2000
> --- printcmds.exp       Fri Sep 29 10:19:19 2000
> *************** proc test_print_int_arrays {} {
> *** 543,555 ****
>       gdb_test "set print elements 24" ""
> 
>       gdb_test "p int1dim" \
> !       " = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}"
>       gdb_test "p int2dim" \
> !       " = {{0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11}}"
>       gdb_test "p int3dim" \
> !       " = {{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}"
>       gdb_test "p int4dim" \
> !       " = {{{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}}"
>   }
> 
>   proc test_print_typedef_arrays {} {
> --- 543,555 ----
>       gdb_test "set print elements 24" ""
> 
>       gdb_test "p int1dim" \
> !       " = \\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11\\}"
>       gdb_test "p int2dim" \
> !       " = \\{\\{0, 1, 2, 3\\}, \\{4, 5, 6, 7\\}, \\{8, 9, 10,
> 11\\}\\}"
>       gdb_test "p int3dim" \
> !       " = \\{\\{\\{0, 1\\}, \\{2, 3\\}, \\{4, 5\\}\\}, \\{\\{6, 7\\},
> \\{8, 9\
> \}, \\{10, 11\\}\\}\\}"
>       gdb_test "p int4dim" \
> !       " = \\{\\{\\{\\{0, 1\\}, \\{2, 3\\}, \\{4, 5\\}\\}, \\{\\{6,
> 7\\}, \\{8,
>  9\\}, \\{10, 11\\}\\}\\}\\}"
>   }
> 
>   proc test_print_typedef_arrays {} {
> *************** proc test_print_typedef_arrays {} {
> *** 558,564 ****
>       gdb_test "set print elements 24" ""
> 
>       gdb_test "p a1" \
> !       " = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}"
>       gdb_test "p a1\[0\]" " = 2"
>       gdb_test "p a1\[9\]" " = 20"
> 
> --- 558,564 ----
>       gdb_test "set print elements 24" ""
> 
>       gdb_test "p a1" \
> !       " = \\{2, 4, 6, 8, 10, 12, 14, 16, 18, 20\\}"
>       gdb_test "p a1\[0\]" " = 2"
>       gdb_test "p a1\[9\]" " = 20"
> 
> *************** proc test_print_typedef_arrays {} {
> *** 570,581 ****
> 
>   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" \
> !       "({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \
>         {p int1dim[0]@2@3}
>       gdb_test {p/x (short [])0x12345678} \
> !       " = ({0x1234, 0x5678}|{0x5678, 0x1234})"
>   }
> 
>   proc test_print_char_arrays {} {
> --- 570,581 ----
> 
>   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" \
> !       "(\\{\\{0, 1\\}, \\{2, 3\\}, \\{4, 5\\}\\}|\[Cc\]annot.*)" \
>         {p int1dim[0]@2@3}
>       gdb_test {p/x (short [])0x12345678} \
> !       " = \\{0x1234, 0x5678\\}|\\{0x5678, 0x1234\\}"
>   }
> 
>   proc test_print_char_arrays {} {
> *************** proc test_print_array_constants {} {
> *** 655,665 ****
>       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 "print {4,5,6}\[2\]"     " = 6"
>       setup_xfail "a29k-*-udi" 2416
> --- 655,665 ----
>       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 "print {4,5,6}\[2\]"     " = 6"
>       setup_xfail "a29k-*-udi" 2416
> 
> --
> Orjan Friberg              E-mail: orjan.friberg@axis.com
> Axis Communications AB     Phone:  +46 46 272 17 68

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]