2004-02-26 18:23:23 +01:00
|
|
|
# This testcase is part of GDB, the GNU debugger.
|
|
|
|
|
2008-01-01 23:53:26 +01:00
|
|
|
# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2007,
|
2009-01-03 06:58:08 +01:00
|
|
|
# 2008, 2009 Free Software Foundation, Inc.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
# 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
|
2007-08-23 20:14:19 +02:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
1999-04-16 03:35:26 +02:00
|
|
|
# (at your option) any later version.
|
2007-08-23 20:14:19 +02:00
|
|
|
#
|
1999-04-16 03:35:26 +02:00
|
|
|
# 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.
|
2007-08-23 20:14:19 +02:00
|
|
|
#
|
1999-04-16 03:35:26 +02:00
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-08-23 20:14:19 +02:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
2004-02-26 18:23:23 +01:00
|
|
|
# bug-gdb@gnu.org
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
# This file was written by Fred Fish. (fnf@cygnus.com)
|
|
|
|
|
|
|
|
if $tracelevel then {
|
|
|
|
strace $tracelevel
|
|
|
|
}
|
|
|
|
|
|
|
|
set prms_id 0
|
|
|
|
set bug_id 0
|
|
|
|
|
|
|
|
set testfile "printcmds"
|
|
|
|
set srcfile ${testfile}.c
|
|
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
|
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
2006-08-10 07:27:22 +02:00
|
|
|
untested printcmds.exp
|
|
|
|
return -1
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Set the current language to C. This counts as a test. If it
|
|
|
|
# fails, then we skip the other tests.
|
|
|
|
|
|
|
|
proc set_lang_c {} {
|
|
|
|
global gdb_prompt
|
|
|
|
|
|
|
|
if [gdb_test "set language c" "" "set language c"] {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
if [gdb_test "show language" ".* source language is \"c\".*"] {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
proc test_integer_literals_accepted {} {
|
|
|
|
global gdb_prompt
|
|
|
|
|
|
|
|
# Test various decimal values.
|
|
|
|
|
|
|
|
gdb_test "p 123" " = 123"
|
|
|
|
gdb_test "p -123" " = -123"
|
|
|
|
gdb_test "p/d 123" " = 123"
|
|
|
|
|
|
|
|
# Test various octal values.
|
|
|
|
|
|
|
|
gdb_test "p 0123" " = 83"
|
|
|
|
gdb_test "p 00123" " = 83"
|
|
|
|
gdb_test "p -0123" " = -83"
|
|
|
|
gdb_test "p/o 0123" " = 0123"
|
|
|
|
|
|
|
|
# Test various hexadecimal values.
|
|
|
|
|
|
|
|
gdb_test "p 0x123" " = 291"
|
|
|
|
gdb_test "p -0x123" " = -291"
|
|
|
|
gdb_test "p 0x0123" " = 291"
|
|
|
|
gdb_test "p -0x0123" " = -291"
|
|
|
|
gdb_test "p 0xABCDEF" " = 11259375"
|
|
|
|
gdb_test "p 0xabcdef" " = 11259375"
|
|
|
|
gdb_test "p 0xAbCdEf" " = 11259375"
|
|
|
|
gdb_test "p/x 0x123" " = 0x123"
|
|
|
|
}
|
|
|
|
|
|
|
|
proc test_character_literals_accepted {} {
|
|
|
|
global gdb_prompt
|
|
|
|
|
|
|
|
gdb_test "p 'a'" " = 97 'a'"
|
|
|
|
gdb_test "p/c 'a'" " = 97 'a'"
|
|
|
|
gdb_test "p/x 'a'" " = 0x61"
|
|
|
|
gdb_test "p/d 'a'" " = 97"
|
|
|
|
gdb_test "p/t 'a'" " = 1100001"
|
|
|
|
gdb_test "p '\\141'" " = 97 'a'"
|
|
|
|
gdb_test "p/x '\\377'" " = 0xff"
|
|
|
|
# Note "p '\''" => "= 39 '\''"
|
|
|
|
gdb_test "p '\\''" " = 39 '\\\\''"
|
|
|
|
# Note "p '\\'" => "= 92 '\\'"
|
|
|
|
gdb_test "p '\\\\'" " = 92 '\\\\\\\\'"
|
|
|
|
}
|
|
|
|
|
|
|
|
proc test_integer_literals_rejected {} {
|
|
|
|
global gdb_prompt
|
|
|
|
|
|
|
|
test_print_reject "p 0x"
|
2002-05-10 20:38:09 +02:00
|
|
|
gdb_test "p ''" "(Empty character constant\\.|A character constant must contain at least one character\\.)"
|
|
|
|
gdb_test "p '''" "(Empty character constant\\.|A character constant must contain at least one character\\.)"
|
1999-04-16 03:35:26 +02:00
|
|
|
test_print_reject "p '\\'"
|
|
|
|
|
|
|
|
# Note that this turns into "p '\\\'" at gdb's input.
|
|
|
|
test_print_reject "p '\\\\\\'"
|
|
|
|
|
|
|
|
# Test various decimal values.
|
|
|
|
|
|
|
|
test_print_reject "p DEADBEEF"
|
|
|
|
|
|
|
|
# Gdb currently fails this test for all configurations. The C
|
|
|
|
# lexer thinks that 123DEADBEEF is a floating point number, but
|
|
|
|
# then fails to notice that atof() only eats the 123 part.
|
|
|
|
# FIXME: This should be put into PRMS.
|
|
|
|
# Fixed, 4/25/97, by Bob Manson.
|
|
|
|
|
|
|
|
test_print_reject "p 123DEADBEEF"
|
|
|
|
test_print_reject "p 123foobar.bazfoo3"
|
|
|
|
test_print_reject "p 123EEEEEEEEEEEEEEEEE33333k333"
|
|
|
|
gdb_test "p 123.4+56.7" "180.(099\[0-9]*|100\[0-9\]*)" "check for floating addition"
|
|
|
|
|
|
|
|
# Test various octal values.
|
|
|
|
|
|
|
|
test_print_reject "p 09"
|
|
|
|
test_print_reject "p 079"
|
|
|
|
|
|
|
|
# Test various hexadecimal values.
|
|
|
|
|
|
|
|
test_print_reject "p 0xG"
|
|
|
|
test_print_reject "p 0xAG"
|
|
|
|
}
|
|
|
|
|
|
|
|
proc test_print_all_chars {} {
|
|
|
|
global gdb_prompt
|
|
|
|
|
2001-12-19 07:29:45 +01:00
|
|
|
gdb_test "p ctable1\[0\]" " = 0 '\\\\0'"
|
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.
2009-03-21 00:04:40 +01:00
|
|
|
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'"
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p ctable1\[7\]" " = 7 '\\\\a'"
|
|
|
|
gdb_test "p ctable1\[8\]" " = 8 '\\\\b'"
|
|
|
|
gdb_test "p ctable1\[9\]" " = 9 '\\\\t'"
|
|
|
|
gdb_test "p ctable1\[10\]" " = 10 '\\\\n'"
|
2001-12-19 07:29:45 +01:00
|
|
|
gdb_test "p ctable1\[11\]" " = 11 '\\\\v'"
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p ctable1\[12\]" " = 12 '\\\\f'"
|
|
|
|
gdb_test "p ctable1\[13\]" " = 13 '\\\\r'"
|
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.
2009-03-21 00:04:40 +01:00
|
|
|
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'"
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p ctable1\[32\]" " = 32 ' '"
|
|
|
|
gdb_test "p ctable1\[33\]" " = 33 '!'"
|
|
|
|
gdb_test "p ctable1\[34\]" " = 34 '\"'"
|
|
|
|
gdb_test "p ctable1\[35\]" " = 35 '#'"
|
|
|
|
gdb_test "p ctable1\[36\]" " = 36 '\\\$'"
|
|
|
|
gdb_test "p ctable1\[37\]" " = 37 '%'"
|
|
|
|
gdb_test "p ctable1\[38\]" " = 38 '&'"
|
|
|
|
gdb_test "p ctable1\[39\]" " = 39 '\\\\''"
|
|
|
|
gdb_test "p ctable1\[40\]" " = 40 '\\('"
|
|
|
|
gdb_test "p ctable1\[41\]" " = 41 '\\)'"
|
|
|
|
gdb_test "p ctable1\[42\]" " = 42 '\\*'"
|
|
|
|
gdb_test "p ctable1\[43\]" " = 43 '\\+'"
|
|
|
|
gdb_test "p ctable1\[44\]" " = 44 ','"
|
|
|
|
gdb_test "p ctable1\[45\]" " = 45 '-'"
|
|
|
|
gdb_test "p ctable1\[46\]" " = 46 '.'"
|
|
|
|
gdb_test "p ctable1\[47\]" " = 47 '/'"
|
|
|
|
gdb_test "p ctable1\[48\]" " = 48 '0'"
|
|
|
|
gdb_test "p ctable1\[49\]" " = 49 '1'"
|
|
|
|
gdb_test "p ctable1\[50\]" " = 50 '2'"
|
|
|
|
gdb_test "p ctable1\[51\]" " = 51 '3'"
|
|
|
|
gdb_test "p ctable1\[52\]" " = 52 '4'"
|
|
|
|
gdb_test "p ctable1\[53\]" " = 53 '5'"
|
|
|
|
gdb_test "p ctable1\[54\]" " = 54 '6'"
|
|
|
|
gdb_test "p ctable1\[55\]" " = 55 '7'"
|
|
|
|
gdb_test "p ctable1\[56\]" " = 56 '8'"
|
|
|
|
gdb_test "p ctable1\[57\]" " = 57 '9'"
|
|
|
|
gdb_test "p ctable1\[58\]" " = 58 ':'"
|
|
|
|
gdb_test "p ctable1\[59\]" " = 59 ';'"
|
|
|
|
gdb_test "p ctable1\[60\]" " = 60 '<'"
|
|
|
|
gdb_test "p ctable1\[61\]" " = 61 '='"
|
|
|
|
gdb_test "p ctable1\[62\]" " = 62 '>'"
|
|
|
|
gdb_test "p ctable1\[63\]" " = 63 '\\?'"
|
|
|
|
gdb_test "p ctable1\[64\]" " = 64 '@'"
|
|
|
|
gdb_test "p ctable1\[65\]" " = 65 'A'"
|
|
|
|
gdb_test "p ctable1\[66\]" " = 66 'B'"
|
|
|
|
gdb_test "p ctable1\[67\]" " = 67 'C'"
|
|
|
|
gdb_test "p ctable1\[68\]" " = 68 'D'"
|
|
|
|
gdb_test "p ctable1\[69\]" " = 69 'E'"
|
|
|
|
gdb_test "p ctable1\[70\]" " = 70 'F'"
|
|
|
|
gdb_test "p ctable1\[71\]" " = 71 'G'"
|
|
|
|
gdb_test "p ctable1\[72\]" " = 72 'H'"
|
|
|
|
gdb_test "p ctable1\[73\]" " = 73 'I'"
|
|
|
|
gdb_test "p ctable1\[74\]" " = 74 'J'"
|
|
|
|
gdb_test "p ctable1\[75\]" " = 75 'K'"
|
|
|
|
gdb_test "p ctable1\[76\]" " = 76 'L'"
|
|
|
|
gdb_test "p ctable1\[77\]" " = 77 'M'"
|
|
|
|
gdb_test "p ctable1\[78\]" " = 78 'N'"
|
|
|
|
gdb_test "p ctable1\[79\]" " = 79 'O'"
|
|
|
|
gdb_test "p ctable1\[80\]" " = 80 'P'"
|
|
|
|
gdb_test "p ctable1\[81\]" " = 81 'Q'"
|
|
|
|
gdb_test "p ctable1\[82\]" " = 82 'R'"
|
|
|
|
gdb_test "p ctable1\[83\]" " = 83 'S'"
|
|
|
|
gdb_test "p ctable1\[84\]" " = 84 'T'"
|
|
|
|
gdb_test "p ctable1\[85\]" " = 85 'U'"
|
|
|
|
gdb_test "p ctable1\[86\]" " = 86 'V'"
|
|
|
|
gdb_test "p ctable1\[87\]" " = 87 'W'"
|
|
|
|
gdb_test "p ctable1\[88\]" " = 88 'X'"
|
|
|
|
gdb_test "p ctable1\[89\]" " = 89 'Y'"
|
|
|
|
gdb_test "p ctable1\[90\]" " = 90 'Z'"
|
|
|
|
gdb_test "p ctable1\[91\]" " = 91 '\\\['"
|
|
|
|
gdb_test "p ctable1\[92\]" " = 92 '\\\\\\\\'"
|
|
|
|
gdb_test "p ctable1\[93\]" " = 93 '\\\]'"
|
|
|
|
gdb_test "p ctable1\[94\]" " = 94 '\\^'"
|
|
|
|
gdb_test "p ctable1\[95\]" " = 95 '_'"
|
|
|
|
gdb_test "p ctable1\[96\]" " = 96 '`'"
|
|
|
|
gdb_test "p ctable1\[97\]" " = 97 'a'"
|
|
|
|
gdb_test "p ctable1\[98\]" " = 98 'b'"
|
|
|
|
gdb_test "p ctable1\[99\]" " = 99 'c'"
|
|
|
|
gdb_test "p ctable1\[100\]" " = 100 'd'"
|
|
|
|
gdb_test "p ctable1\[101\]" " = 101 'e'"
|
|
|
|
gdb_test "p ctable1\[102\]" " = 102 'f'"
|
|
|
|
gdb_test "p ctable1\[103\]" " = 103 'g'"
|
|
|
|
gdb_test "p ctable1\[104\]" " = 104 'h'"
|
|
|
|
gdb_test "p ctable1\[105\]" " = 105 'i'"
|
|
|
|
gdb_test "p ctable1\[106\]" " = 106 'j'"
|
|
|
|
gdb_test "p ctable1\[107\]" " = 107 'k'"
|
|
|
|
gdb_test "p ctable1\[108\]" " = 108 'l'"
|
|
|
|
gdb_test "p ctable1\[109\]" " = 109 'm'"
|
|
|
|
gdb_test "p ctable1\[110\]" " = 110 'n'"
|
|
|
|
gdb_test "p ctable1\[111\]" " = 111 'o'"
|
|
|
|
gdb_test "p ctable1\[112\]" " = 112 'p'"
|
|
|
|
gdb_test "p ctable1\[113\]" " = 113 'q'"
|
|
|
|
gdb_test "p ctable1\[114\]" " = 114 'r'"
|
|
|
|
gdb_test "p ctable1\[115\]" " = 115 's'"
|
|
|
|
gdb_test "p ctable1\[116\]" " = 116 't'"
|
|
|
|
gdb_test "p ctable1\[117\]" " = 117 'u'"
|
|
|
|
gdb_test "p ctable1\[118\]" " = 118 'v'"
|
|
|
|
gdb_test "p ctable1\[119\]" " = 119 'w'"
|
|
|
|
gdb_test "p ctable1\[120\]" " = 120 'x'"
|
|
|
|
gdb_test "p ctable1\[121\]" " = 121 'y'"
|
|
|
|
gdb_test "p ctable1\[122\]" " = 122 'z'"
|
|
|
|
gdb_test "p ctable1\[123\]" " = 123 '\[{\]+'"
|
|
|
|
gdb_test "p ctable1\[124\]" " = 124 '\[|\]+'"
|
|
|
|
gdb_test "p ctable1\[125\]" " = 125 '\[}\]+'"
|
|
|
|
gdb_test "p ctable1\[126\]" " = 126 '\[~\]'"
|
|
|
|
gdb_test "p ctable1\[127\]" " = 127 '\\\\177'"
|
|
|
|
gdb_test "p ctable1\[128\]" " = 128 '\\\\200'"
|
|
|
|
gdb_test "p ctable1\[129\]" " = 129 '\\\\201'"
|
|
|
|
gdb_test "p ctable1\[130\]" " = 130 '\\\\202'"
|
|
|
|
gdb_test "p ctable1\[131\]" " = 131 '\\\\203'"
|
|
|
|
gdb_test "p ctable1\[132\]" " = 132 '\\\\204'"
|
|
|
|
gdb_test "p ctable1\[133\]" " = 133 '\\\\205'"
|
|
|
|
gdb_test "p ctable1\[134\]" " = 134 '\\\\206'"
|
|
|
|
gdb_test "p ctable1\[135\]" " = 135 '\\\\207'"
|
|
|
|
gdb_test "p ctable1\[136\]" " = 136 '\\\\210'"
|
|
|
|
gdb_test "p ctable1\[137\]" " = 137 '\\\\211'"
|
|
|
|
gdb_test "p ctable1\[138\]" " = 138 '\\\\212'"
|
|
|
|
gdb_test "p ctable1\[139\]" " = 139 '\\\\213'"
|
|
|
|
gdb_test "p ctable1\[140\]" " = 140 '\\\\214'"
|
|
|
|
gdb_test "p ctable1\[141\]" " = 141 '\\\\215'"
|
|
|
|
gdb_test "p ctable1\[142\]" " = 142 '\\\\216'"
|
|
|
|
gdb_test "p ctable1\[143\]" " = 143 '\\\\217'"
|
|
|
|
gdb_test "p ctable1\[144\]" " = 144 '\\\\220'"
|
|
|
|
gdb_test "p ctable1\[145\]" " = 145 '\\\\221'"
|
|
|
|
gdb_test "p ctable1\[146\]" " = 146 '\\\\222'"
|
|
|
|
gdb_test "p ctable1\[147\]" " = 147 '\\\\223'"
|
|
|
|
gdb_test "p ctable1\[148\]" " = 148 '\\\\224'"
|
|
|
|
gdb_test "p ctable1\[149\]" " = 149 '\\\\225'"
|
|
|
|
gdb_test "p ctable1\[150\]" " = 150 '\\\\226'"
|
|
|
|
gdb_test "p ctable1\[151\]" " = 151 '\\\\227'"
|
|
|
|
gdb_test "p ctable1\[152\]" " = 152 '\\\\230'"
|
|
|
|
gdb_test "p ctable1\[153\]" " = 153 '\\\\231'"
|
|
|
|
gdb_test "p ctable1\[154\]" " = 154 '\\\\232'"
|
|
|
|
gdb_test "p ctable1\[155\]" " = 155 '\\\\233'"
|
|
|
|
gdb_test "p ctable1\[156\]" " = 156 '\\\\234'"
|
|
|
|
gdb_test "p ctable1\[157\]" " = 157 '\\\\235'"
|
|
|
|
gdb_test "p ctable1\[158\]" " = 158 '\\\\236'"
|
|
|
|
gdb_test "p ctable1\[159\]" " = 159 '\\\\237'"
|
|
|
|
gdb_test "p ctable1\[160\]" " = 160 '\\\\240'"
|
|
|
|
gdb_test "p ctable1\[161\]" " = 161 '\\\\241'"
|
|
|
|
gdb_test "p ctable1\[162\]" " = 162 '\\\\242'"
|
|
|
|
gdb_test "p ctable1\[163\]" " = 163 '\\\\243'"
|
|
|
|
gdb_test "p ctable1\[164\]" " = 164 '\\\\244'"
|
|
|
|
gdb_test "p ctable1\[165\]" " = 165 '\\\\245'"
|
|
|
|
gdb_test "p ctable1\[166\]" " = 166 '\\\\246'"
|
|
|
|
gdb_test "p ctable1\[167\]" " = 167 '\\\\247'"
|
|
|
|
gdb_test "p ctable1\[168\]" " = 168 '\\\\250'"
|
|
|
|
gdb_test "p ctable1\[169\]" " = 169 '\\\\251'"
|
|
|
|
gdb_test "p ctable1\[170\]" " = 170 '\\\\252'"
|
|
|
|
gdb_test "p ctable1\[171\]" " = 171 '\\\\253'"
|
|
|
|
gdb_test "p ctable1\[172\]" " = 172 '\\\\254'"
|
|
|
|
gdb_test "p ctable1\[173\]" " = 173 '\\\\255'"
|
|
|
|
gdb_test "p ctable1\[174\]" " = 174 '\\\\256'"
|
|
|
|
gdb_test "p ctable1\[175\]" " = 175 '\\\\257'"
|
|
|
|
gdb_test "p ctable1\[176\]" " = 176 '\\\\260'"
|
|
|
|
gdb_test "p ctable1\[177\]" " = 177 '\\\\261'"
|
|
|
|
gdb_test "p ctable1\[178\]" " = 178 '\\\\262'"
|
|
|
|
gdb_test "p ctable1\[179\]" " = 179 '\\\\263'"
|
|
|
|
gdb_test "p ctable1\[180\]" " = 180 '\\\\264'"
|
|
|
|
gdb_test "p ctable1\[181\]" " = 181 '\\\\265'"
|
|
|
|
gdb_test "p ctable1\[182\]" " = 182 '\\\\266'"
|
|
|
|
gdb_test "p ctable1\[183\]" " = 183 '\\\\267'"
|
|
|
|
gdb_test "p ctable1\[184\]" " = 184 '\\\\270'"
|
|
|
|
gdb_test "p ctable1\[185\]" " = 185 '\\\\271'"
|
|
|
|
gdb_test "p ctable1\[186\]" " = 186 '\\\\272'"
|
|
|
|
gdb_test "p ctable1\[187\]" " = 187 '\\\\273'"
|
|
|
|
gdb_test "p ctable1\[188\]" " = 188 '\\\\274'"
|
|
|
|
gdb_test "p ctable1\[189\]" " = 189 '\\\\275'"
|
|
|
|
gdb_test "p ctable1\[190\]" " = 190 '\\\\276'"
|
|
|
|
gdb_test "p ctable1\[191\]" " = 191 '\\\\277'"
|
|
|
|
gdb_test "p ctable1\[192\]" " = 192 '\\\\300'"
|
|
|
|
gdb_test "p ctable1\[193\]" " = 193 '\\\\301'"
|
|
|
|
gdb_test "p ctable1\[194\]" " = 194 '\\\\302'"
|
|
|
|
gdb_test "p ctable1\[195\]" " = 195 '\\\\303'"
|
|
|
|
gdb_test "p ctable1\[196\]" " = 196 '\\\\304'"
|
|
|
|
gdb_test "p ctable1\[197\]" " = 197 '\\\\305'"
|
|
|
|
gdb_test "p ctable1\[198\]" " = 198 '\\\\306'"
|
|
|
|
gdb_test "p ctable1\[199\]" " = 199 '\\\\307'"
|
|
|
|
gdb_test "p ctable1\[200\]" " = 200 '\\\\310'"
|
|
|
|
gdb_test "p ctable1\[201\]" " = 201 '\\\\311'"
|
|
|
|
gdb_test "p ctable1\[202\]" " = 202 '\\\\312'"
|
|
|
|
gdb_test "p ctable1\[203\]" " = 203 '\\\\313'"
|
|
|
|
gdb_test "p ctable1\[204\]" " = 204 '\\\\314'"
|
|
|
|
gdb_test "p ctable1\[205\]" " = 205 '\\\\315'"
|
|
|
|
gdb_test "p ctable1\[206\]" " = 206 '\\\\316'"
|
|
|
|
gdb_test "p ctable1\[207\]" " = 207 '\\\\317'"
|
|
|
|
gdb_test "p ctable1\[208\]" " = 208 '\\\\320'"
|
|
|
|
gdb_test "p ctable1\[209\]" " = 209 '\\\\321'"
|
|
|
|
gdb_test "p ctable1\[210\]" " = 210 '\\\\322'"
|
|
|
|
gdb_test "p ctable1\[211\]" " = 211 '\\\\323'"
|
|
|
|
gdb_test "p ctable1\[212\]" " = 212 '\\\\324'"
|
|
|
|
gdb_test "p ctable1\[213\]" " = 213 '\\\\325'"
|
|
|
|
gdb_test "p ctable1\[214\]" " = 214 '\\\\326'"
|
|
|
|
gdb_test "p ctable1\[215\]" " = 215 '\\\\327'"
|
|
|
|
gdb_test "p ctable1\[216\]" " = 216 '\\\\330'"
|
|
|
|
gdb_test "p ctable1\[217\]" " = 217 '\\\\331'"
|
|
|
|
gdb_test "p ctable1\[218\]" " = 218 '\\\\332'"
|
|
|
|
gdb_test "p ctable1\[219\]" " = 219 '\\\\333'"
|
|
|
|
gdb_test "p ctable1\[220\]" " = 220 '\\\\334'"
|
|
|
|
gdb_test "p ctable1\[221\]" " = 221 '\\\\335'"
|
|
|
|
gdb_test "p ctable1\[222\]" " = 222 '\\\\336'"
|
|
|
|
gdb_test "p ctable1\[223\]" " = 223 '\\\\337'"
|
|
|
|
gdb_test "p ctable1\[224\]" " = 224 '\\\\340'"
|
|
|
|
gdb_test "p ctable1\[225\]" " = 225 '\\\\341'"
|
|
|
|
gdb_test "p ctable1\[226\]" " = 226 '\\\\342'"
|
|
|
|
gdb_test "p ctable1\[227\]" " = 227 '\\\\343'"
|
|
|
|
gdb_test "p ctable1\[228\]" " = 228 '\\\\344'"
|
|
|
|
gdb_test "p ctable1\[229\]" " = 229 '\\\\345'"
|
|
|
|
gdb_test "p ctable1\[230\]" " = 230 '\\\\346'"
|
|
|
|
gdb_test "p ctable1\[231\]" " = 231 '\\\\347'"
|
|
|
|
gdb_test "p ctable1\[232\]" " = 232 '\\\\350'"
|
|
|
|
gdb_test "p ctable1\[233\]" " = 233 '\\\\351'"
|
|
|
|
gdb_test "p ctable1\[234\]" " = 234 '\\\\352'"
|
|
|
|
gdb_test "p ctable1\[235\]" " = 235 '\\\\353'"
|
|
|
|
gdb_test "p ctable1\[236\]" " = 236 '\\\\354'"
|
|
|
|
gdb_test "p ctable1\[237\]" " = 237 '\\\\355'"
|
|
|
|
gdb_test "p ctable1\[238\]" " = 238 '\\\\356'"
|
|
|
|
gdb_test "p ctable1\[239\]" " = 239 '\\\\357'"
|
|
|
|
gdb_test "p ctable1\[240\]" " = 240 '\\\\360'"
|
|
|
|
gdb_test "p ctable1\[241\]" " = 241 '\\\\361'"
|
|
|
|
gdb_test "p ctable1\[242\]" " = 242 '\\\\362'"
|
|
|
|
gdb_test "p ctable1\[243\]" " = 243 '\\\\363'"
|
|
|
|
gdb_test "p ctable1\[244\]" " = 244 '\\\\364'"
|
|
|
|
gdb_test "p ctable1\[245\]" " = 245 '\\\\365'"
|
|
|
|
gdb_test "p ctable1\[246\]" " = 246 '\\\\366'"
|
|
|
|
gdb_test "p ctable1\[247\]" " = 247 '\\\\367'"
|
|
|
|
gdb_test "p ctable1\[248\]" " = 248 '\\\\370'"
|
|
|
|
gdb_test "p ctable1\[249\]" " = 249 '\\\\371'"
|
|
|
|
gdb_test "p ctable1\[250\]" " = 250 '\\\\372'"
|
|
|
|
gdb_test "p ctable1\[251\]" " = 251 '\\\\373'"
|
|
|
|
gdb_test "p ctable1\[252\]" " = 252 '\\\\374'"
|
|
|
|
gdb_test "p ctable1\[253\]" " = 253 '\\\\375'"
|
|
|
|
gdb_test "p ctable1\[254\]" " = 254 '\\\\376'"
|
|
|
|
gdb_test "p ctable1\[255\]" " = 255 '\\\\377'"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Test interaction of the number of print elements to print and the
|
|
|
|
# repeat count, set to the default of 10.
|
|
|
|
|
|
|
|
proc test_print_repeats_10 {} {
|
|
|
|
global gdb_prompt
|
|
|
|
|
|
|
|
for { set x 1; } { $x <= 16 } { incr x; } {
|
1999-08-03 01:48:37 +02:00
|
|
|
gdb_test "set print elements $x" ""
|
1999-04-16 03:35:26 +02:00
|
|
|
for { set e 1; } { $e <= 16 } {incr e; } {
|
|
|
|
set v [expr $e - 1];
|
|
|
|
set command "p &ctable2\[${v}*16\]"
|
|
|
|
if { $x < $e } {
|
|
|
|
set aval $x;
|
|
|
|
} else {
|
|
|
|
set aval $e;
|
|
|
|
}
|
|
|
|
set xval [expr $x - $e];
|
|
|
|
if { $xval < 0 } {
|
|
|
|
set xval 0;
|
|
|
|
}
|
|
|
|
if { $aval > 10 } {
|
|
|
|
set a "'a' <repeats $aval times>";
|
|
|
|
if { $xval > 0 } {
|
|
|
|
set a "${a}, \\\"";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
set a "\\\"[string range "aaaaaaaaaaaaaaaa" 1 $aval]";
|
|
|
|
if { $xval > 10 } {
|
|
|
|
set a "$a\\\", ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
set xstr "";
|
|
|
|
if { $xval > 10 } {
|
|
|
|
set xstr "'X' <repeats $xval times>";
|
|
|
|
} else {
|
|
|
|
if { $xval > 0 } {
|
|
|
|
set xstr "[string range "XXXXXXXXXXXXXXXX" 1 $xval]\\\"";
|
|
|
|
} else {
|
|
|
|
if { $aval <= 10 } {
|
|
|
|
set xstr "\\\"";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if { $aval < 16 } {
|
|
|
|
set xstr "${xstr}\[.\]\[.\]\[.\]"
|
|
|
|
}
|
|
|
|
set string " = \[(\]unsigned char \[*\]\[)\] ${a}${xstr}";
|
|
|
|
gdb_test "$command" "$string" "$command with print elements set to $x";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
proc test_print_strings {} {
|
|
|
|
global gdb_prompt
|
|
|
|
|
|
|
|
# We accept "(unsigned char *) " before the string. char vs. unsigned char
|
|
|
|
# is already tested elsewhere.
|
|
|
|
|
|
|
|
# Test that setting print elements unlimited doesn't completely suppress
|
|
|
|
# printing; this was a bug in older gdb's.
|
1999-08-03 01:48:37 +02:00
|
|
|
gdb_test "set print elements 0" ""
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p teststring" \
|
|
|
|
" = (.unsigned char .. )?\"teststring contents\"" "p teststring with elements set to 0"
|
1999-08-03 01:48:37 +02:00
|
|
|
gdb_test "set print elements 1" ""
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p teststring" \
|
|
|
|
" = (.unsigned char .. )?\"t\"\\.\\.\\." "p teststring with elements set to 1"
|
1999-08-03 01:48:37 +02:00
|
|
|
gdb_test "set print elements 5" ""
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p teststring" \
|
|
|
|
" = (.unsigned char .. )?\"tests\"\\.\\.\\." "p teststring with elements set to 5"
|
1999-08-03 01:48:37 +02:00
|
|
|
gdb_test "set print elements 19" ""
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p teststring" \
|
|
|
|
" = (.unsigned char .. )?\"teststring contents\"" "p teststring with elements set to 19"
|
1999-08-03 01:48:37 +02:00
|
|
|
gdb_test "set print elements 20" ""
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p teststring" \
|
|
|
|
" = (.unsigned char .. )?\"teststring contents\"" "p teststring with elements set to 20"
|
|
|
|
|
1999-08-03 01:48:37 +02:00
|
|
|
gdb_test "set print elements 8" ""
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
gdb_test "p &ctable1\[0\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\""
|
|
|
|
gdb_test "p &ctable1\[1\]" \
|
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.
2009-03-21 00:04:40 +01:00
|
|
|
" = \\(unsigned char \\*\\) \"\\\\1\\\\2\\\\3\\\\4\\\\5\\\\6\\\\a\\\\b\"..."
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p &ctable1\[1*8\]" \
|
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.
2009-03-21 00:04:40 +01:00
|
|
|
" = \\(unsigned char \\*\\) \"\\\\b\\\\t\\\\n\\\\v\\\\f\\\\r\\\\16\\\\17\"..."
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p &ctable1\[2*8\]" \
|
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.
2009-03-21 00:04:40 +01:00
|
|
|
" = \\(unsigned char \\*\\) \"\\\\20\\\\21\\\\22\\\\23\\\\24\\\\25\\\\26\\\\27\"..."
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p &ctable1\[3*8\]" \
|
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.
2009-03-21 00:04:40 +01:00
|
|
|
" = \\(unsigned char \\*\\) \"\\\\30\\\\31\\\\32\\\\33\\\\34\\\\35\\\\36\\\\37\"..."
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p &ctable1\[4*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \" !\\\\\"#\\\$%&'\"..."
|
|
|
|
gdb_test "p &ctable1\[5*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\(\\)\\*\\+,-./\"..."
|
|
|
|
gdb_test "p &ctable1\[6*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"01234567\"..."
|
|
|
|
gdb_test "p &ctable1\[7*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"89:;<=>\\?\"..."
|
|
|
|
gdb_test "p &ctable1\[8*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"@ABCDEFG\"..."
|
|
|
|
gdb_test "p &ctable1\[9*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"HIJKLMNO\"..."
|
|
|
|
gdb_test "p &ctable1\[10*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"PQRSTUVW\"..."
|
|
|
|
gdb_test "p &ctable1\[11*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"XYZ\\\[\\\\\\\\\\\]\\^_\"..."
|
|
|
|
gdb_test "p &ctable1\[12*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"`abcdefg\"..."
|
|
|
|
gdb_test "p &ctable1\[13*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"hijklmno\"..."
|
|
|
|
gdb_test "p &ctable1\[14*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"pqrstuvw\"..."
|
|
|
|
gdb_test "p &ctable1\[15*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"xyz\[{|}\]+\\~\\\\177\"..."
|
|
|
|
gdb_test "p &ctable1\[16*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\200\\\\201\\\\202\\\\203\\\\204\\\\205\\\\206\\\\207\"..."
|
|
|
|
gdb_test "p &ctable1\[17*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\210\\\\211\\\\212\\\\213\\\\214\\\\215\\\\216\\\\217\"..."
|
|
|
|
gdb_test "p &ctable1\[18*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\220\\\\221\\\\222\\\\223\\\\224\\\\225\\\\226\\\\227\"..."
|
|
|
|
gdb_test "p &ctable1\[19*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\230\\\\231\\\\232\\\\233\\\\234\\\\235\\\\236\\\\237\"..."
|
|
|
|
gdb_test "p &ctable1\[20*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\240\\\\241\\\\242\\\\243\\\\244\\\\245\\\\246\\\\247\"..."
|
|
|
|
gdb_test "p &ctable1\[21*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\250\\\\251\\\\252\\\\253\\\\254\\\\255\\\\256\\\\257\"..."
|
|
|
|
gdb_test "p &ctable1\[22*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\260\\\\261\\\\262\\\\263\\\\264\\\\265\\\\266\\\\267\"..."
|
|
|
|
gdb_test "p &ctable1\[23*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\270\\\\271\\\\272\\\\273\\\\274\\\\275\\\\276\\\\277\"..."
|
|
|
|
gdb_test "p &ctable1\[24*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\300\\\\301\\\\302\\\\303\\\\304\\\\305\\\\306\\\\307\"..."
|
|
|
|
gdb_test "p &ctable1\[25*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\310\\\\311\\\\312\\\\313\\\\314\\\\315\\\\316\\\\317\"..."
|
|
|
|
gdb_test "p &ctable1\[26*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\320\\\\321\\\\322\\\\323\\\\324\\\\325\\\\326\\\\327\"..."
|
|
|
|
gdb_test "p &ctable1\[27*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\330\\\\331\\\\332\\\\333\\\\334\\\\335\\\\336\\\\337\"..."
|
|
|
|
gdb_test "p &ctable1\[28*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\340\\\\341\\\\342\\\\343\\\\344\\\\345\\\\346\\\\347\"..."
|
|
|
|
gdb_test "p &ctable1\[29*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\350\\\\351\\\\352\\\\353\\\\354\\\\355\\\\356\\\\357\"..."
|
|
|
|
gdb_test "p &ctable1\[30*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\360\\\\361\\\\362\\\\363\\\\364\\\\365\\\\366\\\\367\"..."
|
|
|
|
gdb_test "p &ctable1\[31*8\]" \
|
|
|
|
" = \\(unsigned char \\*\\) \"\\\\370\\\\371\\\\372\\\\373\\\\374\\\\375\\\\376\\\\377\"..."
|
|
|
|
}
|
|
|
|
|
|
|
|
proc test_print_int_arrays {} {
|
|
|
|
global gdb_prompt
|
|
|
|
|
1999-08-03 01:48:37 +02:00
|
|
|
gdb_test "set print elements 24" ""
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2000-11-14 03:36:22 +01:00
|
|
|
gdb_test_escape_braces "p int1dim" \
|
1999-04-16 03:35:26 +02:00
|
|
|
" = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}"
|
2000-11-14 03:36:22 +01:00
|
|
|
gdb_test_escape_braces "p int2dim" \
|
1999-04-16 03:35:26 +02:00
|
|
|
" = {{0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11}}"
|
2000-11-14 03:36:22 +01:00
|
|
|
gdb_test_escape_braces "p int3dim" \
|
1999-04-16 03:35:26 +02:00
|
|
|
" = {{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}"
|
2000-11-14 03:36:22 +01:00
|
|
|
gdb_test_escape_braces "p int4dim" \
|
1999-04-16 03:35:26 +02:00
|
|
|
" = {{{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}}"
|
|
|
|
}
|
|
|
|
|
2000-03-14 18:01:05 +01:00
|
|
|
proc test_print_typedef_arrays {} {
|
|
|
|
global gdb_prompt
|
|
|
|
|
|
|
|
gdb_test "set print elements 24" ""
|
|
|
|
|
2000-11-14 03:36:22 +01:00
|
|
|
gdb_test_escape_braces "p a1" \
|
2000-03-14 18:01:05 +01:00
|
|
|
" = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}"
|
|
|
|
gdb_test "p a1\[0\]" " = 2"
|
|
|
|
gdb_test "p a1\[9\]" " = 20"
|
|
|
|
|
|
|
|
gdb_test "p a2" \
|
|
|
|
" = \"abcd\""
|
|
|
|
gdb_test "p a2\[0\]" " = 97 'a'"
|
|
|
|
gdb_test "p a2\[3\]" " = 100 'd'"
|
|
|
|
}
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
proc test_artificial_arrays {} {
|
|
|
|
# Send \026@ instead of just @ in case the kill character is @.
|
2000-11-14 03:36:22 +01:00
|
|
|
gdb_test_escape_braces "p int1dim\[0\]\026@2" " = {0, 1}" {p int1dim[0]@2}
|
|
|
|
gdb_test_escape_braces "p int1dim\[0\]\026@2\026@3" \
|
1999-04-16 03:35:26 +02:00
|
|
|
"({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \
|
|
|
|
{p int1dim[0]@2@3}
|
2000-11-14 03:36:22 +01:00
|
|
|
gdb_test_escape_braces {p/x (short [])0x12345678} \
|
1999-04-16 03:35:26 +02:00
|
|
|
" = ({0x1234, 0x5678}|{0x5678, 0x1234})"
|
|
|
|
}
|
|
|
|
|
|
|
|
proc test_print_char_arrays {} {
|
|
|
|
global gdb_prompt
|
|
|
|
global hex
|
|
|
|
|
1999-08-03 01:48:37 +02:00
|
|
|
gdb_test "set print elements 24" ""
|
|
|
|
gdb_test "set print address on" ""
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
gdb_test "p arrays" \
|
2007-09-05 02:51:49 +02:00
|
|
|
" = {array1 = \"abc\", array2 = \"d\", array3 = \"e\", array4 = \"fg\", array5 = \"hij\"}"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
gdb_test "p parrays" " = \\(struct some_arrays \\*\\) $hex"
|
2007-09-05 02:51:49 +02:00
|
|
|
gdb_test "p parrays->array1" " = \"abc\""
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p &parrays->array1" " = \\(unsigned char \\(\\*\\)\\\[4\\\]\\) $hex"
|
2007-09-05 02:51:49 +02:00
|
|
|
gdb_test "p parrays->array2" " = \"d\""
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p &parrays->array2" " = \\(unsigned char \\(\\*\\)\\\[1\\\]\\) $hex"
|
2007-09-05 02:51:49 +02:00
|
|
|
gdb_test "p parrays->array3" " = \"e\""
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p &parrays->array3" " = \\(unsigned char \\(\\*\\)\\\[1\\\]\\) $hex"
|
2007-09-05 02:51:49 +02:00
|
|
|
gdb_test "p parrays->array4" " = \"fg\""
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p &parrays->array4" " = \\(unsigned char \\(\\*\\)\\\[2\\\]\\) $hex"
|
2007-09-05 02:51:49 +02:00
|
|
|
gdb_test "p parrays->array5" " = \"hij\""
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p &parrays->array5" " = \\(unsigned char \\(\\*\\)\\\[4\\\]\\) $hex"
|
|
|
|
|
1999-08-03 01:48:37 +02:00
|
|
|
gdb_test "set print address off" ""
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
proc test_print_string_constants {} {
|
|
|
|
global gdb_prompt
|
|
|
|
|
1999-08-03 01:48:37 +02:00
|
|
|
gdb_test "set print elements 50" ""
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
if [target_info exists gdb,cannot_call_functions] {
|
|
|
|
setup_xfail "*-*-*" 2416
|
|
|
|
fail "This target can not call functions"
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
1999-07-07 19:31:57 +02:00
|
|
|
# We need to up this because this can be really slow on some boards.
|
|
|
|
# (Test may involve inferior malloc() calls).
|
|
|
|
set timeout 60;
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p \"a string\"" " = \"a string\""
|
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.
2009-03-21 00:04:40 +01:00
|
|
|
gdb_test "p \"embedded \\000 null\"" " = \"embedded \\\\0 null\""
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "p \"abcd\"\[2\]" " = 99 'c'"
|
|
|
|
gdb_test "p sizeof (\"abcdef\")" " = 7"
|
|
|
|
gdb_test "ptype \"foo\"" " = char \\\[4\\\]"
|
|
|
|
gdb_test "p *\"foo\"" " = 102 'f'"
|
|
|
|
gdb_test "ptype *\"foo\"" " = char"
|
|
|
|
gdb_test "p &*\"foo\"" " = \"foo\""
|
2003-01-14 05:34:46 +01:00
|
|
|
setup_kfail "gdb/538" *-*-*
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "ptype &*\"foo\"" "type = char \\*"
|
|
|
|
gdb_test "p (char *)\"foo\"" " = \"foo\""
|
|
|
|
}
|
|
|
|
|
|
|
|
proc test_print_array_constants {} {
|
|
|
|
|
|
|
|
if [target_info exists gdb,cannot_call_functions] {
|
|
|
|
setup_xfail "*-*-*" 2416
|
|
|
|
fail "This target can not call functions"
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
1999-07-07 19:31:57 +02:00
|
|
|
# We need to up this because this can be really slow on some boards.
|
|
|
|
# (Test may involve inferior malloc() calls).
|
|
|
|
set timeout 60;
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "print {'a','b','c'}" " = \"abc\""
|
2000-11-14 03:36:22 +01:00
|
|
|
gdb_test_escape_braces "print {0,1,2}" " = {0, 1, 2}"
|
|
|
|
gdb_test_escape_braces "print {(long)0,(long)1,(long)2}" " = {0, 1, 2}"
|
|
|
|
gdb_test_escape_braces "print {{0,1,2},{3,4,5}}" " = {{0, 1, 2}, {3, 4, 5}}"
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "print {4,5,6}\[2\]" " = 6"
|
2008-03-21 16:02:38 +01:00
|
|
|
gdb_test "print *&{4,5,6}\[1\]" "Attempt to take address of value not located in memory."
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
proc test_printf {} {
|
|
|
|
gdb_test "printf \"x=%d,y=%d,z=%d\\n\", 5, 6, 7" "x=5,y=6,z=7"
|
|
|
|
gdb_test "printf \"string=%.4sxx\\n\", teststring" "string=testxx"
|
|
|
|
gdb_test "printf \"string=%sxx\\n\", teststring" \
|
|
|
|
"string=teststring contentsxx"
|
|
|
|
|
|
|
|
gdb_test "printf \"%f is fun\\n\", 1.0" "1\.0+ is fun"
|
|
|
|
|
|
|
|
# Test mixing args of different sizes.
|
|
|
|
gdb_test "printf \"x=%d,y=%f,z=%d\\n\", 5, 6.0, 7" "x=5,y=6\.0+,z=7"
|
|
|
|
gdb_test "printf \"%x %f, %c %x, %x, %f\\n\", 0xbad, -99.541, 'z',\
|
|
|
|
0xfeedface, 0xdeadbeef, 5.0" "bad -99.54\[0-9\]+, z feedface, deadbeef, 5.0+"
|
|
|
|
}
|
|
|
|
|
2007-11-05 12:32:31 +01:00
|
|
|
#Test printing DFP values with printf
|
|
|
|
proc test_printf_with_dfp {} {
|
|
|
|
|
|
|
|
# Test various dfp values, covering 32-bit, 64-bit and 128-bit ones
|
|
|
|
|
|
|
|
# _Decimal32 constants, which can support up to 7 digits
|
2008-01-09 14:47:59 +01:00
|
|
|
gdb_test "printf \"%Hf\\n\",1.2df" "1.2"
|
|
|
|
gdb_test "printf \"%Hf\\n\",-1.2df" "-1.2"
|
|
|
|
gdb_test "printf \"%Hf\\n\",1.234567df" "1.234567"
|
|
|
|
gdb_test "printf \"%Hf\\n\",-1.234567df" "-1.234567"
|
|
|
|
gdb_test "printf \"%Hf\\n\",1234567.df" "1234567"
|
|
|
|
gdb_test "printf \"%Hf\\n\",-1234567.df" "-1234567"
|
2007-11-05 12:32:31 +01:00
|
|
|
|
2008-01-09 14:47:59 +01:00
|
|
|
gdb_test "printf \"%Hf\\n\",1.2E1df" "12"
|
|
|
|
gdb_test "printf \"%Hf\\n\",1.2E10df" "1.2E\\+10"
|
|
|
|
gdb_test "printf \"%Hf\\n\",1.2E-10df" "1.2E-10"
|
2007-11-05 12:32:31 +01:00
|
|
|
|
|
|
|
# The largest exponent for 32-bit dfp value is 96.
|
2008-01-09 14:47:59 +01:00
|
|
|
gdb_test "printf \"%Hf\\n\",1.2E96df" "1.200000E\\+96"
|
2007-11-05 12:32:31 +01:00
|
|
|
|
|
|
|
# _Decimal64 constants, which can support up to 16 digits
|
2008-01-09 14:47:59 +01:00
|
|
|
gdb_test "printf \"%Df\\n\",1.2dd" "1.2"
|
|
|
|
gdb_test "printf \"%Df\\n\",-1.2dd" "-1.2"
|
|
|
|
gdb_test "printf \"%Df\\n\",1.234567890123456dd" "1.234567890123456"
|
|
|
|
gdb_test "printf \"%Df\\n\",-1.234567890123456dd" "-1.234567890123456"
|
|
|
|
gdb_test "printf \"%Df\\n\",1234567890123456.dd" "1234567890123456"
|
|
|
|
gdb_test "printf \"%Df\\n\",-1234567890123456.dd" "-1234567890123456"
|
2007-11-05 12:32:31 +01:00
|
|
|
|
2008-01-09 14:47:59 +01:00
|
|
|
gdb_test "printf \"%Df\\n\",1.2E1dd" "12"
|
|
|
|
gdb_test "printf \"%Df\\n\",1.2E10dd" "1.2E\\+10"
|
|
|
|
gdb_test "printf \"%Df\\n\",1.2E-10dd" "1.2E-10"
|
2007-11-05 12:32:31 +01:00
|
|
|
|
|
|
|
# The largest exponent for 64-bit dfp value is 384.
|
2008-01-09 14:47:59 +01:00
|
|
|
gdb_test "printf \"%Df\\n\",1.2E384dd" "1.200000000000000E\\+384"
|
2007-11-05 12:32:31 +01:00
|
|
|
|
|
|
|
# _Decimal128 constants, which can support up to 34 digits
|
2008-01-09 14:47:59 +01:00
|
|
|
gdb_test "printf \"%DDf\\n\",1.2dl" "1.2"
|
|
|
|
gdb_test "printf \"%DDf\\n\",-1.2dl" "-1.2"
|
|
|
|
gdb_test "printf \"%DDf\\n\",1.234567890123456789012345678901234dl" "1.234567890123456789012345678901234"
|
|
|
|
gdb_test "printf \"%DDf\\n\",-1.234567890123456789012345678901234dl" "-1.234567890123456789012345678901234"
|
|
|
|
gdb_test "printf \"%DDf\\n\",1234567890123456789012345678901234.dl" "1234567890123456789012345678901234"
|
|
|
|
gdb_test "printf \"%DDf\\n\",-1234567890123456789012345678901234.dl" "-1234567890123456789012345678901234"
|
2007-11-05 12:32:31 +01:00
|
|
|
|
2008-01-09 14:47:59 +01:00
|
|
|
gdb_test "printf \"%DDf\\n\",1.2E1dl" "12"
|
|
|
|
gdb_test "printf \"%DDf\\n\",1.2E10dl" "1.2E\\+10"
|
|
|
|
gdb_test "printf \"%DDf\\n\",1.2E-10dl" "1.2E-10"
|
2007-11-05 12:32:31 +01:00
|
|
|
|
|
|
|
# The largest exponent for 128-bit dfp value is 6144.
|
2008-01-09 14:47:59 +01:00
|
|
|
gdb_test "printf \"%DDf\\n\",1.2E6144dl" "1.200000000000000000000000000000000E\\+6144"
|
2007-11-05 12:32:31 +01:00
|
|
|
}
|
|
|
|
|
2000-11-14 03:36:22 +01:00
|
|
|
# Escape a left curly brace to prevent it from being interpreted as
|
|
|
|
# the beginning of a bound
|
|
|
|
proc gdb_test_escape_braces { args } {
|
|
|
|
|
|
|
|
set pattern [lindex $args 1]
|
|
|
|
regsub -all {\{[0-9]} $pattern {\\&} esc_pattern
|
|
|
|
gdb_test [lindex $args 0] $esc_pattern [lindex $args 2]
|
|
|
|
}
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
# Start with a fresh gdb.
|
|
|
|
|
|
|
|
gdb_exit
|
|
|
|
gdb_start
|
|
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
|
|
|
|
|
|
|
gdb_test "print \$pc" "No registers\\."
|
2008-03-21 16:02:38 +01:00
|
|
|
|
|
|
|
# Some simple operations on strings should work even without a target
|
|
|
|
# (and therefore without calling malloc).
|
|
|
|
gdb_test "print \"abc\"" " = \"abc\""
|
|
|
|
gdb_test "print sizeof (\"abc\")" " = 4"
|
|
|
|
gdb_test "ptype \"abc\"" " = char \\\[4\\\]"
|
|
|
|
gdb_test "print \$cvar = \"abc\"" " = \"abc\""
|
|
|
|
gdb_test "print sizeof (\$cvar)" " = 4"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
gdb_load ${binfile}
|
|
|
|
|
2008-03-21 16:02:38 +01:00
|
|
|
gdb_test "print \$pc" "No registers\\." "print \$pc (with file)"
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "set print sevenbit-strings" ""
|
1999-08-03 01:48:37 +02:00
|
|
|
gdb_test "set print address off" ""
|
1999-04-16 03:35:26 +02:00
|
|
|
gdb_test "set width 0" ""
|
|
|
|
|
|
|
|
if [set_lang_c] then {
|
|
|
|
gdb_test "p ctable1\[120\]" "120 'x'" "p ctable1\[120\] #1"
|
|
|
|
|
|
|
|
if [runto_main] then {
|
|
|
|
test_integer_literals_accepted
|
|
|
|
test_integer_literals_rejected
|
|
|
|
test_character_literals_accepted
|
|
|
|
test_print_all_chars
|
|
|
|
test_print_repeats_10
|
|
|
|
test_print_strings
|
|
|
|
test_print_int_arrays
|
2000-03-14 18:01:05 +01:00
|
|
|
test_print_typedef_arrays
|
1999-04-16 03:35:26 +02:00
|
|
|
test_artificial_arrays
|
|
|
|
test_print_char_arrays
|
|
|
|
# We used to do the runto main here.
|
|
|
|
test_print_string_constants
|
|
|
|
test_print_array_constants
|
|
|
|
test_printf
|
2007-11-05 12:32:31 +01:00
|
|
|
test_printf_with_dfp
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
fail "C print command tests suppressed"
|
|
|
|
}
|