| OLD | NEW |
| 1 # This testcase is part of GDB, the GNU debugger. | 1 # This testcase is part of GDB, the GNU debugger. |
| 2 | 2 |
| 3 # Copyright 2001, 2004, 2007-2012 Free Software Foundation, Inc. | 3 # Copyright 2001, 2004, 2007-2012 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 # This program is free software; you can redistribute it and/or modify | 5 # This program is free software; you can redistribute it and/or modify |
| 6 # it under the terms of the GNU General Public License as published by | 6 # it under the terms of the GNU General Public License as published by |
| 7 # the Free Software Foundation; either version 3 of the License, or | 7 # the Free Software Foundation; either version 3 of the License, or |
| 8 # (at your option) any later version. | 8 # (at your option) any later version. |
| 9 # | 9 # |
| 10 # This program is distributed in the hope that it will be useful, | 10 # This program is distributed in the hope that it will be useful, |
| 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 # GNU General Public License for more details. | 13 # GNU General Public License for more details. |
| 14 # | 14 # |
| 15 # You should have received a copy of the GNU General Public License | 15 # You should have received a copy of the GNU General Public License |
| 16 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | 17 |
| 18 # Please email any bugs, comments, and/or additions to this file to: | 18 # Please email any bugs, comments, and/or additions to this file to: |
| 19 # bug-gdb@gnu.org | 19 # bug-gdb@gnu.org |
| 20 | 20 |
| 21 # Test GDB's character set support. | 21 # Test GDB's character set support. |
| 22 | 22 |
| 23 if $tracelevel then { | |
| 24 strace $tracelevel | |
| 25 } | |
| 26 | |
| 27 | 23 |
| 28 set testfile "charset" | 24 set testfile "charset" |
| 29 set srcfile ${testfile}.c | 25 set srcfile ${testfile}.c |
| 30 set srcmallocfile ${testfile}-malloc.c | 26 set srcmallocfile ${testfile}-malloc.c |
| 31 if { [prepare_for_testing ${testfile}.exp ${testfile} [list $srcfile $srcmallocf
ile]] } { | 27 if { [prepare_for_testing ${testfile}.exp ${testfile} [list $srcfile $srcmallocf
ile]] } { |
| 32 return -1 | 28 return -1 |
| 33 } | 29 } |
| 34 | 30 |
| 35 # Parse the output from a `show charset' command. Return the host | 31 # Parse the output from a `show charset' command. Return the host |
| 36 # and target charset as a two-element list. | 32 # and target charset as a two-element list. |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 } | 597 } |
| 602 | 598 |
| 603 # Regression test for a cleanup bug in the charset code. | 599 # Regression test for a cleanup bug in the charset code. |
| 604 gdb_test "print 'a' == 'a' || 'b' == 'b'" \ | 600 gdb_test "print 'a' == 'a' || 'b' == 'b'" \ |
| 605 ".* = 1" \ | 601 ".* = 1" \ |
| 606 "EVAL_SKIP cleanup handling regression test" | 602 "EVAL_SKIP cleanup handling regression test" |
| 607 | 603 |
| 608 | 604 |
| 609 proc string_display { var_name set_prefix x_size x_type} { | 605 proc string_display { var_name set_prefix x_size x_type} { |
| 610 gdb_test_no_output "set ${var_name} = ${set_prefix}\"Test String\\0with zeroes
\"" "Assign ${var_name} with prefix ${set_prefix}" | 606 gdb_test_no_output "set ${var_name} = ${set_prefix}\"Test String\\0with zeroes
\"" "Assign ${var_name} with prefix ${set_prefix}" |
| 611 gdb_test "x /2${x_size}s ${var_name}" ".* ${x_type}\"Test String\"\[\r\n\]+.*
${x_type}\"with zeroes\"" "Display String ${var_name} with x/${x_size}s" | 607 gdb_test "x /2${x_size}s ${var_name}" ".*\t${x_type}\"Test String\"\[\r\n\]+.*
\t${x_type}\"with zeroes\"" "Display String ${var_name} with x/${x_size}s" |
| 612 } | 608 } |
| 613 | 609 |
| 614 if {$ucs2_ok} { | 610 if {$ucs2_ok} { |
| 615 string_display String16 u h u | 611 string_display String16 u h u |
| 616 if {$wchar_size == 2} { | 612 if {$wchar_size == 2} { |
| 617 string_display String16 L h u | 613 string_display String16 L h u |
| 618 } | 614 } |
| 619 } | 615 } |
| 620 | 616 |
| 621 string_display String32 U w U | 617 string_display String32 U w U |
| 622 if {$wchar_size == 4} { | 618 if {$wchar_size == 4} { |
| 623 string_display String32 L w U | 619 string_display String32 L w U |
| 624 } | 620 } |
| 625 | 621 |
| 626 | 622 |
| 627 foreach name {short int long} { | 623 foreach name {short int long} { |
| 628 # We're really just checking to make sure this doesn't give an | 624 # We're really just checking to make sure this doesn't give an |
| 629 # error. | 625 # error. |
| 630 gdb_test "print ${name}_array = \"hi\"" \ | 626 gdb_test "print ${name}_array = \"hi\"" \ |
| 631 " = {.*}" \ | 627 " = {.*}" \ |
| 632 "assign string to $name array" | 628 "assign string to $name array" |
| 633 } | 629 } |
| 634 | 630 |
| 635 | 631 |
| 636 gdb_exit | 632 gdb_exit |
| OLD | NEW |