[RFC] Trying to fix testsuite/gdb.arch/i386-sse.exp pattern problem

Pierre Muller
2007-11-07T14:37:57Z

On Cygwin, the i386-sse test always gives me 8 failures
on the int8 array values.
Are these failure also visible on i386 linux machines?
I suppose so, but couldn't test it.

It took me a long time to understand the complicated
regular expression used, but in the end, I suspect that
this regexpr is not adequate.

The current test is:
gdb_test "print \$xmm$r.v16_int8" \
".. = \\{(-?\[0-9\]+, ){15}-?\[0-9\]+\\}.*" \
"check int8 contents of %xmm$r"

But I suspect that the {15} refers to the expanded pattern,
which would mean that it would match a
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
while the patterns are different (some elements are non-zero).

I could not check this directly as
gdb return {0 <repeats 16 times>} if you set all 4 v4_float elements to
zero.

I tried to check v8_int16 instead, but still got no luck...
Using -v 5 times, I found out that gdb_test added a group start '('
character
before the pattern and a group end ')' after the pattern,
but even adding closing and opening groups still would not
make the test pass...

gdb_test "set var \$xmm0.v4_float\[0\] = 0" "" "set %xmm0"
gdb_test "set var \$xmm0.v4_float\[1\] = 0" "" "set %xmm0"
gdb_test "set var \$xmm0.v4_float\[2\] = 0" "" "set %xmm0"
gdb_test "set var \$xmm0.v4_float\[3\] = 0" "" "set %xmm0"
gdb_test "print \$xmm0.v8_int16" \
".* =) \\{(-?\[0-9\]+, ){7}(-?\[0-9\]+\\}.*" \
"check zeroed int8 contents of %xmm0"
Still fails, even though the result is {0, 0, 0, 0, 0, 0, 0, 0}.

Even this simple test fails:

gdb_test "print {0, 0, 0, 0}" ".* =) \\{(0, ){3}(0\\}.*" "test array"

I am really wondering if this pattern repetition
is working at all...

Installed tcl is version 8.4

I could correct the test, by putting explicitly the
16 patterns, which results in an horribly lengthy pattern,
but I was unable to break it into pieces to have shorter source lines.

Any ideas on ways to split the pattern string sent to gdb_test
over multiple lines are most welcomed.

Pierre Muller

ChangeLog entry:

2007-11-07 Pierre Muller <muller@ics.u-strasbg.fr>

* gdb.arch/i386-see.exp: Correct pattern to check v16_int8 array of
SSE registers.

Index: i386-sse.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/i386-sse.exp,v
retrieving revision 1.8
diff -u -p -r1.8 i386-sse.exp
--- i386-sse.exp 5 Sep 2007 00:51:49 -0000 1.8
+++ i386-sse.exp 7 Nov 2007 13:48:37 -0000
@@ -84,7 +84,7 @@ foreach r {0 1 2 3 4 5 6 7} {
".. = \\{$r, $r.25, $r.5, $r.75\\}.*" \
"check float contents of %xmm$r"
gdb_test "print \$xmm$r.v16_int8" \
- ".. = \\{(-?\[0-9\]+, ){15}-?\[0-9\]+\\}.*" \
+ ".. = \\{-?\[0-9\]+, -?\[0-9\]+, -?\[0-9\]+, -?\[0-9\]+,
-?\[0-9\]+, -?\[0-9\]+, -?\[0-9\]+, -?\[0-9\]+, -?\[0-9\]+,-?\[0-9\]+,
-?\[0-9\]+, -?\[0-9\]+, -?\[0-9\]+, -?\[0-9\]+, -?\[0-9\]+, -?\[0-9\]+\\}.*"
\
"check int8 contents of %xmm$r"
}