aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2009-03-20 23:04:40 +0000
committerTom Tromey <tromey@redhat.com>2009-03-20 23:04:40 +0000
commit6c7a06a3facfa3f71606655871d0617d3cad80d9 (patch)
tree34aa9f54c4d9d5748c654b09f2992a92e217f6cd /gdb/testsuite
parentcb249c71f6bfb565578d4258eaab9144a45716fe (diff)
downloadgdb-6c7a06a3facfa3f71606655871d0617d3cad80d9.zip
gdb-6c7a06a3facfa3f71606655871d0617d3cad80d9.tar.gz
gdb-6c7a06a3facfa3f71606655871d0617d3cad80d9.tar.bz2
gdb:
2009-03-19 Tom Tromey <tromey@redhat.com> Julian Brown <julian@codesourcery.com> PR i18n/7220, PR i18n/7821, PR exp/8815, PR exp/9103, PR i18n/9401, PR exp/9613: * NEWS: Update * value.h (value_typed_string): Declare. (val_print_string): Update. * valprint.h (print_char_chars): Update. * valprint.c (print_char_chars): Add type argument. Update. (val_print_string): Likewise. * valops.c (value_typed_string): New function. * utils.c (host_char_to_target): New function. (parse_escape): Use host_char_to_target, host_hex_value. Update. Remove '^' case. (no_control_char_error): Remove. * typeprint.c (print_type_scalar): Update. * scm-valprint.c (scm_scmval_print): Update. * scm-lang.h (scm_printchar, scm_printstr): Update. * scm-lang.c (scm_printchar): Add type argument. (scm_printstr): Likewise. * printcmd.c (print_formatted): Update. (print_scalar_formatted): Update. (printf_command) <wide_string_arg, wide_char_arg>: New constants. Handle '%lc' and '%ls'. * parser-defs.h (struct typed_stoken): New type. (struct stoken_vector): Likewise. (write_exp_string_vector): Declare. * parse.c (write_exp_string_vector): New function. * p-valprint.c (pascal_val_print): Update. * p-lang.h (is_pascal_string_type, pascal_printchar, pascal_printstr): Update. * p-lang.c (is_pascal_string_type): Remove 'char_size' argument. Add 'char_type' argument. (pascal_emit_char): Add type argument. (pascal_printchar): Likewise. (pascal_printstr): Likewise. * objc-lang.c (objc_emit_char): Add type argument. (objc_printchar): Likewise. (objc_printstr): Likewise. * macroexp.c (get_character_constant): Handle unicode characters. Use c_parse_escape. (get_string_literal): Handle unicode strings. Use c_parse_escape. * m2-valprint.c (print_unpacked_pointer): Update. (m2_print_array_contents): Update. (m2_val_print): Update. * m2-lang.c (m2_emit_char): Add type argument. (m2_printchar): Likewise. (m2_printstr): Likewise. * language.h (struct language_defn) <la_printchar>: Add type argument. <la_printstr, la_emitchar>: Likewise. (LA_PRINT_CHAR): Likewise. (LA_PRINT_STRING): Likewise. (LA_EMIT_CHAR): Likewise. * language.c (unk_lang_emit_char): Add type argument. (unk_lang_printchar): Likewise. (unk_lang_printstr): Likewise. * jv-valprint.c (java_val_print): Update. * jv-lang.c (java_emit_char): Add type argument. * f-valprint.c (f_val_print): Update. * f-lang.c (f_emit_char): Add type argument. (f_printchar): Likewise. (f_printstr): Likewise. * expprint.c (print_subexp_standard): Update. * charset.h (target_wide_charset): Declare. (c_target_char_has_backslash_escape, c_parse_backslash, host_char_print_literally, host_char_to_target, target_char_to_host, target_char_to_control_char): Remove. (enum transliterations): New type. (convert_between_encodings): Declare. (HOST_ESCAPE_CHAR): New define. (host_letter_to_control_character, host_hex_value): Declare. (enum wchar_iterate_result): New enum. (struct wchar_iterator): Declare. (make_wchar_iterator, make_cleanup_wchar_iterator, wchar_iterator, wchar_push_back): Declare. * charset-list.h: New file. * c-valprint.c (textual_name): New function. (textual_element_type): Handle wide character types. (c_val_print): Pass original type to textual_element_type. Handle wide character types. (c_value_print): Use textual_element_type. Pass original type of value to val_print. * c-lang.h (enum c_string_type): New type. (c_printchar, c_printstr): Update. * c-lang.c (classify_type): New function. (print_wchar): Likewise. (c_emit_char): Add type argument. Handle wide characters. (c_printchar): Likewise. (c_printstr): Add type argument. Handle wide and multibyte character sets. (convert_ucn): New function. (emit_numeric_character): Likewise. (convert_octal): Likewise. (convert_hex): Likewise. (ADVANCE): New macro. (convert_escape): New function. (parse_one_string): Likewise. (evaluate_subexp_c): Likewise. (exp_descriptor_c): New global. (c_language_defn): Use exp_descriptor_c. (cplus_language_defn): Likewise. (asm_language_defn): Likewise. (minimal_language_defn): Likewise. (charset_for_string_type): New function. * c-exp.y (%union): Add 'svec' and 'tsval'. (CHAR): New token. (exp): Add CHAR production. (string_exp): Rewrite. (exp) <string_exp>: Rewrite. (tempbuf): Now global. (tempbuf_init): New global. (parse_string_or_char): New function. (yylex) <tempbuf>: Now global. <tokptr, tempbufindex, tempbufsize, token_string, class_prefix>: Remove. Handle 'u', 'U', and 'L' prefixes. Call parse_string_or_char. (c_parse_escape): New function. * auxv.c (fprint_target_auxv): Update. * ada-valprint.c (ada_emit_char): Add type argument. (ada_printchar): Likewise. (ada_print_scalar): Update. (printstr): Add type argument. Update calls to ada_emit_char. (ada_printstr): Add type argument. (ada_val_print_array): Update. (ada_val_print_1): Likewise. * ada-lang.c (emit_char): Add type argument. * ada-lang.h (ada_emit_char, ada_printchar, ada_printstr): Add type arguments. * gdb_locale.h: Include langinfo.h. * charset.c (_initialize_charset): Set default host charset from the locale. Don't register charsets. Add target-wide-charset commands. Call find_charset_names. (struct charset, struct translation): Remove. (GDB_DEFAULT_HOST_CHARSET): Remove. (GDB_DEFAULT_TARGET_WIDE_CHARSET): New define. (target_wide_charset_name): New global. (show_host_charset_name): Handle "auto". (show_target_wide_charset_name): New function. (host_charset_enum, target_charset_enum): Remove. (charset_enum): New global. (all_charsets, register_charset, lookup_charset, all_translations, register_translation, lookup_translation): Remove. (simple_charset, ascii_print_literally, ascii_to_control): Remove. (iso_8859_print_literally, iso_8859_to_control, iso_8859_family_charset): Remove. (ebcdic_print_literally, ebcdic_to_control, ebcdic_family_charset): Remove. (struct cached_iconv, check_iconv_cache, cached_iconv_convert, register_iconv_charsets): Remove. (target_wide_charset_be_name, target_wide_charset_le_name): New globals. (identity_either_char_to_other): Remove. (set_be_le_names, validate): New functions. (backslashable, backslashed, represented): Remove. (default_c_target_char_has_backslash_escape): Remove. (default_c_parse_backslash, iconv_convert): Remove. (ascii_to_iso_8859_1_table, ascii_to_ebcdic_us_table, ascii_to_ibm1047_table, iso_8859_1_to_ascii_table, iso_8859_1_to_ebcdic_us_table, iso_8859_1_to_ibm1047_table, ebcdic_us_to_ascii_table, ebcdic_us_to_iso_8859_1_table, ebcdic_us_to_ibm1047_table, ibm1047_to_ascii_table, ibm1047_to_iso_8859_1_table, ibm1047_to_ebcdic_us_table): Remove. (table_convert_char, table_translation, simple_table_translation): Remove. (current_host_charset, current_target_charset, c_target_char_has_backslash_escape_func, c_target_char_has_backslash_escape_baton): Remove. (c_parse_backslash_func, c_parse_backslash_baton): Remove. (host_char_to_target_func, host_char_to_target_baton): Remove. (target_char_to_host_func, target_char_to_host_baton): Remove. (cached_iconv_host_to_target, cached_iconv_target_to_host): Remove. (lookup_charset_or_error, check_valid_host_charset): Remove. (set_host_and_target_charsets): Remove. (set_host_charset, set_target_charset): Remove. (set_host_charset_sfunc, set_target_charset_sfunc): Rewrite. (set_target_wide_charset_sfunc): New function. (show_charset): Print target wide character set. (host_charset, target_charset): Rewrite. (target_wide_charset): New function. (c_target_char_has_backslash_escape): Remove. (c_parse_backslash): Remove. (host_letter_to_control_character): New function. (host_char_print_literally): Remove. (host_hex_value): New function. (target_char_to_control_char): Remove. (cleanup_iconv): New function. (convert_between_encodings): New function. (target_char_to_host): Remove. (struct wchar_iterator): Define. (make_wchar_iterator, make_cleanup_wchar_iterator, wchar_iterator, wchar_push_back): New functions. (do_cleanup_iterator): New function. (char_ptr): New typedef. (charsets): New global. (add_one, find_charset_names): New functions. (default_charset_names): New global. (auto_host_charset_name): Likewise. * aclocal.m4, config.in, configure: Rebuild. * configure.ac: Call AM_LANGINFO_CODESET. (GDB_DEFAULT_HOST_CHARSET): Default to UTF-8. (AM_ICONV): Invoke earlier. * acinclude.m4: Include codeset.m4. Subst LIBICONV_INCLUDE and LIBICONV_LIBDIR. Check for libiconv in build tree. * Makefile.in (LIBICONV_LIBDIR, LIBICONV_INCLUDE): New macros. (INTERNAL_CFLAGS_BASE): Add LIBICONV_INCLUDE. (INTERNAL_LDFLAGS): Add LIBICONV_LIBDIR. * gdb_obstack.h (obstack_grow_wstr): New define. * gdb_wchar.h: New file. * defs.h: Include it. gdb/testsuite: * gdb.base/store.exp: Update for change to escape output. * gdb.base/callfuncs.exp (fetch_all_registers): Update for change to escape output. * gdb.base/pointers.exp: Update for change to escape output. * gdb.base/long_long.exp (gdb_test_long_long): Update for change to escape output. * gdb.base/constvars.exp (do_constvar_tests): Update for change to escape output. * gdb.base/call-rt-st.exp (print_struct_call): Update for change to escape output. * gdb.cp/ref-types.exp (gdb_start_again): Update for change to escape output. * gdb.base/setvar.exp: Update for change to escape output. * lib/gdb.exp (default_gdb_start): Set LC_CTYPE to C. * gdb.base/printcmds.exp (test_print_all_chars): Update for change to escape output. (test_print_string_constants): Likewise. * gdb.base/charset.exp (valid_host_charset): Check size of wchar_t. Handle UCS-2 and UCS-4. Add tests for wide and unicode cases. Handle "auto"-related output. * gdb.base/charset.c (char16_t, char32_t): New typedefs. (uvar, Uvar): New globals. gdb/doc: * gdb.texinfo (Character Sets): Remove obsolete text. Document set target-wide-charset. (Requirements): Mention iconv.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog25
-rw-r--r--gdb/testsuite/gdb.base/call-rt-st.exp2
-rw-r--r--gdb/testsuite/gdb.base/callfuncs.exp2
-rw-r--r--gdb/testsuite/gdb.base/charset.c39
-rw-r--r--gdb/testsuite/gdb.base/charset.exp214
-rw-r--r--gdb/testsuite/gdb.base/constvars.exp6
-rw-r--r--gdb/testsuite/gdb.base/long_long.exp10
-rw-r--r--gdb/testsuite/gdb.base/pointers.exp2
-rw-r--r--gdb/testsuite/gdb.base/printcmds.exp58
-rw-r--r--gdb/testsuite/gdb.base/setvar.exp6
-rw-r--r--gdb/testsuite/gdb.base/store.exp4
-rw-r--r--gdb/testsuite/gdb.cp/ref-types.exp4
-rw-r--r--gdb/testsuite/lib/gdb.exp3
13 files changed, 236 insertions, 139 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index a409c4d..a2eddf1 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,28 @@
+2009-03-20 Tom Tromey <tromey@redhat.com>
+
+ * gdb.base/store.exp: Update for change to escape output.
+ * gdb.base/callfuncs.exp (fetch_all_registers): Update for change
+ to escape output.
+ * gdb.base/pointers.exp: Update for change to escape output.
+ * gdb.base/long_long.exp (gdb_test_long_long): Update for change
+ to escape output.
+ * gdb.base/constvars.exp (do_constvar_tests): Update for change to
+ escape output.
+ * gdb.base/call-rt-st.exp (print_struct_call): Update for change
+ to escape output.
+ * gdb.cp/ref-types.exp (gdb_start_again): Update for change to
+ escape output.
+ * gdb.base/setvar.exp: Update for change to escape output.
+ * lib/gdb.exp (default_gdb_start): Set LC_CTYPE to C.
+ * gdb.base/printcmds.exp (test_print_all_chars): Update for change
+ to escape output.
+ (test_print_string_constants): Likewise.
+ * gdb.base/charset.exp (valid_host_charset): Check size of
+ wchar_t. Handle UCS-2 and UCS-4. Add tests for wide and unicode
+ cases. Handle "auto"-related output.
+ * gdb.base/charset.c (char16_t, char32_t): New typedefs.
+ (uvar, Uvar): New globals.
+
2009-03-19 Jerome Guitton <guitton@adacore.com>
* gdb.ada/fixed_points/fixed_points.adb: Add a test on overprecise
diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp
index 3359c70..f73dd7f 100644
--- a/gdb/testsuite/gdb.base/call-rt-st.exp
+++ b/gdb/testsuite/gdb.base/call-rt-st.exp
@@ -186,7 +186,7 @@ if {![gdb_skip_float_test "print print_two_floats(*f3)"] && \
if ![gdb_skip_stdio_test "print print_bit_flags_char(*cflags)"] {
print_struct_call "print_bit_flags_char(*cflags)" \
- ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1 '\\\\001', beta = 0 '\\\\0', gamma = 1 '\\\\001', delta = 0 '\\\\0', epsilon = 1 '\\\\001', omega = 0 '\\\\0'\\}"
+ ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1 '\\\\1', beta = 0 '\\\\0', gamma = 1 '\\\\1', delta = 0 '\\\\0', epsilon = 1 '\\\\1', omega = 0 '\\\\0'\\}"
}
if ![gdb_skip_stdio_test "print print_bit_flags_short(*sflags)"] {
diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp
index 6d8aa45..be6a872 100644
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -437,7 +437,7 @@ gdb_test "print t_small_values(1,3,5,7,9,11,13,15,17,19)" \
"The program being debugged stopped while.*" \
"stop at nested call level 4"
gdb_test "backtrace" \
- "\#0 t_small_values \\(arg1=1 '.001', arg2=3, arg3=5, arg4=7 '.a', arg5=9, arg6=11 '.v', arg7=13, arg8=15, arg9=17, arg10=19\\).*\#2 sum10 \\(i0=2, i1=4, i2=6, i3=8, i4=10, i5=12, i6=14, i7=16, i8=18, i9=20\\).*\#3 <function called from gdb>.*\#4 add \\(a=4, b=5\\).*\#5 <function called from gdb>.*\#6 add \\(a=2, b=3\\).*\#7 <function called from gdb>.*\#8 main.*" \
+ "\#0 t_small_values \\(arg1=1 '.1', arg2=3, arg3=5, arg4=7 '.a', arg5=9, arg6=11 '.v', arg7=13, arg8=15, arg9=17, arg10=19\\).*\#2 sum10 \\(i0=2, i1=4, i2=6, i3=8, i4=10, i5=12, i6=14, i7=16, i8=18, i9=20\\).*\#3 <function called from gdb>.*\#4 add \\(a=4, b=5\\).*\#5 <function called from gdb>.*\#6 add \\(a=2, b=3\\).*\#7 <function called from gdb>.*\#8 main.*" \
"backtrace at nested call level 4"
gdb_test "finish" "Value returned is .* = 100" \
"Finish from nested call level 4"
diff --git a/gdb/testsuite/gdb.base/charset.c b/gdb/testsuite/gdb.base/charset.c
index b640702..55a50ce 100644
--- a/gdb/testsuite/gdb.base/charset.c
+++ b/gdb/testsuite/gdb.base/charset.c
@@ -20,11 +20,6 @@
Please email any bugs, comments, and/or additions to this file to:
bug-gdb@gnu.org */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
/* X_string is a null-terminated string in the X charset whose
elements are as follows. X should be the name the `set charset'
command uses for the character set, in lower-case, with any
@@ -54,6 +49,21 @@ char iso_8859_1_string[NUM_CHARS];
char ebcdic_us_string[NUM_CHARS];
char ibm1047_string[NUM_CHARS];
+/* We make a phony wchar_t and then pretend that this platform uses
+ UCS-4 (or UCS-2, depending on the size -- same difference for the
+ purposes of this test). */
+typedef unsigned int wchar_t;
+wchar_t ucs_4_string[NUM_CHARS];
+
+/* We also define a couple phony types for testing the u'' and U''
+ support. It is ok if these have the wrong size on some platforms
+ -- the test case will skip the tests in that case. */
+typedef unsigned short char16_t;
+typedef unsigned int char32_t;
+
+/* Make sure to use the typedefs. */
+char16_t uvar;
+char32_t Uvar;
void
init_string (char string[],
@@ -62,7 +72,10 @@ init_string (char string[],
char line_feed, char carriage_return, char horizontal_tab,
char vertical_tab, char cent, char misc_ctrl)
{
- memset (string, x, NUM_CHARS);
+ int i;
+
+ for (i = 0; i < NUM_CHARS; ++i)
+ string[i] = x;
string[0] = alert;
string[1] = backspace;
string[2] = form_feed;
@@ -85,13 +98,21 @@ fill_run (char string[], int start, int len, int first)
}
+void
+init_ucs4 ()
+{
+ int i;
+
+ for (i = 0; i < NUM_CHARS; ++i)
+ ucs_4_string[i] = iso_8859_1_string[i] & 0xff;
+}
+
int main ()
{
#ifdef usestubs
set_debug_traps();
breakpoint();
#endif
- (void) malloc (1);
/* Initialize ascii_string. */
init_string (ascii_string,
120,
@@ -146,5 +167,7 @@ int main ()
/* The digits, at least, are contiguous. */
fill_run (ibm1047_string, 59, 10, 240);
- puts ("All set!"); /* all strings initialized */
+ init_ucs4 ();
+
+ return 0; /* all strings initialized */
}
diff --git a/gdb/testsuite/gdb.base/charset.exp b/gdb/testsuite/gdb.base/charset.exp
index fa26521..a6368c9 100644
--- a/gdb/testsuite/gdb.base/charset.exp
+++ b/gdb/testsuite/gdb.base/charset.exp
@@ -47,13 +47,7 @@ proc parse_show_charset_output {testname} {
global gdb_prompt
gdb_expect {
- -re "The current host and target character set is `(.*)'\\.\[\r\n\]+$gdb_prompt $" {
- set host_charset $expect_out(1,string)
- set target_charset $expect_out(1,string)
- set retlist [list $host_charset $target_charset]
- pass $testname
- }
- -re "The current host character set is `(.*)'\\.\[\r\n\]+The current target character set is `(.*)'\\.\[\r\n\]+$gdb_prompt $" {
+ -re "The host character set is \"(.*)\"\\.\[\r\n\]+The target character set is \"(.*)\"\\.\[\r\n\]+The target wide character set is \"(.*)\"\\.\[\r\n\]+$gdb_prompt $" {
set host_charset $expect_out(1,string)
set target_charset $expect_out(2,string)
set retlist [list $host_charset $target_charset]
@@ -81,76 +75,31 @@ proc parse_show_charset_output {testname} {
}
-# Try the various `show charset' commands. These are all aliases of each
-# other; `show target-charset' and `show host-charset' actually print
-# both the host and target charsets.
+# Try the various `show charset' commands.
send_gdb "show charset\n"
set show_charset [parse_show_charset_output "show charset"]
send_gdb "show target-charset\n"
-set show_target_charset [parse_show_charset_output "show target-charset"]
+set show_target_charset \
+ [lindex [parse_show_charset_output "show target-charset"] 0]
-if {[lsearch $show_charset $show_target_charset] >= 0} {
+if {[lsearch -exact $show_charset $show_target_charset] >= 0} {
pass "check `show target-charset' against `show charset'"
} else {
fail "check `show target-charset' against `show charset'"
}
send_gdb "show host-charset\n"
-set show_host_charset [parse_show_charset_output "show host-charset"]
+set show_host_charset \
+ [lindex [parse_show_charset_output "show host-charset"] 0]
-if {[lsearch $show_charset $show_host_charset] >= 0} {
+if {[lsearch -exact $show_charset $show_host_charset] >= 0} {
pass "check `show host-charset' against `show charset'"
} else {
fail "check `show host-charset' against `show charset'"
}
-
-# Get the list of supported (host) charsets as possible completions.
-send_gdb "set charset \t\t"
-
-# Check that we can at least use ASCII as a host character set.
-sleep 1
-gdb_expect {
- -re "^set charset .*\r\nASCII.*\r\n$gdb_prompt set charset " {
- # We got the output that we wanted, including ASCII as possible
- # charset. Send a newline to get us back to the prompt. This will
- # also generate an error message. Let's not check here that the error
- # message makes sense, we do that below, as a separate testcase.
- send_gdb "\n"
- gdb_expect {
- -re ".*Requires an argument.*$gdb_prompt $" {
- pass "get valid character sets"
- }
- -re ".*$gdb_prompt $" {
- send_gdb "\n"
- gdb_expect {
- -re ".*$gdb_prompt $" {
- fail "get valid character sets"
- }
- }
- }
- timeout {
- fail "(timeout) get valid character sets"
- }
- }
- }
- -re ".*$gdb_prompt $" {
- # We got some output that ended with a regular prompt
- fail "get valid character sets"
- }
- -re ".*$gdb_prompt set charset.*$" {
- # We got some other output, send a cntrl-c to gdb to get us back
- # to the prompt.
- send_gdb "\003"
- fail "get valid character sets"
- }
- timeout {
- fail "get valid character sets (timeout)"
- }
-}
-
# Try a malformed `set charset'.
gdb_test "set charset" \
"Requires an argument. Valid arguments are.*" \
@@ -179,7 +128,7 @@ proc all_charset_names {} {
proc valid_host_charset {charset} {
global charsets
- return $charsets($charset)
+ return [expr {[info exists charsets($charset)] && $charsets($charset)}]
}
send_gdb "set host-charset\n"
@@ -211,6 +160,13 @@ gdb_expect {
}
}
+# If gdb was built with a phony iconv, it will only have two character
+# sets: "auto" and the default. In this situation, this set of tests
+# is pointless.
+if {[llength [array names charsets]] < 3} {
+ untested charset.exp
+ return -1
+}
send_gdb "set target-charset\n"
gdb_expect {
@@ -244,8 +200,10 @@ gdb_expect {
}
}
-# Make sure that GDB supports every host/target charset combination.
-foreach host_charset [all_charset_names] {
+# We don't want to test all the charset names here, since that would
+# be too many combinations. We we pick a subset.
+set charset_subset {ASCII ISO-8859-1 EBCDIC-US IBM1047}
+foreach host_charset $charset_subset {
if {[valid_host_charset $host_charset]} {
set testname "try `set host-charset $host_charset'"
@@ -279,7 +237,7 @@ foreach host_charset [all_charset_names] {
# Now try setting every possible target character set,
# given that host charset.
- foreach target_charset [all_charset_names] {
+ foreach target_charset $charset_subset {
set testname "try `set target-charset $target_charset'"
send_gdb "set target-charset $target_charset\n"
gdb_expect {
@@ -404,23 +362,42 @@ gdb_expect {
}
+# We only try the wide character tests on machines where the wchar_t
+# typedef in the test case has the right size.
+set wchar_size [get_sizeof wchar_t 99]
+set wchar_ok 0
+if {$wchar_size == 2} {
+ lappend charset_subset UCS-2
+ set wchar_ok 1
+} elseif {$wchar_size == 4} {
+ lappend charset_subset UCS-4
+ set wchar_ok 1
+}
+
gdb_test "set host-charset ASCII" ""
-foreach target_charset [all_charset_names] {
- send_gdb "set target-charset $target_charset\n"
+foreach target_charset $charset_subset {
+ if {$target_charset == "UCS-4" || $target_charset == "UCS-2"} {
+ set param target-wide-charset
+ set L L
+ } else {
+ set param target-charset
+ set L ""
+ }
+ send_gdb "set $param $target_charset\n"
gdb_expect {
-re "$gdb_prompt $" {
- pass "set target-charset $target_charset"
+ pass "set $param $target_charset"
}
timeout {
- fail "set target-charset $target_charset (timeout)"
+ fail "set $param $target_charset (timeout)"
}
}
# Try printing the null character. There seems to be a bug in
# gdb_test that requires us to use gdb_expect here.
- send_gdb "print '\\0'\n"
+ send_gdb "print $L'\\0'\n"
gdb_expect {
- -re "\\\$${decimal} = 0 '\\\\0'\[\r\n\]+$gdb_prompt $" {
+ -re "\\\$${decimal} = 0 $L'\\\\0'\[\r\n\]+$gdb_prompt $" {
pass "print the null character in ${target_charset}"
}
-re "$gdb_prompt $" {
@@ -435,8 +412,14 @@ foreach target_charset [all_charset_names] {
# a string in $target_charset. The variable's name is the
# character set's name, in lower-case, with all non-identifier
# characters replaced with '_', with "_string" stuck on the end.
- set var_name [string tolower "${target_charset}_string"]
- regsub -all -- "\[^a-z0-9_\]" $var_name "_" var_name
+ if {$target_charset == "UCS-2"} {
+ # We still use the ucs_4_string variable -- but the size is
+ # correct for UCS-2.
+ set var_name ucs_4_string
+ } else {
+ set var_name [string tolower "${target_charset}_string"]
+ regsub -all -- "\[^a-z0-9_\]" $var_name "_" var_name
+ }
# Compute a regexp matching the results we expect. This is static,
# but it's easier than writing it out.
@@ -444,12 +427,12 @@ foreach target_charset [all_charset_names] {
set uppercase "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set lowercase "abcdefghijklmnopqrstuvwxyz"
set digits "0123456789"
- set octal_escape "\\\\\[0-9\]\[0-9\]\[0-9\]"
+ set octal_escape "\\\\\[0-9\]+"
send_gdb "print $var_name\n"
# ${escapes}${uppercase}${lowercase}${digits}${octal}${octal}
gdb_expect {
- -re ".* = \"(\\\\a|x)(\\\\b|x)(\\\\f|x)(\\\\n|x)(\\\\r|x)(\\\\t|x)(\\\\v|x)${uppercase}${lowercase}${digits}(\\\\\[0-9\]\[0-9\]\[0-9\]|x)(\\\\\[0-9\]\[0-9\]\[0-9\]|x).*\"\[\r\n\]+$gdb_prompt $" {
+ -re ".* = $L\"(\\\\a|x)(\\\\b|x)(\\\\f|x)(\\\\n|x)(\\\\r|x)(\\\\t|x)(\\\\v|x)${uppercase}${lowercase}${digits}(${octal_escape}|x)+\"\[\r\n\]+$gdb_prompt $" {
pass "print string in $target_charset"
}
-re "$gdb_prompt $" {
@@ -461,22 +444,22 @@ foreach target_charset [all_charset_names] {
}
# Try entering a character literal, and see if it comes back unchanged.
- gdb_test "print 'A'" \
- " = \[0-9-\]+ 'A'" \
+ gdb_test "print $L'A'" \
+ " = \[0-9-\]+ $L'A'" \
"parse character literal in ${target_charset}"
# Check that the character literal was encoded correctly.
- gdb_test "print 'A' == $var_name\[7\]" \
+ gdb_test "print $L'A' == $var_name\[7\]" \
" = 1" \
"check value of parsed character literal in ${target_charset}"
# Try entering a string literal, and see if it comes back unchanged.
- gdb_test "print \"abcdefABCDEF012345\"" \
- " = \"abcdefABCDEF012345\"" \
+ gdb_test "print $L\"abcdefABCDEF012345\"" \
+ " = $L\"abcdefABCDEF012345\"" \
"parse string literal in ${target_charset}"
# Check that the string literal was encoded correctly.
- gdb_test "print \"q\"\[0\] == $var_name\[49\]" \
+ gdb_test "print $L\"q\"\[0\] == $var_name\[49\]" \
" = 1" \
"check value of parsed string literal in ${target_charset}"
@@ -509,7 +492,7 @@ foreach target_charset [all_charset_names] {
send_gdb "print $var_name\[$i\]\n"
set have_escape 1
gdb_expect {
- -re "= \[0-9-\]+ '\\\\${escape}'\[\r\n\]+$gdb_prompt $" {
+ -re "= \[0-9-\]+ $L'\\\\${escape}'\[\r\n\]+$gdb_prompt $" {
pass "try printing '\\${escape}' in ${target_charset}"
}
-re "= \[0-9-\]+ 'x'\[\r\n\]+$gdb_prompt $" {
@@ -527,12 +510,12 @@ foreach target_charset [all_charset_names] {
if {$have_escape} {
# Try parsing a backslash escape in a character literal.
- gdb_test "print '\\${escape}' == $var_name\[$i\]" \
+ gdb_test "print $L'\\${escape}' == $var_name\[$i\]" \
" = 1" \
"check value of '\\${escape}' in ${target_charset}"
# Try parsing a backslash escape in a string literal.
- gdb_test "print \"\\${escape}\"\[0\] == $var_name\[$i\]" \
+ gdb_test "print $L\"\\${escape}\"\[0\] == $var_name\[$i\]" \
" = 1" \
"check value of \"\\${escape}\" in ${target_charset}"
}
@@ -540,10 +523,73 @@ foreach target_charset [all_charset_names] {
# Try printing a character escape that doesn't exist. We should
# get the unescaped character, in the target character set.
- gdb_test "print '\\q'" " = \[0-9-\]+ 'q'" \
+ gdb_test "print $L'\\q'" " = \[0-9-\]+ $L'q'" \
"print escape that doesn't exist in $target_charset"
- gdb_test "print '\\q' == $var_name\[49\]" " = 1" \
+ gdb_test "print $L'\\q' == $var_name\[49\]" " = 1" \
"check value of escape that doesn't exist in $target_charset"
}
+# Reset the target charset.
+gdb_test "set target-charset UTF-8" ""
+
+# \242 is not a valid UTF-8 character.
+gdb_test "print \"\\242\"" " = \"\\\\242\"" \
+ "non-representable target character"
+
+gdb_test "print '\\x'" "\\\\x escape without a following hex digit."
+gdb_test "print '\\u'" "\\\\u escape without a following hex digit."
+gdb_test "print '\\9'" " = \[0-9\]+ '9'"
+
+# Tests for wide- or unicode- strings. L is the prefix letter to use,
+# either "L" (for wide strings), "u" (for UCS-2), or "U" (for UCS-4).
+# NAME is used in the test names and should be related to the prefix
+# letter in some easy-to-undestand way.
+proc test_wide_or_unicode {L name} {
+ gdb_test "print $L\"ab\" $L\"c\"" " = $L\"abc\"" \
+ "basic $name string concatenation"
+ gdb_test "print $L\"ab\" \"c\"" " = $L\"abc\"" \
+ "narrow and $name string concatenation"
+ gdb_test "print \"ab\" $L\"c\"" " = $L\"abc\"" \
+ "$name and narrow string concatenation"
+ gdb_test "print $L\"\\xe\" $L\"c\"" " = $L\"\\\\16c\"" \
+ "$name string concatenation with escape"
+ gdb_test "print $L\"\" \"abcdef\" \"g\"" \
+ "$L\"abcdefg\"" \
+ "concatenate three strings with empty $name string"
+
+ gdb_test "print $L'a'" "= \[0-9\]+ $L'a'" \
+ "basic $name character"
+}
+
+if {$wchar_ok} {
+ test_wide_or_unicode L wide
+}
+
+set ucs2_ok [expr {[get_sizeof char16_t 99] == 2}]
+if {$ucs2_ok} {
+ test_wide_or_unicode u UCS-2
+}
+
+set ucs4_ok [expr {[get_sizeof char32_t 99] == 4}]
+if {$ucs4_ok} {
+ test_wide_or_unicode U UCS-4
+}
+
+# Test an invalid string combination.
+proc test_combination {L1 name1 L2 name2} {
+ gdb_test "print $L1\"abc\" $L2\"def\"" \
+ "Undefined string concatenation." \
+ "undefined concatenation of $name1 and $name2"
+}
+
+if {$wchar_ok && $ucs2_ok} {
+ test_combination L wide u UCS-2
+}
+if {$wchar_ok && $ucs4_ok} {
+ test_combination L wide U UCS-4
+}
+if {$ucs2_ok && $ucs4_ok} {
+ test_combination u UCS-2 U UCS-4
+}
+
gdb_exit
diff --git a/gdb/testsuite/gdb.base/constvars.exp b/gdb/testsuite/gdb.base/constvars.exp
index d53a826..6d1bd12 100644
--- a/gdb/testsuite/gdb.base/constvars.exp
+++ b/gdb/testsuite/gdb.base/constvars.exp
@@ -161,7 +161,7 @@ proc do_constvar_tests {} {
gdb_test "print laconic" " = 65 'A'"
local_compiler_xfail_check
gdb_test "ptype laconic" "type = const char"
- gdb_test "print laggard" " = 1 '.001'"
+ gdb_test "print laggard" " = 1 '.1'"
local_compiler_xfail_check
gdb_test "ptype laggard" "type = const unsigned char"
gdb_test "print lagoon" " = 2"
@@ -209,7 +209,7 @@ proc do_constvar_tests {} {
gdb_test "print *lewd" " = 65 'A'"
local_compiler_xfail_check
gdb_test "ptype lewd" "type = const char \\* const"
- gdb_test "print *lexicographer" " = 1 '.001'"
+ gdb_test "print *lexicographer" " = 1 '.1'"
local_compiler_xfail_check
gdb_test "ptype lexicographer" "type = const unsigned char \\* const"
gdb_test "print *lexicon" " = 2"
@@ -233,7 +233,7 @@ proc do_constvar_tests {} {
gdb_test "print *languish" " = 65 'A'"
local_compiler_xfail_check
gdb_test "ptype languish" "type = const char \\*"
- gdb_test "print *languor" " = 1 '.001'"
+ gdb_test "print *languor" " = 1 '.1'"
local_compiler_xfail_check
gdb_test "ptype languor" "type = const unsigned char \\*"
gdb_test "print *lank" " = 2"
diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp
index d0ad5ba..5189324 100644
--- a/gdb/testsuite/gdb.base/long_long.exp
+++ b/gdb/testsuite/gdb.base/long_long.exp
@@ -210,7 +210,7 @@ gdb_test_char "p/o *(char *)c" "01"
gdb_test_char "p/t *(char *)c" "1"
gdb_test_char "p/a *(char *)c" "0x1( <.*>)?"
gdb_test_char "p/f *(char *)c" "1"
-gdb_test_char "p/c *(char *)c" "1 '.001'"
+gdb_test_char "p/c *(char *)c" "1 '.1'"
gdb_test_short "p/x *(short *)s" "" "0x123" ""
gdb_test_short "p/d *(short *)s" "" "291" ""
@@ -257,7 +257,7 @@ gdb_test "x/u w" "19088743"
gdb_test "x/o w" "0110642547"
gdb_test "x/t w" "00000001001000110100010101100111"
gdb_test_xptr "x/a" { b "" } { h "" } { w "0x1234567" } { g "0x123456789abcdef" }
-gdb_test "x/c b" "1 '.001'"
+gdb_test "x/c b" "1 '.1'"
if { $sizeof_double == 8 || $sizeof_long_double == 8 } {
gdb_test "x/f &val.oct" "-5.9822653797615723e-120"
} else {
@@ -273,7 +273,7 @@ gdb_test "x/2u g" "81985529216486895.*12046818088235383159"
gdb_test "x/2o g" "04432126361152746757.*01234567123456701234567"
gdb_test "x/2t g" "0000000100100011010001010110011110001001101010111100110111101111.*1010011100101110111001010011100101110111000001010011100101110111"
gdb_test_xptr "x/2a" { b "" } { h "" } { w "0x1234567.*0xa72ee539" } { g "0x123456789abcdef.*0xa72ee53977053977" }
-gdb_test "x/2c b" "1 '.001'.*-89 '.'"
+gdb_test "x/2c b" "1 '.1'.*-89 '.\[0-9\]*'"
if { $sizeof_double == 8 || $sizeof_long_double == 8 } {
gdb_test "x/2f &val.oct" "-5.9822653797615723e-120.*-5.9041889495880968e-100"
} else {
@@ -288,7 +288,7 @@ gdb_test "x/2bu b" "1.*167"
gdb_test "x/2bo b" "01.*0247"
gdb_test "x/2bt b" "00000001.*10100111"
gdb_test_ptr "x/2ba b" "" "" "0x1.*0xffffffa7" "0x1.*0xffffffffffffffa7"
-gdb_test "x/2bc b" "1 '.001'.*-89 '.'"
+gdb_test "x/2bc b" "1 '.1'.*-89 '.\[0-9\]*'"
gdb_test "x/2bf b" "1.*-89"
gdb_test "x/2hx h" "0x0123.*0xa72e"
@@ -315,7 +315,7 @@ gdb_test "x/2gu g" "81985529216486895.*12046818088235383159"
gdb_test "x/2go g" "04432126361152746757.*01234567123456701234567"
gdb_test "x/2gt g" "0000000100100011010001010110011110001001101010111100110111101111.*1010011100101110111001010011100101110111000001010011100101110111"
gdb_test_ptr "x/2ga g" "" "" "0x89abcdef.*0x77053977" "0x123456789abcdef.*0xa72ee53977053977"
-gdb_test "x/2gc g" "-17 '.'.*119 'w'"
+gdb_test "x/2gc g" "-17 '.\[0-9\]*'.*119 'w'"
gdb_test "x/2gf g" "3.5127005640885037e-303.*-5.9822653797615723e-120"
gdb_exit
diff --git a/gdb/testsuite/gdb.base/pointers.exp b/gdb/testsuite/gdb.base/pointers.exp
index 91838a2..2d0a70e 100644
--- a/gdb/testsuite/gdb.base/pointers.exp
+++ b/gdb/testsuite/gdb.base/pointers.exp
@@ -389,7 +389,7 @@ gdb_expect {
send_gdb "print *pUC\n"
gdb_expect {
- -re ".\[0-9\]* = 21 \'.025\'.*$gdb_prompt $" {
+ -re ".\[0-9\]* = 21 \'.25\'.*$gdb_prompt $" {
pass "print value of *pUC"
}
-re ".*$gdb_prompt $" { fail "print value of *pUC" }
diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp
index 1e17da4..b6f8a1f 100644
--- a/gdb/testsuite/gdb.base/printcmds.exp
+++ b/gdb/testsuite/gdb.base/printcmds.exp
@@ -137,12 +137,12 @@ proc test_print_all_chars {} {
global gdb_prompt
gdb_test "p ctable1\[0\]" " = 0 '\\\\0'"
- gdb_test "p ctable1\[1\]" " = 1 '\\\\001'"
- gdb_test "p ctable1\[2\]" " = 2 '\\\\002'"
- gdb_test "p ctable1\[3\]" " = 3 '\\\\003'"
- gdb_test "p ctable1\[4\]" " = 4 '\\\\004'"
- gdb_test "p ctable1\[5\]" " = 5 '\\\\005'"
- gdb_test "p ctable1\[6\]" " = 6 '\\\\006'"
+ gdb_test "p ctable1\[1\]" " = 1 '\\\\1'"
+ gdb_test "p ctable1\[2\]" " = 2 '\\\\2'"
+ gdb_test "p ctable1\[3\]" " = 3 '\\\\3'"
+ gdb_test "p ctable1\[4\]" " = 4 '\\\\4'"
+ gdb_test "p ctable1\[5\]" " = 5 '\\\\5'"
+ gdb_test "p ctable1\[6\]" " = 6 '\\\\6'"
gdb_test "p ctable1\[7\]" " = 7 '\\\\a'"
gdb_test "p ctable1\[8\]" " = 8 '\\\\b'"
gdb_test "p ctable1\[9\]" " = 9 '\\\\t'"
@@ -150,24 +150,24 @@ proc test_print_all_chars {} {
gdb_test "p ctable1\[11\]" " = 11 '\\\\v'"
gdb_test "p ctable1\[12\]" " = 12 '\\\\f'"
gdb_test "p ctable1\[13\]" " = 13 '\\\\r'"
- gdb_test "p ctable1\[14\]" " = 14 '\\\\016'"
- gdb_test "p ctable1\[15\]" " = 15 '\\\\017'"
- gdb_test "p ctable1\[16\]" " = 16 '\\\\020'"
- gdb_test "p ctable1\[17\]" " = 17 '\\\\021'"
- gdb_test "p ctable1\[18\]" " = 18 '\\\\022'"
- gdb_test "p ctable1\[19\]" " = 19 '\\\\023'"
- gdb_test "p ctable1\[20\]" " = 20 '\\\\024'"
- gdb_test "p ctable1\[21\]" " = 21 '\\\\025'"
- gdb_test "p ctable1\[22\]" " = 22 '\\\\026'"
- gdb_test "p ctable1\[23\]" " = 23 '\\\\027'"
- gdb_test "p ctable1\[24\]" " = 24 '\\\\030'"
- gdb_test "p ctable1\[25\]" " = 25 '\\\\031'"
- gdb_test "p ctable1\[26\]" " = 26 '\\\\032'"
- gdb_test "p ctable1\[27\]" " = 27 '\\\\033'"
- gdb_test "p ctable1\[28\]" " = 28 '\\\\034'"
- gdb_test "p ctable1\[29\]" " = 29 '\\\\035'"
- gdb_test "p ctable1\[30\]" " = 30 '\\\\036'"
- gdb_test "p ctable1\[31\]" " = 31 '\\\\037'"
+ gdb_test "p ctable1\[14\]" " = 14 '\\\\16'"
+ gdb_test "p ctable1\[15\]" " = 15 '\\\\17'"
+ gdb_test "p ctable1\[16\]" " = 16 '\\\\20'"
+ gdb_test "p ctable1\[17\]" " = 17 '\\\\21'"
+ gdb_test "p ctable1\[18\]" " = 18 '\\\\22'"
+ gdb_test "p ctable1\[19\]" " = 19 '\\\\23'"
+ gdb_test "p ctable1\[20\]" " = 20 '\\\\24'"
+ gdb_test "p ctable1\[21\]" " = 21 '\\\\25'"
+ gdb_test "p ctable1\[22\]" " = 22 '\\\\26'"
+ gdb_test "p ctable1\[23\]" " = 23 '\\\\27'"
+ gdb_test "p ctable1\[24\]" " = 24 '\\\\30'"
+ gdb_test "p ctable1\[25\]" " = 25 '\\\\31'"
+ gdb_test "p ctable1\[26\]" " = 26 '\\\\32'"
+ gdb_test "p ctable1\[27\]" " = 27 '\\\\33'"
+ gdb_test "p ctable1\[28\]" " = 28 '\\\\34'"
+ gdb_test "p ctable1\[29\]" " = 29 '\\\\35'"
+ gdb_test "p ctable1\[30\]" " = 30 '\\\\36'"
+ gdb_test "p ctable1\[31\]" " = 31 '\\\\37'"
gdb_test "p ctable1\[32\]" " = 32 ' '"
gdb_test "p ctable1\[33\]" " = 33 '!'"
gdb_test "p ctable1\[34\]" " = 34 '\"'"
@@ -475,13 +475,13 @@ proc test_print_strings {} {
gdb_test "p &ctable1\[0\]" \
" = \\(unsigned char \\*\\) \"\""
gdb_test "p &ctable1\[1\]" \
- " = \\(unsigned char \\*\\) \"\\\\001\\\\002\\\\003\\\\004\\\\005\\\\006\\\\a\\\\b\"..."
+ " = \\(unsigned char \\*\\) \"\\\\1\\\\2\\\\3\\\\4\\\\5\\\\6\\\\a\\\\b\"..."
gdb_test "p &ctable1\[1*8\]" \
- " = \\(unsigned char \\*\\) \"\\\\b\\\\t\\\\n\\\\v\\\\f\\\\r\\\\016\\\\017\"..."
+ " = \\(unsigned char \\*\\) \"\\\\b\\\\t\\\\n\\\\v\\\\f\\\\r\\\\16\\\\17\"..."
gdb_test "p &ctable1\[2*8\]" \
- " = \\(unsigned char \\*\\) \"\\\\020\\\\021\\\\022\\\\023\\\\024\\\\025\\\\026\\\\027\"..."
+ " = \\(unsigned char \\*\\) \"\\\\20\\\\21\\\\22\\\\23\\\\24\\\\25\\\\26\\\\27\"..."
gdb_test "p &ctable1\[3*8\]" \
- " = \\(unsigned char \\*\\) \"\\\\030\\\\031\\\\032\\\\033\\\\034\\\\035\\\\036\\\\037\"..."
+ " = \\(unsigned char \\*\\) \"\\\\30\\\\31\\\\32\\\\33\\\\34\\\\35\\\\36\\\\37\"..."
gdb_test "p &ctable1\[4*8\]" \
" = \\(unsigned char \\*\\) \" !\\\\\"#\\\$%&'\"..."
gdb_test "p &ctable1\[5*8\]" \
@@ -622,7 +622,7 @@ proc test_print_string_constants {} {
set timeout 60;
gdb_test "p \"a string\"" " = \"a string\""
- gdb_test "p \"embedded \\000 null\"" " = \"embedded \\\\000 null\""
+ gdb_test "p \"embedded \\000 null\"" " = \"embedded \\\\0 null\""
gdb_test "p \"abcd\"\[2\]" " = 99 'c'"
gdb_test "p sizeof (\"abcdef\")" " = 7"
gdb_test "ptype \"foo\"" " = char \\\[4\\\]"
diff --git a/gdb/testsuite/gdb.base/setvar.exp b/gdb/testsuite/gdb.base/setvar.exp
index 2350a33..3be8424 100644
--- a/gdb/testsuite/gdb.base/setvar.exp
+++ b/gdb/testsuite/gdb.base/setvar.exp
@@ -121,7 +121,7 @@ proc test_set { args } {
#
test_set "set variable v_char=0" "print v_char" ".\[0-9\]* = 0 \'.0\'" "set variable char=0"
-test_set "set variable v_char=1" "print v_char" ".\[0-9\]* = 1 \'.001\'" "set variable char=1"
+test_set "set variable v_char=1" "print v_char" ".\[0-9\]* = 1 \'.1\'" "set variable char=1"
test_set "set variable v_char=7" "print v_char" ".\[0-9\]* = 7 \'.a\'" "set variable char=7 (Bel)"
test_set "set variable v_char=32" "print v_char" ".\[0-9\]* = 32 \' \'" "set variable char=32 (SPC)"
test_set "set variable v_char=65" "print v_char" ".\[0-9\]* = 65 \'A\'" "set variable char=65 ('A')"
@@ -132,7 +132,7 @@ test_set "set variable v_char=127" "print v_char" ".\[0-9\]* = 127 \'.177\'"
# test "set variable" for type "signed char"
#
test_set "set variable v_char=0" "print v_signed_char" ".\[0-9\]* = 0 \'.0\'" "set variable signed char=0"
-test_set "set variable v_signed_char=1" "print v_signed_char" ".\[0-9\]* = 1 \'.001\'" "set variable signed char=1"
+test_set "set variable v_signed_char=1" "print v_signed_char" ".\[0-9\]* = 1 \'.1\'" "set variable signed char=1"
test_set "set variable v_signed_char=7" "print v_signed_char" ".\[0-9\]* = 7 \'.a\'" "set variable signed char=7 (Bel)"
test_set "set variable v_signed_char=32" "print v_signed_char" ".\[0-9\]* = 32 \' \'" "set variable signed char=32 (SPC)"
test_set "set variable v_signed_char=65" "print v_signed_char" ".\[0-9\]* = 65 \'A\'" "set variable signed char=65 ('A')"
@@ -151,7 +151,7 @@ gdb_test "print v_signed_char" ".\[0-9\]* = -1 \'.377\'" \
# test "set variable" for type "unsigned char"
#
test_set "set variable v_unsigned_char=0" "print v_unsigned_char" ".\[0-9\]* = 0 \'.0\'" "set variable unsigned char=0"
-test_set "set variable v_unsigned_char=1" "print v_unsigned_char" ".\[0-9\]* = 1 \'.001\'" "set variable unsigned char=1"
+test_set "set variable v_unsigned_char=1" "print v_unsigned_char" ".\[0-9\]* = 1 \'.1\'" "set variable unsigned char=1"
test_set "set variable v_unsigned_char=7" "print v_unsigned_char" ".\[0-9\]* = 7 \'.a\'" "set variable unsigned char=7 (Bel)"
test_set "set variable v_unsigned_char=32" "print v_unsigned_char" ".\[0-9\]* = 32 \' \'" "set variable unsigned char=32 (SPC)"
test_set "set variable v_unsigned_char=65" "print v_unsigned_char" ".\[0-9\]* = 65 \'A\'" "set variable unsigned char=65 ('A')"
diff --git a/gdb/testsuite/gdb.base/store.exp b/gdb/testsuite/gdb.base/store.exp
index 963bb19..feab6bd 100644
--- a/gdb/testsuite/gdb.base/store.exp
+++ b/gdb/testsuite/gdb.base/store.exp
@@ -74,7 +74,7 @@ proc check_set { t l r new add } {
"${prefix}; print incremented l, expecting ${add}"
}
-check_set "charest" "-1 .*" "-2 .*" "4 ..004." "2 ..002."
+check_set "charest" "-1 .*" "-2 .*" "4 ..4." "2 ..2."
check_set "short" "-1" "-2" "4" "2"
check_set "int" "-1" "-2" "4" "2"
check_set "long" "-1" "-2" "4" "2"
@@ -102,7 +102,7 @@ proc up_set { t l r new } {
"${prefix}; print new l, expecting ${new}"
}
-up_set "charest" "-1 .*" "-2 .*" "4 ..004."
+up_set "charest" "-1 .*" "-2 .*" "4 ..4."
up_set "short" "-1" "-2" "4"
up_set "int" "-1" "-2" "4"
up_set "long" "-1" "-2" "4"
diff --git a/gdb/testsuite/gdb.cp/ref-types.exp b/gdb/testsuite/gdb.cp/ref-types.exp
index 4784cb2..b2e55cf 100644
--- a/gdb/testsuite/gdb.cp/ref-types.exp
+++ b/gdb/testsuite/gdb.cp/ref-types.exp
@@ -284,7 +284,7 @@ gdb_expect {
send_gdb "print UC\n"
gdb_expect {
- -re ".\[0-9\]* = 21 '\.025'\.*$gdb_prompt $" {
+ -re ".\[0-9\]* = 21 '\.25'\.*$gdb_prompt $" {
pass "print value of UC"
}
-re ".*$gdb_prompt $" { fail "print value of UC" }
@@ -557,7 +557,7 @@ gdb_expect {
send_gdb "print rUC\n"
gdb_expect {
- -re ".\[0-9\]* = \\(unsigned char &\\) @$hex: 21 \'.025\'.*$gdb_prompt $" {
+ -re ".\[0-9\]* = \\(unsigned char &\\) @$hex: 21 \'.25\'.*$gdb_prompt $" {
pass "print value of rUC"
}
-re ".*$gdb_prompt $" { fail "print value of rUC" }
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 820ab20..8b8e7c6 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1162,9 +1162,12 @@ proc default_gdb_start { } {
global gdb_prompt
global timeout
global gdb_spawn_id;
+ global env
gdb_stop_suppressing_tests;
+ set env(LC_CTYPE) C
+
verbose "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS"
if [info exists gdb_spawn_id] {