diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2007-01-26 20:53:15 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2007-01-26 20:53:15 +0000 |
commit | e784b426e6a8bba4407def53f1cc3a318be7abd1 (patch) | |
tree | 12c6aec77f744991cfab1bcee99fd406ff49e66d | |
parent | 9a01813aed1b24da9eaa3616d58d24ce92e0cb23 (diff) | |
download | gdb-e784b426e6a8bba4407def53f1cc3a318be7abd1.zip gdb-e784b426e6a8bba4407def53f1cc3a318be7abd1.tar.gz gdb-e784b426e6a8bba4407def53f1cc3a318be7abd1.tar.bz2 |
* gdb.base/charsign.exp, gdb.base/charsign.c: New files.
* gdb.arch/i386-sse.exp: Check $xmm.v16_int8 printing as a number array.
* gdb.base/printcmds.exp: Sign-provided CHARs now became arrays.
* gdb.base/setvar.exp: Likewise.
-rw-r--r-- | gdb/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.arch/i386-sse.exp | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/charsign.c | 37 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/charsign.exp | 70 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/printcmds.exp | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/setvar.exp | 8 |
6 files changed, 128 insertions, 11 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 2c62345..ec0ae8a 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2007-01-25 Jan Kratochvil <jan.kratochvil@redhat.com> + + * gdb.base/charsign.exp, gdb.base/charsign.c: New files. + * gdb.arch/i386-sse.exp: Check $xmm.v16_int8 printing as a number array. + * gdb.base/printcmds.exp: Sign-provided CHARs now became arrays. + * gdb.base/setvar.exp: Likewise. + 2007-01-26 Andreas Schwab <schwab@suse.de> * gdb.base/corefile.exp: Allow non-empty argument list in reinit diff --git a/gdb/testsuite/gdb.arch/i386-sse.exp b/gdb/testsuite/gdb.arch/i386-sse.exp index e55d53c..d0289cb 100644 --- a/gdb/testsuite/gdb.arch/i386-sse.exp +++ b/gdb/testsuite/gdb.arch/i386-sse.exp @@ -83,7 +83,10 @@ gdb_continue_to_breakpoint "continue to first breakpoint in main" foreach r {0 1 2 3 4 5 6 7} { gdb_test "print \$xmm$r.v4_float" \ ".. = \\{$r, $r.25, $r.5, $r.75\\}.*" \ - "check contents of %xmm$r" + "check float contents of %xmm$r" + gdb_test "print \$xmm$r.v16_int8" \ + ".. = \\{(-?\[0-9\]+ '.*', ){15}-?\[0-9\]+ '.*'\\}.*" \ + "check int8 contents of %xmm$r" } foreach r {0 1 2 3 4 5 6 7} { diff --git a/gdb/testsuite/gdb.base/charsign.c b/gdb/testsuite/gdb.base/charsign.c new file mode 100644 index 0000000..41d175f --- /dev/null +++ b/gdb/testsuite/gdb.base/charsign.c @@ -0,0 +1,37 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2007 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 + (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 */ + +int main() +{ + return 0; +} + +char n[]="A"; +signed char s[]="A"; +unsigned char u[]="A"; + +typedef char char_n; +typedef signed char char_s; +typedef unsigned char char_u; + +char_n n_typed[]="A"; +char_s s_typed[]="A"; +char_u u_typed[]="A"; diff --git a/gdb/testsuite/gdb.base/charsign.exp b/gdb/testsuite/gdb.base/charsign.exp new file mode 100644 index 0000000..7383fd6 --- /dev/null +++ b/gdb/testsuite/gdb.base/charsign.exp @@ -0,0 +1,70 @@ +# Copyright 2007 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 +# (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. + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +set testfile charsign +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +proc do_test { cflags } { + global srcdir + global binfile + global subdir + global srcfile + global gdb_prompt + + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug additional_flags=$cflags]] != "" } { + untested "Couldn't compile test program" + return -1 + } + + # Get things started. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load ${binfile} + + # For C programs, "start" should stop in main(). + + gdb_test "p n" \ + "= \"A\"" + gdb_test "p s" \ + "= \\{65 'A', 0 '\\\\0'\\}" + gdb_test "p u" \ + "= \\{65 'A', 0 '\\\\0'\\}" + gdb_test "p n_typed" \ + "= \"A\"" + gdb_test "p s_typed" \ + "= \\{65 'A', 0 '\\\\0'\\}" + gdb_test "p u_typed" \ + "= \\{65 'A', 0 '\\\\0'\\}" +} + +# The string identification works despite the compiler flags below due to +# gdbtypes.c: +# if (name && strcmp (name, "char") == 0) +# TYPE_FLAGS (type) |= TYPE_FLAG_NOSIGN; + +do_test {} +do_test {-fsigned-char} +do_test {-funsigned-char} diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index 5285836..9961e06 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -590,18 +590,18 @@ proc test_print_char_arrays {} { gdb_test "set print address on" "" gdb_test "p arrays" \ - " = {array1 = \"abc\", array2 = \"d\", array3 = \"e\", array4 = \"fg\", array5 = \"hij\"}" + " = \\{array1 = \\{97 'a', 98 'b', 99 'c', 0 '\\\\0'\\}, array2 = \\{100 'd'\\}, array3 = \\{101 'e'\\}, array4 = \\{102 'f', 103 'g'\\}, array5 = \\{104 'h', 105 'i', 106 'j', 0 '\\\\0'\\}\\}" gdb_test "p parrays" " = \\(struct some_arrays \\*\\) $hex" - gdb_test "p parrays->array1" " = \"abc\"" + gdb_test "p parrays->array1" " = \\{97 'a', 98 'b', 99 'c', 0 '\\\\0'\\}" gdb_test "p &parrays->array1" " = \\(unsigned char \\(\\*\\)\\\[4\\\]\\) $hex" - gdb_test "p parrays->array2" " = \"d\"" + gdb_test "p parrays->array2" " = \\{100 'd'\\}" gdb_test "p &parrays->array2" " = \\(unsigned char \\(\\*\\)\\\[1\\\]\\) $hex" - gdb_test "p parrays->array3" " = \"e\"" + gdb_test "p parrays->array3" " = \\{101 'e'\\}" gdb_test "p &parrays->array3" " = \\(unsigned char \\(\\*\\)\\\[1\\\]\\) $hex" - gdb_test "p parrays->array4" " = \"fg\"" + gdb_test "p parrays->array4" " = \\{102 'f', 103 'g'\\}" gdb_test "p &parrays->array4" " = \\(unsigned char \\(\\*\\)\\\[2\\\]\\) $hex" - gdb_test "p parrays->array5" " = \"hij\"" + gdb_test "p parrays->array5" " = \\{104 'h', 105 'i', 106 'j', 0 '\\\\0'\\}" gdb_test "p &parrays->array5" " = \\(unsigned char \\(\\*\\)\\\[4\\\]\\) $hex" gdb_test "set print address off" "" diff --git a/gdb/testsuite/gdb.base/setvar.exp b/gdb/testsuite/gdb.base/setvar.exp index 0bf5bc5..781c9c3 100644 --- a/gdb/testsuite/gdb.base/setvar.exp +++ b/gdb/testsuite/gdb.base/setvar.exp @@ -233,11 +233,11 @@ test_set "set variable v_char_array\[0\]='h'" "set variable v_char_array\[1\]='i # # test "set variable" for "signed char array[2]" # -test_set "set variable v_signed_char_array\[0\]='h'" "set variable v_signed_char_array\[1\]='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable signed char array=\"hi\" (string)" +test_set "set variable v_signed_char_array\[0\]='h'" "set variable v_signed_char_array\[1\]='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\\{104 'h', 105 'i'\\}" "set variable signed char array=\"hi\" (string)" # # test "set variable" for "unsigned char array[2]" # -test_set "set variable v_unsigned_char_array\[0\]='h'" "set variable v_unsigned_char_array\[1\]='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable unsigned char array=\"hi\" (string)" +test_set "set variable v_unsigned_char_array\[0\]='h'" "set variable v_unsigned_char_array\[1\]='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\\{104 'h', 105 'i'\\}" "set variable unsigned char array=\"hi\" (string)" # # test "set variable" for "short array[2]" # @@ -289,11 +289,11 @@ test_set "set v_char_pointer=v_char_array" "set variable *(v_char_pointer)='h'" # # test "set variable" for type "signed char *" # -test_set "set v_signed_char_pointer=v_signed_char_array" "set variable *(v_signed_char_pointer)='h'" "set variable *(v_signed_char_pointer+1)='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_signed_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable signed char pointer=\"hi\" (string)" +test_set "set v_signed_char_pointer=v_signed_char_array" "set variable *(v_signed_char_pointer)='h'" "set variable *(v_signed_char_pointer+1)='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\\{104 'h', 105 'i'\\}" "print *(v_signed_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable signed char pointer=\"hi\" (string)" # # test "set variable" for type "unsigned char *" # -test_set "set v_unsigned_char_pointer=v_unsigned_char_array" "set variable *(v_unsigned_char_pointer)='h'" "set variable *(v_unsigned_char_pointer+1)='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_unsigned_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable unsigned char pointer=\"hi\" (string)" +test_set "set v_unsigned_char_pointer=v_unsigned_char_array" "set variable *(v_unsigned_char_pointer)='h'" "set variable *(v_unsigned_char_pointer+1)='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\\{104 'h', 105 'i'\\}" "print *(v_unsigned_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable unsigned char pointer=\"hi\" (string)" # # test "set variable" for type "short *" # |