diff options
author | nobody <> | 2011-01-14 19:33:38 +0000 |
---|---|---|
committer | nobody <> | 2011-01-14 19:33:38 +0000 |
commit | e499f3729a307f20caf5b480d4394a1266230fb6 (patch) | |
tree | ad3ac12ac8bb5ec1b9c550000922c739348edbfa | |
parent | 14f45d60e0d5c2500da0ae8ed544768cfb8031ec (diff) | |
download | gdb-e499f3729a307f20caf5b480d4394a1266230fb6.zip gdb-e499f3729a307f20caf5b480d4394a1266230fb6.tar.gz gdb-e499f3729a307f20caf5b480d4394a1266230fb6.tar.bz2 |
This commit was manufactured by cvs2svn to create branch 'gdb_7_2-branch'.
Cherrypick from master 2011-01-14 19:33:37 UTC Joel Brobecker <brobecker@gnat.com> 'new testcase printing wchar_t characters and strings':
gdb/testsuite/gdb.ada/widewide.exp
gdb/testsuite/gdb.ada/widewide/foo.adb
gdb/testsuite/gdb.ada/widewide/pck.adb
gdb/testsuite/gdb.ada/widewide/pck.ads
gdb/testsuite/gdb.base/wchar.c
gdb/testsuite/gdb.base/wchar.exp
-rw-r--r-- | gdb/testsuite/gdb.ada/widewide.exp | 47 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/widewide/foo.adb | 27 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/widewide/pck.adb | 23 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/widewide/pck.ads | 22 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/wchar.c | 40 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/wchar.exp | 38 |
6 files changed, 197 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.ada/widewide.exp b/gdb/testsuite/gdb.ada/widewide.exp new file mode 100644 index 0000000..83b6d74 --- /dev/null +++ b/gdb/testsuite/gdb.ada/widewide.exp @@ -0,0 +1,47 @@ +# Copyright 2011 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 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, see <http://www.gnu.org/licenses/>. + +load_lib "ada.exp" + +set testdir "widewide" +set testfile "${testdir}/foo" +set srcfile ${srcdir}/${subdir}/${testfile}.adb +set binfile ${objdir}/${subdir}/${testfile} + +file mkdir ${objdir}/${subdir}/${testdir} +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } { + return -1 +} + +clean_restart ${testfile} + +set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb] +if ![runto "foo.adb:$bp_location" ] then { + perror "Couldn't run ${testfile}" + return +} + +gdb_test "print some_easy" "= 74 'J'" + +gdb_test "print some_larger" "= 48879 '\\\[\"0000beef\"\\\]'" + +gdb_test "print some_big" "= 14335727 '\\\[\"00dabeef\"\\\]'" + +gdb_test "print my_wws" "= \" helo\"" + +gdb_test "print my_wws(1)" "= 32 ' '" + +gdb_test "print my_wws(2)" "= 104 'h'" + diff --git a/gdb/testsuite/gdb.ada/widewide/foo.adb b/gdb/testsuite/gdb.ada/widewide/foo.adb new file mode 100644 index 0000000..056f1f0 --- /dev/null +++ b/gdb/testsuite/gdb.ada/widewide/foo.adb @@ -0,0 +1,27 @@ +-- Copyright 2011 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 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, see <http://www.gnu.org/licenses/>. + +with Pck; use Pck; + +procedure Foo is + Some_Easy : Wide_Wide_Character := 'J'; + Some_Larger : Wide_Wide_Character := Wide_Wide_Character'Val(16#beef#); + Some_Big : Wide_Wide_Character := Wide_Wide_Character'Val(16#00dabeef#); + My_WWS : Wide_Wide_String := " helo"; +begin + Do_Nothing (Some_Easy'Address); -- START + Do_Nothing (Some_Larger'Address); + Do_Nothing (Some_Big'Address); +end Foo; diff --git a/gdb/testsuite/gdb.ada/widewide/pck.adb b/gdb/testsuite/gdb.ada/widewide/pck.adb new file mode 100644 index 0000000..a9c836b --- /dev/null +++ b/gdb/testsuite/gdb.ada/widewide/pck.adb @@ -0,0 +1,23 @@ +-- Copyright 2011 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 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, see <http://www.gnu.org/licenses/>. + +package body Pck is + + procedure Do_Nothing (A : System.Address) is + begin + null; + end Do_Nothing; + +end Pck; diff --git a/gdb/testsuite/gdb.ada/widewide/pck.ads b/gdb/testsuite/gdb.ada/widewide/pck.ads new file mode 100644 index 0000000..c48415a --- /dev/null +++ b/gdb/testsuite/gdb.ada/widewide/pck.ads @@ -0,0 +1,22 @@ +-- Copyright 2011 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 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, see <http://www.gnu.org/licenses/>. + +with System; + +package Pck is + + procedure Do_Nothing (A : System.Address); + +end Pck; diff --git a/gdb/testsuite/gdb.base/wchar.c b/gdb/testsuite/gdb.base/wchar.c new file mode 100644 index 0000000..9eaf766 --- /dev/null +++ b/gdb/testsuite/gdb.base/wchar.c @@ -0,0 +1,40 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2011 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 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, see <http://www.gnu.org/licenses/>. */ + +#include <wchar.h> + +void +do_nothing (wchar_t *c) +{ +} + +int +main (void) +{ + wchar_t narrow = 97; + wchar_t single = 0xbeef; + wchar_t simple[] = L"facile"; + wchar_t difficile[] = { 0xdead, 0xbeef, 0xfeed, 0xface}; + wchar_t mixed[] = {L'f', 0xdead, L'a', L'c', 0xfeed, 0xface}; + + do_nothing (&narrow); /* START */ + do_nothing (&single); + do_nothing (simple); + do_nothing (difficile); + do_nothing (mixed); +} + diff --git a/gdb/testsuite/gdb.base/wchar.exp b/gdb/testsuite/gdb.base/wchar.exp new file mode 100644 index 0000000..f3e09f2c --- /dev/null +++ b/gdb/testsuite/gdb.base/wchar.exp @@ -0,0 +1,38 @@ +# Copyright 2011 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 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, see <http://www.gnu.org/licenses/>. + +set testfile wchar +set srcfile ${testfile}.c +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { + return -1 +} + +set bp_location [gdb_get_line_number "START"] +if ![runto "wchar.c:$bp_location" ] then { + return -1 +} + +gdb_test "print narrow" "= 97 L'a'" + +gdb_test "print single" "= 48879 L'\\\\xbeef'" + +gdb_test "print simple" "= L\"facile\"" + +gdb_test "print difficile" "= L\"\\\\xdead\\\\xbeef\\\\xfeed\\\\xface\"" + +gdb_test "print simple\[2\]" "= 99 L'c'" + +gdb_test "print difficile\[2\]" "= 65261 L'\\\\xfeed'" + |