1999-04-16 03:35:26 +02:00
|
|
|
|
/* Modula 2 language support routines for GDB, the GNU debugger.
|
2005-01-29 01:11:12 +01:00
|
|
|
|
|
2007-01-09 18:59:20 +01:00
|
|
|
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2002, 2003, 2004,
|
2011-01-01 16:34:07 +01:00
|
|
|
|
2005, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
|
This file is part of GDB.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
1999-07-07 22:19:36 +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:08:50 +02:00
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
1999-07-07 22:19:36 +02:00
|
|
|
|
(at your option) any later version.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
1999-07-07 22:19:36 +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.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-23 20:08:50 +02:00
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "symtab.h"
|
|
|
|
|
#include "gdbtypes.h"
|
|
|
|
|
#include "expression.h"
|
|
|
|
|
#include "parser-defs.h"
|
|
|
|
|
#include "language.h"
|
|
|
|
|
#include "m2-lang.h"
|
|
|
|
|
#include "c-lang.h"
|
2000-02-08 05:39:02 +01:00
|
|
|
|
#include "valprint.h"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
|
extern void _initialize_m2_language (void);
|
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
|
|
|
|
static void m2_printchar (int, struct type *, struct ui_file *);
|
|
|
|
|
static void m2_emit_char (int, struct type *, struct ui_file *, int);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
/* Print the character C on STREAM as part of the contents of a literal
|
|
|
|
|
string whose delimiter is QUOTER. Note that that format for printing
|
|
|
|
|
characters and strings is language specific.
|
|
|
|
|
FIXME: This is a copy of the same function from c-exp.y. It should
|
2007-10-16 19:36:51 +02:00
|
|
|
|
be replaced with a true Modula version. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
static void
|
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
|
|
|
|
m2_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
|
2011-01-09 04:20:33 +01:00
|
|
|
|
c &= 0xFF; /* Avoid sign bit follies. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
if (PRINT_LITERAL_FORM (c))
|
|
|
|
|
{
|
|
|
|
|
if (c == '\\' || c == quoter)
|
|
|
|
|
{
|
|
|
|
|
fputs_filtered ("\\", stream);
|
|
|
|
|
}
|
|
|
|
|
fprintf_filtered (stream, "%c", c);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switch (c)
|
|
|
|
|
{
|
|
|
|
|
case '\n':
|
|
|
|
|
fputs_filtered ("\\n", stream);
|
|
|
|
|
break;
|
|
|
|
|
case '\b':
|
|
|
|
|
fputs_filtered ("\\b", stream);
|
|
|
|
|
break;
|
|
|
|
|
case '\t':
|
|
|
|
|
fputs_filtered ("\\t", stream);
|
|
|
|
|
break;
|
|
|
|
|
case '\f':
|
|
|
|
|
fputs_filtered ("\\f", stream);
|
|
|
|
|
break;
|
|
|
|
|
case '\r':
|
|
|
|
|
fputs_filtered ("\\r", stream);
|
|
|
|
|
break;
|
|
|
|
|
case '\033':
|
|
|
|
|
fputs_filtered ("\\e", stream);
|
|
|
|
|
break;
|
|
|
|
|
case '\007':
|
|
|
|
|
fputs_filtered ("\\a", stream);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* FIXME: This is a copy of the same function from c-exp.y. It should
|
2007-10-16 19:36:51 +02:00
|
|
|
|
be replaced with a true Modula version. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
static void
|
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
|
|
|
|
m2_printchar (int c, struct type *type, struct ui_file *stream)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
fputs_filtered ("'", stream);
|
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
|
|
|
|
LA_EMIT_CHAR (c, type, stream, '\'');
|
1999-04-16 03:35:26 +02:00
|
|
|
|
fputs_filtered ("'", stream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print the character string STRING, printing at most LENGTH characters.
|
|
|
|
|
Printing stops early if the number hits print_max; repeat counts
|
|
|
|
|
are printed as appropriate. Print ellipses at the end if we
|
|
|
|
|
had to stop before printing LENGTH characters, or if FORCE_ELLIPSES.
|
|
|
|
|
FIXME: This is a copy of the same function from c-exp.y. It should
|
2007-10-16 19:36:51 +02:00
|
|
|
|
be replaced with a true Modula version. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
static void
|
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
|
|
|
|
m2_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
|
2010-01-14 09:03:37 +01:00
|
|
|
|
unsigned int length, const char *encoding, int force_ellipses,
|
gdb
* varobj.c (value_get_print_value): Include valprint.h.
(value_get_print_value): Use get_formatted_print_options.
* value.h (struct value_print_options): Declare.
(value_print, val_print, common_val_print, val_print_string):
Update.
* value.c: Include valprint.h.
(show_values): Use get_user_print_options.
(show_convenience): Likewise.
* valprint.h (prettyprint_arrays, prettyprint_structs): Don't
declare.
(struct value_print_options): New type.
(vtblprint, unionprint, addressprint, objectprint, print_max,
inspect_it, repeat_count_threshold, output_format,
stop_print_at_null): Don't declare.
(user_print_options, get_user_print_options,
get_raw_print_options, get_formatted_print_options): Declare.
(print_array_indexes_p): Don't declare.
(maybe_print_array_index, val_print_array_elements): Update.
* valprint.c (print_max): Remove.
(user_print_options): New global.
(get_user_print_options, get_raw_print_options,
get_formatted_print_options): New functions.
(print_array_indexes, repeat_count_threshold, stop_print_at_null,
prettyprint_structs, prettyprint_arrays, unionprint,
addressprint): Remove.
(val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(common_val_print): Likewise.
(print_array_indexes_p): Remove.
(maybe_print_array_index): Remove format, pretty arguments; add
options. Update.
(val_print_array_elements): Remove format, deref_ref, pretty
arguments; add options. Update.
(val_print_string): Add options argument. Update.
(_initialize_valprint): Use user_print_options.
(output_format): Remove.
(set_output_radix_1): Use user_print_options.
* typeprint.c: Include valprint.h.
(objectprint): Don't declare.
(whatis_exp): Use get_user_print_options.
* tui/tui-regs.c: Include valprint.h.
(tui_register_format): Use get_formatted_print_options.
* tracepoint.c: Include valprint.h.
(addressprint): Don't declare.
(trace_mention): Use get_user_print_options.
(tracepoints_info): Likewise.
* stack.c (print_frame_args): Use get_raw_print_options.
(print_frame_info): Use get_user_print_options.
(print_frame): Likewise.
* sh64-tdep.c: Include valprint.h
(sh64_do_register): Use get_formatted_print_options.
* scm-valprint.c (scm_inferior_print): Remove format, deref_ref,
pretty arguments; add options.
(scm_scmlist_print): Likewise. Update.
(scm_scmval_print): Likewise.
(scm_val_print): Likewise.
(scm_value_print): Remove format, pretty arguments; add options.
Update.
* scm-lang.h (scm_value_print, scm_val_print, scm_scmval_print):
Update.
* scm-lang.c (scm_printstr): Add options argument.
* python/python-value.c: Include valprint.h.
(valpy_str): Use get_user_print_options.
* printcmd.c: Include valprint.h.
(addressprint): Don't declare.
(inspect_it): Remove.
(print_formatted): Remove format option; add options. Update.
(print_scalar_formatted): Likewise.
(print_address_demangle): Use get_user_print_options.
(do_examine): Use get_formatted_print_options.
(print_command_1): Likewise.
(output_command): Use get_formatted_print_options.
(do_one_display): Likewise.
(print_variable_value): Use get_user_print_options.
* p-valprint.c (pascal_val_print): Remove format, deref_ref,
pretty arguments; add options. Update.
(pascal_value_print): Remove format, pretty arguments; add
options. Update.
(vtblprint, objectprint): Don't declare.
(pascal_static_field_print): Remove.
(pascal_object_print_value_fields): Remove format, pretty
arguments; add options. Update.
(pascal_object_print_static_field): Likewise.
(_initialize_pascal_valprint): Use user_print_options. Update.
* p-lang.h (pascal_val_print, pascal_value_print,
pascal_printstr, pascal_object_print_value_fields): Update.
(vtblprint, static_field_print): Don't declare.
* p-lang.c (pascal_printstr): Add options argument. Update.
* objc-lang.c (objc_printstr): Add options argument. Update.
* mt-tdep.c: Include valprint.h.
(mt_registers_info): Use get_raw_print_options.
* mips-tdep.c: Include valprint.h.
(mips_print_fp_register): Use get_formatted_print_options.
(mips_print_register): Likewise.
* mi/mi-main.c: Include valprint.h.
(get_register): Use get_user_print_options.
(mi_cmd_data_evaluate_expression): Likewise.
(mi_cmd_data_read_memory): Use get_formatted_print_options.
* mi/mi-cmd-stack.c: Include valprint.h.
(list_args_or_locals): Use get_raw_print_options.
* m2-valprint.c (print_function_pointer_address): Add addressprint
argument.
(m2_print_long_set): Remove format, pretty arguments.
(m2_print_unbounded_array): Remove format, deref_ref, pretty
arguments; add options. Update.
(print_unpacked_pointer): Remove format argument; add options.
Now static. Update.
(print_variable_at_address): Remove format, deref_ref, pretty
arguments; add options. Update.
(m2_print_array_contents): Likewise.
(m2_val_print): Likewise.
* m2-lang.h (m2_val_print): Update.
* m2-lang.c (m2_printstr): Add options argument. Update.
* language.h (struct value_print_options): Declare.
(struct language_defn) <la_printstr>: Add options argument.
<la_val_print>: Remove format, deref_ref, pretty argument; add
options.
<la_value_print>: Remove format, pretty arguments; add options.
<la_print_array_index>: Likewise.
(LA_VAL_PRINT, LA_VALUE_PRINT, LA_PRINT_STRING,
LA_PRINT_ARRAY_INDEX): Update.
(default_print_array_index): Update.
* language.c (default_print_array_index): Remove format, pretty
arguments; add options. Update.
(unk_lang_printstr): Add options argument.
(unk_lang_val_print): Remove format, deref_ref, pretty arguments;
add options.
(unk_lang_value_print): Remove format, pretty arguments; add
options.
* jv-valprint.c (java_value_print): Remove format, pretty
arguments; add options. Update.
(java_print_value_fields): Likewise.
(java_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
* jv-lang.h (java_val_print, java_value_print): Declare.
* infcmd.c: Include valprint.h.
(print_return_value): Use get_raw_print_options.
(default_print_registers_info): Use get_user_print_options,
get_formatted_print_options.
(registers_info): Use get_formatted_print_options.
* gdbtypes.h (struct value_print_options): Declare.
(print_scalar_formatted): Update.
* f-valprint.c (f77_print_array_1): Remove format, deref_ref,
pretty arguments; add options. Update.
(f77_print_array): Likewise.
(f_val_print): Likewise.
* f-lang.h (f_val_print): Update.
* f-lang.c (f_printstr): Add options argument. Update.
(c_value_print): Update declaration.
* expprint.c: Include valprint.h.
(print_subexp_standard): Use get_raw_print_options,
get_user_print_options.
* eval.c: Include valprint.h.
(objectprint): Don't declare.
(evaluate_subexp_standard): Use get_user_print_options.
* cp-valprint.c (vtblprint, objectprint, static_field_print):
Remove.
(cp_print_value_fields): Remove format, pretty arguments; add
options. Update.
(cp_print_value): Likewise.
(cp_print_static_field): Likewise.
(_initialize_cp_valprint): Use user_print_options. Update.
* c-valprint.c (print_function_pointer_address): Add addressprint
argument.
(c_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(c_value_print): Add options argument. Update.
* c-lang.h (c_val_print, c_value_print, c_printstr): Update.
(vtblprint, static_field_print): Don't declare.
(cp_print_value_fields): Update.
* c-lang.c (c_printstr): Add options argument. Update.
* breakpoint.c: Include valprint.h.
(addressprint): Don't declare.
(watchpoint_value_print): Use get_user_print_options.
(print_one_breakpoint_location): Likewise.
(breakpoint_1, print_it_catch_fork, print_it_catch_vfork, mention,
print_exception_catchpoint): Likewise.
* auxv.c (fprint_target_auxv): Don't declare addressprint. Use
get_user_print_options.
* ada-valprint.c (struct ada_val_print_args): Remove format,
deref_ref, and pretty; add options.
(print_optional_low_bound): Add options argument.
(val_print_packed_array_elements): Remove format and pretty
arguments; add options. Update.
(printstr): Add options argument. Update.
(ada_printstr): Likewise.
(ada_val_print): Remove format, deref_ref, pretty arguments; add
options argument. Update.
(ada_val_print_stub): Update.
(ada_val_print_array): Remove format, deref_ref, pretty arguments;
add options. Update.
(ada_val_print_1): Likewise.
(print_variant_part): Likewise.
(ada_value_print): Remove format, pretty arguments; add options.
Update.
(print_record): Likewise.
(print_field_values): Likewise.
* ada-lang.h (ada_val_print, ada_value_print, ada_printstr):
Update.
* ada-lang.c (ada_print_array_index): Add options argument; remove
format and pretty arguments.
(print_one_exception): Use get_user_print_options.
gdb/testsuite
* gdb.base/exprs.exp (test_expr): Add enum formatting tests.
2008-10-28 18:19:58 +01:00
|
|
|
|
const struct value_print_options *options)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
2003-09-09 10:05:43 +02:00
|
|
|
|
unsigned int i;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
unsigned int things_printed = 0;
|
|
|
|
|
int in_quotes = 0;
|
|
|
|
|
int need_comma = 0;
|
|
|
|
|
|
|
|
|
|
if (length == 0)
|
|
|
|
|
{
|
|
|
|
|
fputs_filtered ("\"\"", gdb_stdout);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
gdb
* varobj.c (value_get_print_value): Include valprint.h.
(value_get_print_value): Use get_formatted_print_options.
* value.h (struct value_print_options): Declare.
(value_print, val_print, common_val_print, val_print_string):
Update.
* value.c: Include valprint.h.
(show_values): Use get_user_print_options.
(show_convenience): Likewise.
* valprint.h (prettyprint_arrays, prettyprint_structs): Don't
declare.
(struct value_print_options): New type.
(vtblprint, unionprint, addressprint, objectprint, print_max,
inspect_it, repeat_count_threshold, output_format,
stop_print_at_null): Don't declare.
(user_print_options, get_user_print_options,
get_raw_print_options, get_formatted_print_options): Declare.
(print_array_indexes_p): Don't declare.
(maybe_print_array_index, val_print_array_elements): Update.
* valprint.c (print_max): Remove.
(user_print_options): New global.
(get_user_print_options, get_raw_print_options,
get_formatted_print_options): New functions.
(print_array_indexes, repeat_count_threshold, stop_print_at_null,
prettyprint_structs, prettyprint_arrays, unionprint,
addressprint): Remove.
(val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(common_val_print): Likewise.
(print_array_indexes_p): Remove.
(maybe_print_array_index): Remove format, pretty arguments; add
options. Update.
(val_print_array_elements): Remove format, deref_ref, pretty
arguments; add options. Update.
(val_print_string): Add options argument. Update.
(_initialize_valprint): Use user_print_options.
(output_format): Remove.
(set_output_radix_1): Use user_print_options.
* typeprint.c: Include valprint.h.
(objectprint): Don't declare.
(whatis_exp): Use get_user_print_options.
* tui/tui-regs.c: Include valprint.h.
(tui_register_format): Use get_formatted_print_options.
* tracepoint.c: Include valprint.h.
(addressprint): Don't declare.
(trace_mention): Use get_user_print_options.
(tracepoints_info): Likewise.
* stack.c (print_frame_args): Use get_raw_print_options.
(print_frame_info): Use get_user_print_options.
(print_frame): Likewise.
* sh64-tdep.c: Include valprint.h
(sh64_do_register): Use get_formatted_print_options.
* scm-valprint.c (scm_inferior_print): Remove format, deref_ref,
pretty arguments; add options.
(scm_scmlist_print): Likewise. Update.
(scm_scmval_print): Likewise.
(scm_val_print): Likewise.
(scm_value_print): Remove format, pretty arguments; add options.
Update.
* scm-lang.h (scm_value_print, scm_val_print, scm_scmval_print):
Update.
* scm-lang.c (scm_printstr): Add options argument.
* python/python-value.c: Include valprint.h.
(valpy_str): Use get_user_print_options.
* printcmd.c: Include valprint.h.
(addressprint): Don't declare.
(inspect_it): Remove.
(print_formatted): Remove format option; add options. Update.
(print_scalar_formatted): Likewise.
(print_address_demangle): Use get_user_print_options.
(do_examine): Use get_formatted_print_options.
(print_command_1): Likewise.
(output_command): Use get_formatted_print_options.
(do_one_display): Likewise.
(print_variable_value): Use get_user_print_options.
* p-valprint.c (pascal_val_print): Remove format, deref_ref,
pretty arguments; add options. Update.
(pascal_value_print): Remove format, pretty arguments; add
options. Update.
(vtblprint, objectprint): Don't declare.
(pascal_static_field_print): Remove.
(pascal_object_print_value_fields): Remove format, pretty
arguments; add options. Update.
(pascal_object_print_static_field): Likewise.
(_initialize_pascal_valprint): Use user_print_options. Update.
* p-lang.h (pascal_val_print, pascal_value_print,
pascal_printstr, pascal_object_print_value_fields): Update.
(vtblprint, static_field_print): Don't declare.
* p-lang.c (pascal_printstr): Add options argument. Update.
* objc-lang.c (objc_printstr): Add options argument. Update.
* mt-tdep.c: Include valprint.h.
(mt_registers_info): Use get_raw_print_options.
* mips-tdep.c: Include valprint.h.
(mips_print_fp_register): Use get_formatted_print_options.
(mips_print_register): Likewise.
* mi/mi-main.c: Include valprint.h.
(get_register): Use get_user_print_options.
(mi_cmd_data_evaluate_expression): Likewise.
(mi_cmd_data_read_memory): Use get_formatted_print_options.
* mi/mi-cmd-stack.c: Include valprint.h.
(list_args_or_locals): Use get_raw_print_options.
* m2-valprint.c (print_function_pointer_address): Add addressprint
argument.
(m2_print_long_set): Remove format, pretty arguments.
(m2_print_unbounded_array): Remove format, deref_ref, pretty
arguments; add options. Update.
(print_unpacked_pointer): Remove format argument; add options.
Now static. Update.
(print_variable_at_address): Remove format, deref_ref, pretty
arguments; add options. Update.
(m2_print_array_contents): Likewise.
(m2_val_print): Likewise.
* m2-lang.h (m2_val_print): Update.
* m2-lang.c (m2_printstr): Add options argument. Update.
* language.h (struct value_print_options): Declare.
(struct language_defn) <la_printstr>: Add options argument.
<la_val_print>: Remove format, deref_ref, pretty argument; add
options.
<la_value_print>: Remove format, pretty arguments; add options.
<la_print_array_index>: Likewise.
(LA_VAL_PRINT, LA_VALUE_PRINT, LA_PRINT_STRING,
LA_PRINT_ARRAY_INDEX): Update.
(default_print_array_index): Update.
* language.c (default_print_array_index): Remove format, pretty
arguments; add options. Update.
(unk_lang_printstr): Add options argument.
(unk_lang_val_print): Remove format, deref_ref, pretty arguments;
add options.
(unk_lang_value_print): Remove format, pretty arguments; add
options.
* jv-valprint.c (java_value_print): Remove format, pretty
arguments; add options. Update.
(java_print_value_fields): Likewise.
(java_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
* jv-lang.h (java_val_print, java_value_print): Declare.
* infcmd.c: Include valprint.h.
(print_return_value): Use get_raw_print_options.
(default_print_registers_info): Use get_user_print_options,
get_formatted_print_options.
(registers_info): Use get_formatted_print_options.
* gdbtypes.h (struct value_print_options): Declare.
(print_scalar_formatted): Update.
* f-valprint.c (f77_print_array_1): Remove format, deref_ref,
pretty arguments; add options. Update.
(f77_print_array): Likewise.
(f_val_print): Likewise.
* f-lang.h (f_val_print): Update.
* f-lang.c (f_printstr): Add options argument. Update.
(c_value_print): Update declaration.
* expprint.c: Include valprint.h.
(print_subexp_standard): Use get_raw_print_options,
get_user_print_options.
* eval.c: Include valprint.h.
(objectprint): Don't declare.
(evaluate_subexp_standard): Use get_user_print_options.
* cp-valprint.c (vtblprint, objectprint, static_field_print):
Remove.
(cp_print_value_fields): Remove format, pretty arguments; add
options. Update.
(cp_print_value): Likewise.
(cp_print_static_field): Likewise.
(_initialize_cp_valprint): Use user_print_options. Update.
* c-valprint.c (print_function_pointer_address): Add addressprint
argument.
(c_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(c_value_print): Add options argument. Update.
* c-lang.h (c_val_print, c_value_print, c_printstr): Update.
(vtblprint, static_field_print): Don't declare.
(cp_print_value_fields): Update.
* c-lang.c (c_printstr): Add options argument. Update.
* breakpoint.c: Include valprint.h.
(addressprint): Don't declare.
(watchpoint_value_print): Use get_user_print_options.
(print_one_breakpoint_location): Likewise.
(breakpoint_1, print_it_catch_fork, print_it_catch_vfork, mention,
print_exception_catchpoint): Likewise.
* auxv.c (fprint_target_auxv): Don't declare addressprint. Use
get_user_print_options.
* ada-valprint.c (struct ada_val_print_args): Remove format,
deref_ref, and pretty; add options.
(print_optional_low_bound): Add options argument.
(val_print_packed_array_elements): Remove format and pretty
arguments; add options. Update.
(printstr): Add options argument. Update.
(ada_printstr): Likewise.
(ada_val_print): Remove format, deref_ref, pretty arguments; add
options argument. Update.
(ada_val_print_stub): Update.
(ada_val_print_array): Remove format, deref_ref, pretty arguments;
add options. Update.
(ada_val_print_1): Likewise.
(print_variant_part): Likewise.
(ada_value_print): Remove format, pretty arguments; add options.
Update.
(print_record): Likewise.
(print_field_values): Likewise.
* ada-lang.h (ada_val_print, ada_value_print, ada_printstr):
Update.
* ada-lang.c (ada_print_array_index): Add options argument; remove
format and pretty arguments.
(print_one_exception): Use get_user_print_options.
gdb/testsuite
* gdb.base/exprs.exp (test_expr): Add enum formatting tests.
2008-10-28 18:19:58 +01:00
|
|
|
|
for (i = 0; i < length && things_printed < options->print_max; ++i)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
/* Position of the character we are examining
|
1999-07-07 22:19:36 +02:00
|
|
|
|
to see whether it is repeated. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
unsigned int rep1;
|
|
|
|
|
/* Number of repetitions we have detected so far. */
|
|
|
|
|
unsigned int reps;
|
|
|
|
|
|
|
|
|
|
QUIT;
|
|
|
|
|
|
|
|
|
|
if (need_comma)
|
|
|
|
|
{
|
|
|
|
|
fputs_filtered (", ", stream);
|
|
|
|
|
need_comma = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rep1 = i + 1;
|
|
|
|
|
reps = 1;
|
|
|
|
|
while (rep1 < length && string[rep1] == string[i])
|
|
|
|
|
{
|
|
|
|
|
++rep1;
|
|
|
|
|
++reps;
|
|
|
|
|
}
|
|
|
|
|
|
gdb
* varobj.c (value_get_print_value): Include valprint.h.
(value_get_print_value): Use get_formatted_print_options.
* value.h (struct value_print_options): Declare.
(value_print, val_print, common_val_print, val_print_string):
Update.
* value.c: Include valprint.h.
(show_values): Use get_user_print_options.
(show_convenience): Likewise.
* valprint.h (prettyprint_arrays, prettyprint_structs): Don't
declare.
(struct value_print_options): New type.
(vtblprint, unionprint, addressprint, objectprint, print_max,
inspect_it, repeat_count_threshold, output_format,
stop_print_at_null): Don't declare.
(user_print_options, get_user_print_options,
get_raw_print_options, get_formatted_print_options): Declare.
(print_array_indexes_p): Don't declare.
(maybe_print_array_index, val_print_array_elements): Update.
* valprint.c (print_max): Remove.
(user_print_options): New global.
(get_user_print_options, get_raw_print_options,
get_formatted_print_options): New functions.
(print_array_indexes, repeat_count_threshold, stop_print_at_null,
prettyprint_structs, prettyprint_arrays, unionprint,
addressprint): Remove.
(val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(common_val_print): Likewise.
(print_array_indexes_p): Remove.
(maybe_print_array_index): Remove format, pretty arguments; add
options. Update.
(val_print_array_elements): Remove format, deref_ref, pretty
arguments; add options. Update.
(val_print_string): Add options argument. Update.
(_initialize_valprint): Use user_print_options.
(output_format): Remove.
(set_output_radix_1): Use user_print_options.
* typeprint.c: Include valprint.h.
(objectprint): Don't declare.
(whatis_exp): Use get_user_print_options.
* tui/tui-regs.c: Include valprint.h.
(tui_register_format): Use get_formatted_print_options.
* tracepoint.c: Include valprint.h.
(addressprint): Don't declare.
(trace_mention): Use get_user_print_options.
(tracepoints_info): Likewise.
* stack.c (print_frame_args): Use get_raw_print_options.
(print_frame_info): Use get_user_print_options.
(print_frame): Likewise.
* sh64-tdep.c: Include valprint.h
(sh64_do_register): Use get_formatted_print_options.
* scm-valprint.c (scm_inferior_print): Remove format, deref_ref,
pretty arguments; add options.
(scm_scmlist_print): Likewise. Update.
(scm_scmval_print): Likewise.
(scm_val_print): Likewise.
(scm_value_print): Remove format, pretty arguments; add options.
Update.
* scm-lang.h (scm_value_print, scm_val_print, scm_scmval_print):
Update.
* scm-lang.c (scm_printstr): Add options argument.
* python/python-value.c: Include valprint.h.
(valpy_str): Use get_user_print_options.
* printcmd.c: Include valprint.h.
(addressprint): Don't declare.
(inspect_it): Remove.
(print_formatted): Remove format option; add options. Update.
(print_scalar_formatted): Likewise.
(print_address_demangle): Use get_user_print_options.
(do_examine): Use get_formatted_print_options.
(print_command_1): Likewise.
(output_command): Use get_formatted_print_options.
(do_one_display): Likewise.
(print_variable_value): Use get_user_print_options.
* p-valprint.c (pascal_val_print): Remove format, deref_ref,
pretty arguments; add options. Update.
(pascal_value_print): Remove format, pretty arguments; add
options. Update.
(vtblprint, objectprint): Don't declare.
(pascal_static_field_print): Remove.
(pascal_object_print_value_fields): Remove format, pretty
arguments; add options. Update.
(pascal_object_print_static_field): Likewise.
(_initialize_pascal_valprint): Use user_print_options. Update.
* p-lang.h (pascal_val_print, pascal_value_print,
pascal_printstr, pascal_object_print_value_fields): Update.
(vtblprint, static_field_print): Don't declare.
* p-lang.c (pascal_printstr): Add options argument. Update.
* objc-lang.c (objc_printstr): Add options argument. Update.
* mt-tdep.c: Include valprint.h.
(mt_registers_info): Use get_raw_print_options.
* mips-tdep.c: Include valprint.h.
(mips_print_fp_register): Use get_formatted_print_options.
(mips_print_register): Likewise.
* mi/mi-main.c: Include valprint.h.
(get_register): Use get_user_print_options.
(mi_cmd_data_evaluate_expression): Likewise.
(mi_cmd_data_read_memory): Use get_formatted_print_options.
* mi/mi-cmd-stack.c: Include valprint.h.
(list_args_or_locals): Use get_raw_print_options.
* m2-valprint.c (print_function_pointer_address): Add addressprint
argument.
(m2_print_long_set): Remove format, pretty arguments.
(m2_print_unbounded_array): Remove format, deref_ref, pretty
arguments; add options. Update.
(print_unpacked_pointer): Remove format argument; add options.
Now static. Update.
(print_variable_at_address): Remove format, deref_ref, pretty
arguments; add options. Update.
(m2_print_array_contents): Likewise.
(m2_val_print): Likewise.
* m2-lang.h (m2_val_print): Update.
* m2-lang.c (m2_printstr): Add options argument. Update.
* language.h (struct value_print_options): Declare.
(struct language_defn) <la_printstr>: Add options argument.
<la_val_print>: Remove format, deref_ref, pretty argument; add
options.
<la_value_print>: Remove format, pretty arguments; add options.
<la_print_array_index>: Likewise.
(LA_VAL_PRINT, LA_VALUE_PRINT, LA_PRINT_STRING,
LA_PRINT_ARRAY_INDEX): Update.
(default_print_array_index): Update.
* language.c (default_print_array_index): Remove format, pretty
arguments; add options. Update.
(unk_lang_printstr): Add options argument.
(unk_lang_val_print): Remove format, deref_ref, pretty arguments;
add options.
(unk_lang_value_print): Remove format, pretty arguments; add
options.
* jv-valprint.c (java_value_print): Remove format, pretty
arguments; add options. Update.
(java_print_value_fields): Likewise.
(java_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
* jv-lang.h (java_val_print, java_value_print): Declare.
* infcmd.c: Include valprint.h.
(print_return_value): Use get_raw_print_options.
(default_print_registers_info): Use get_user_print_options,
get_formatted_print_options.
(registers_info): Use get_formatted_print_options.
* gdbtypes.h (struct value_print_options): Declare.
(print_scalar_formatted): Update.
* f-valprint.c (f77_print_array_1): Remove format, deref_ref,
pretty arguments; add options. Update.
(f77_print_array): Likewise.
(f_val_print): Likewise.
* f-lang.h (f_val_print): Update.
* f-lang.c (f_printstr): Add options argument. Update.
(c_value_print): Update declaration.
* expprint.c: Include valprint.h.
(print_subexp_standard): Use get_raw_print_options,
get_user_print_options.
* eval.c: Include valprint.h.
(objectprint): Don't declare.
(evaluate_subexp_standard): Use get_user_print_options.
* cp-valprint.c (vtblprint, objectprint, static_field_print):
Remove.
(cp_print_value_fields): Remove format, pretty arguments; add
options. Update.
(cp_print_value): Likewise.
(cp_print_static_field): Likewise.
(_initialize_cp_valprint): Use user_print_options. Update.
* c-valprint.c (print_function_pointer_address): Add addressprint
argument.
(c_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(c_value_print): Add options argument. Update.
* c-lang.h (c_val_print, c_value_print, c_printstr): Update.
(vtblprint, static_field_print): Don't declare.
(cp_print_value_fields): Update.
* c-lang.c (c_printstr): Add options argument. Update.
* breakpoint.c: Include valprint.h.
(addressprint): Don't declare.
(watchpoint_value_print): Use get_user_print_options.
(print_one_breakpoint_location): Likewise.
(breakpoint_1, print_it_catch_fork, print_it_catch_vfork, mention,
print_exception_catchpoint): Likewise.
* auxv.c (fprint_target_auxv): Don't declare addressprint. Use
get_user_print_options.
* ada-valprint.c (struct ada_val_print_args): Remove format,
deref_ref, and pretty; add options.
(print_optional_low_bound): Add options argument.
(val_print_packed_array_elements): Remove format and pretty
arguments; add options. Update.
(printstr): Add options argument. Update.
(ada_printstr): Likewise.
(ada_val_print): Remove format, deref_ref, pretty arguments; add
options argument. Update.
(ada_val_print_stub): Update.
(ada_val_print_array): Remove format, deref_ref, pretty arguments;
add options. Update.
(ada_val_print_1): Likewise.
(print_variant_part): Likewise.
(ada_value_print): Remove format, pretty arguments; add options.
Update.
(print_record): Likewise.
(print_field_values): Likewise.
* ada-lang.h (ada_val_print, ada_value_print, ada_printstr):
Update.
* ada-lang.c (ada_print_array_index): Add options argument; remove
format and pretty arguments.
(print_one_exception): Use get_user_print_options.
gdb/testsuite
* gdb.base/exprs.exp (test_expr): Add enum formatting tests.
2008-10-28 18:19:58 +01:00
|
|
|
|
if (reps > options->repeat_count_threshold)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
|
|
|
|
if (in_quotes)
|
|
|
|
|
{
|
gdb
* varobj.c (value_get_print_value): Include valprint.h.
(value_get_print_value): Use get_formatted_print_options.
* value.h (struct value_print_options): Declare.
(value_print, val_print, common_val_print, val_print_string):
Update.
* value.c: Include valprint.h.
(show_values): Use get_user_print_options.
(show_convenience): Likewise.
* valprint.h (prettyprint_arrays, prettyprint_structs): Don't
declare.
(struct value_print_options): New type.
(vtblprint, unionprint, addressprint, objectprint, print_max,
inspect_it, repeat_count_threshold, output_format,
stop_print_at_null): Don't declare.
(user_print_options, get_user_print_options,
get_raw_print_options, get_formatted_print_options): Declare.
(print_array_indexes_p): Don't declare.
(maybe_print_array_index, val_print_array_elements): Update.
* valprint.c (print_max): Remove.
(user_print_options): New global.
(get_user_print_options, get_raw_print_options,
get_formatted_print_options): New functions.
(print_array_indexes, repeat_count_threshold, stop_print_at_null,
prettyprint_structs, prettyprint_arrays, unionprint,
addressprint): Remove.
(val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(common_val_print): Likewise.
(print_array_indexes_p): Remove.
(maybe_print_array_index): Remove format, pretty arguments; add
options. Update.
(val_print_array_elements): Remove format, deref_ref, pretty
arguments; add options. Update.
(val_print_string): Add options argument. Update.
(_initialize_valprint): Use user_print_options.
(output_format): Remove.
(set_output_radix_1): Use user_print_options.
* typeprint.c: Include valprint.h.
(objectprint): Don't declare.
(whatis_exp): Use get_user_print_options.
* tui/tui-regs.c: Include valprint.h.
(tui_register_format): Use get_formatted_print_options.
* tracepoint.c: Include valprint.h.
(addressprint): Don't declare.
(trace_mention): Use get_user_print_options.
(tracepoints_info): Likewise.
* stack.c (print_frame_args): Use get_raw_print_options.
(print_frame_info): Use get_user_print_options.
(print_frame): Likewise.
* sh64-tdep.c: Include valprint.h
(sh64_do_register): Use get_formatted_print_options.
* scm-valprint.c (scm_inferior_print): Remove format, deref_ref,
pretty arguments; add options.
(scm_scmlist_print): Likewise. Update.
(scm_scmval_print): Likewise.
(scm_val_print): Likewise.
(scm_value_print): Remove format, pretty arguments; add options.
Update.
* scm-lang.h (scm_value_print, scm_val_print, scm_scmval_print):
Update.
* scm-lang.c (scm_printstr): Add options argument.
* python/python-value.c: Include valprint.h.
(valpy_str): Use get_user_print_options.
* printcmd.c: Include valprint.h.
(addressprint): Don't declare.
(inspect_it): Remove.
(print_formatted): Remove format option; add options. Update.
(print_scalar_formatted): Likewise.
(print_address_demangle): Use get_user_print_options.
(do_examine): Use get_formatted_print_options.
(print_command_1): Likewise.
(output_command): Use get_formatted_print_options.
(do_one_display): Likewise.
(print_variable_value): Use get_user_print_options.
* p-valprint.c (pascal_val_print): Remove format, deref_ref,
pretty arguments; add options. Update.
(pascal_value_print): Remove format, pretty arguments; add
options. Update.
(vtblprint, objectprint): Don't declare.
(pascal_static_field_print): Remove.
(pascal_object_print_value_fields): Remove format, pretty
arguments; add options. Update.
(pascal_object_print_static_field): Likewise.
(_initialize_pascal_valprint): Use user_print_options. Update.
* p-lang.h (pascal_val_print, pascal_value_print,
pascal_printstr, pascal_object_print_value_fields): Update.
(vtblprint, static_field_print): Don't declare.
* p-lang.c (pascal_printstr): Add options argument. Update.
* objc-lang.c (objc_printstr): Add options argument. Update.
* mt-tdep.c: Include valprint.h.
(mt_registers_info): Use get_raw_print_options.
* mips-tdep.c: Include valprint.h.
(mips_print_fp_register): Use get_formatted_print_options.
(mips_print_register): Likewise.
* mi/mi-main.c: Include valprint.h.
(get_register): Use get_user_print_options.
(mi_cmd_data_evaluate_expression): Likewise.
(mi_cmd_data_read_memory): Use get_formatted_print_options.
* mi/mi-cmd-stack.c: Include valprint.h.
(list_args_or_locals): Use get_raw_print_options.
* m2-valprint.c (print_function_pointer_address): Add addressprint
argument.
(m2_print_long_set): Remove format, pretty arguments.
(m2_print_unbounded_array): Remove format, deref_ref, pretty
arguments; add options. Update.
(print_unpacked_pointer): Remove format argument; add options.
Now static. Update.
(print_variable_at_address): Remove format, deref_ref, pretty
arguments; add options. Update.
(m2_print_array_contents): Likewise.
(m2_val_print): Likewise.
* m2-lang.h (m2_val_print): Update.
* m2-lang.c (m2_printstr): Add options argument. Update.
* language.h (struct value_print_options): Declare.
(struct language_defn) <la_printstr>: Add options argument.
<la_val_print>: Remove format, deref_ref, pretty argument; add
options.
<la_value_print>: Remove format, pretty arguments; add options.
<la_print_array_index>: Likewise.
(LA_VAL_PRINT, LA_VALUE_PRINT, LA_PRINT_STRING,
LA_PRINT_ARRAY_INDEX): Update.
(default_print_array_index): Update.
* language.c (default_print_array_index): Remove format, pretty
arguments; add options. Update.
(unk_lang_printstr): Add options argument.
(unk_lang_val_print): Remove format, deref_ref, pretty arguments;
add options.
(unk_lang_value_print): Remove format, pretty arguments; add
options.
* jv-valprint.c (java_value_print): Remove format, pretty
arguments; add options. Update.
(java_print_value_fields): Likewise.
(java_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
* jv-lang.h (java_val_print, java_value_print): Declare.
* infcmd.c: Include valprint.h.
(print_return_value): Use get_raw_print_options.
(default_print_registers_info): Use get_user_print_options,
get_formatted_print_options.
(registers_info): Use get_formatted_print_options.
* gdbtypes.h (struct value_print_options): Declare.
(print_scalar_formatted): Update.
* f-valprint.c (f77_print_array_1): Remove format, deref_ref,
pretty arguments; add options. Update.
(f77_print_array): Likewise.
(f_val_print): Likewise.
* f-lang.h (f_val_print): Update.
* f-lang.c (f_printstr): Add options argument. Update.
(c_value_print): Update declaration.
* expprint.c: Include valprint.h.
(print_subexp_standard): Use get_raw_print_options,
get_user_print_options.
* eval.c: Include valprint.h.
(objectprint): Don't declare.
(evaluate_subexp_standard): Use get_user_print_options.
* cp-valprint.c (vtblprint, objectprint, static_field_print):
Remove.
(cp_print_value_fields): Remove format, pretty arguments; add
options. Update.
(cp_print_value): Likewise.
(cp_print_static_field): Likewise.
(_initialize_cp_valprint): Use user_print_options. Update.
* c-valprint.c (print_function_pointer_address): Add addressprint
argument.
(c_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(c_value_print): Add options argument. Update.
* c-lang.h (c_val_print, c_value_print, c_printstr): Update.
(vtblprint, static_field_print): Don't declare.
(cp_print_value_fields): Update.
* c-lang.c (c_printstr): Add options argument. Update.
* breakpoint.c: Include valprint.h.
(addressprint): Don't declare.
(watchpoint_value_print): Use get_user_print_options.
(print_one_breakpoint_location): Likewise.
(breakpoint_1, print_it_catch_fork, print_it_catch_vfork, mention,
print_exception_catchpoint): Likewise.
* auxv.c (fprint_target_auxv): Don't declare addressprint. Use
get_user_print_options.
* ada-valprint.c (struct ada_val_print_args): Remove format,
deref_ref, and pretty; add options.
(print_optional_low_bound): Add options argument.
(val_print_packed_array_elements): Remove format and pretty
arguments; add options. Update.
(printstr): Add options argument. Update.
(ada_printstr): Likewise.
(ada_val_print): Remove format, deref_ref, pretty arguments; add
options argument. Update.
(ada_val_print_stub): Update.
(ada_val_print_array): Remove format, deref_ref, pretty arguments;
add options. Update.
(ada_val_print_1): Likewise.
(print_variant_part): Likewise.
(ada_value_print): Remove format, pretty arguments; add options.
Update.
(print_record): Likewise.
(print_field_values): Likewise.
* ada-lang.h (ada_val_print, ada_value_print, ada_printstr):
Update.
* ada-lang.c (ada_print_array_index): Add options argument; remove
format and pretty arguments.
(print_one_exception): Use get_user_print_options.
gdb/testsuite
* gdb.base/exprs.exp (test_expr): Add enum formatting tests.
2008-10-28 18:19:58 +01:00
|
|
|
|
if (options->inspect_it)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
fputs_filtered ("\\\", ", stream);
|
|
|
|
|
else
|
|
|
|
|
fputs_filtered ("\", ", stream);
|
|
|
|
|
in_quotes = 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
|
|
|
|
m2_printchar (string[i], type, stream);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
fprintf_filtered (stream, " <repeats %u times>", reps);
|
|
|
|
|
i = rep1 - 1;
|
gdb
* varobj.c (value_get_print_value): Include valprint.h.
(value_get_print_value): Use get_formatted_print_options.
* value.h (struct value_print_options): Declare.
(value_print, val_print, common_val_print, val_print_string):
Update.
* value.c: Include valprint.h.
(show_values): Use get_user_print_options.
(show_convenience): Likewise.
* valprint.h (prettyprint_arrays, prettyprint_structs): Don't
declare.
(struct value_print_options): New type.
(vtblprint, unionprint, addressprint, objectprint, print_max,
inspect_it, repeat_count_threshold, output_format,
stop_print_at_null): Don't declare.
(user_print_options, get_user_print_options,
get_raw_print_options, get_formatted_print_options): Declare.
(print_array_indexes_p): Don't declare.
(maybe_print_array_index, val_print_array_elements): Update.
* valprint.c (print_max): Remove.
(user_print_options): New global.
(get_user_print_options, get_raw_print_options,
get_formatted_print_options): New functions.
(print_array_indexes, repeat_count_threshold, stop_print_at_null,
prettyprint_structs, prettyprint_arrays, unionprint,
addressprint): Remove.
(val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(common_val_print): Likewise.
(print_array_indexes_p): Remove.
(maybe_print_array_index): Remove format, pretty arguments; add
options. Update.
(val_print_array_elements): Remove format, deref_ref, pretty
arguments; add options. Update.
(val_print_string): Add options argument. Update.
(_initialize_valprint): Use user_print_options.
(output_format): Remove.
(set_output_radix_1): Use user_print_options.
* typeprint.c: Include valprint.h.
(objectprint): Don't declare.
(whatis_exp): Use get_user_print_options.
* tui/tui-regs.c: Include valprint.h.
(tui_register_format): Use get_formatted_print_options.
* tracepoint.c: Include valprint.h.
(addressprint): Don't declare.
(trace_mention): Use get_user_print_options.
(tracepoints_info): Likewise.
* stack.c (print_frame_args): Use get_raw_print_options.
(print_frame_info): Use get_user_print_options.
(print_frame): Likewise.
* sh64-tdep.c: Include valprint.h
(sh64_do_register): Use get_formatted_print_options.
* scm-valprint.c (scm_inferior_print): Remove format, deref_ref,
pretty arguments; add options.
(scm_scmlist_print): Likewise. Update.
(scm_scmval_print): Likewise.
(scm_val_print): Likewise.
(scm_value_print): Remove format, pretty arguments; add options.
Update.
* scm-lang.h (scm_value_print, scm_val_print, scm_scmval_print):
Update.
* scm-lang.c (scm_printstr): Add options argument.
* python/python-value.c: Include valprint.h.
(valpy_str): Use get_user_print_options.
* printcmd.c: Include valprint.h.
(addressprint): Don't declare.
(inspect_it): Remove.
(print_formatted): Remove format option; add options. Update.
(print_scalar_formatted): Likewise.
(print_address_demangle): Use get_user_print_options.
(do_examine): Use get_formatted_print_options.
(print_command_1): Likewise.
(output_command): Use get_formatted_print_options.
(do_one_display): Likewise.
(print_variable_value): Use get_user_print_options.
* p-valprint.c (pascal_val_print): Remove format, deref_ref,
pretty arguments; add options. Update.
(pascal_value_print): Remove format, pretty arguments; add
options. Update.
(vtblprint, objectprint): Don't declare.
(pascal_static_field_print): Remove.
(pascal_object_print_value_fields): Remove format, pretty
arguments; add options. Update.
(pascal_object_print_static_field): Likewise.
(_initialize_pascal_valprint): Use user_print_options. Update.
* p-lang.h (pascal_val_print, pascal_value_print,
pascal_printstr, pascal_object_print_value_fields): Update.
(vtblprint, static_field_print): Don't declare.
* p-lang.c (pascal_printstr): Add options argument. Update.
* objc-lang.c (objc_printstr): Add options argument. Update.
* mt-tdep.c: Include valprint.h.
(mt_registers_info): Use get_raw_print_options.
* mips-tdep.c: Include valprint.h.
(mips_print_fp_register): Use get_formatted_print_options.
(mips_print_register): Likewise.
* mi/mi-main.c: Include valprint.h.
(get_register): Use get_user_print_options.
(mi_cmd_data_evaluate_expression): Likewise.
(mi_cmd_data_read_memory): Use get_formatted_print_options.
* mi/mi-cmd-stack.c: Include valprint.h.
(list_args_or_locals): Use get_raw_print_options.
* m2-valprint.c (print_function_pointer_address): Add addressprint
argument.
(m2_print_long_set): Remove format, pretty arguments.
(m2_print_unbounded_array): Remove format, deref_ref, pretty
arguments; add options. Update.
(print_unpacked_pointer): Remove format argument; add options.
Now static. Update.
(print_variable_at_address): Remove format, deref_ref, pretty
arguments; add options. Update.
(m2_print_array_contents): Likewise.
(m2_val_print): Likewise.
* m2-lang.h (m2_val_print): Update.
* m2-lang.c (m2_printstr): Add options argument. Update.
* language.h (struct value_print_options): Declare.
(struct language_defn) <la_printstr>: Add options argument.
<la_val_print>: Remove format, deref_ref, pretty argument; add
options.
<la_value_print>: Remove format, pretty arguments; add options.
<la_print_array_index>: Likewise.
(LA_VAL_PRINT, LA_VALUE_PRINT, LA_PRINT_STRING,
LA_PRINT_ARRAY_INDEX): Update.
(default_print_array_index): Update.
* language.c (default_print_array_index): Remove format, pretty
arguments; add options. Update.
(unk_lang_printstr): Add options argument.
(unk_lang_val_print): Remove format, deref_ref, pretty arguments;
add options.
(unk_lang_value_print): Remove format, pretty arguments; add
options.
* jv-valprint.c (java_value_print): Remove format, pretty
arguments; add options. Update.
(java_print_value_fields): Likewise.
(java_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
* jv-lang.h (java_val_print, java_value_print): Declare.
* infcmd.c: Include valprint.h.
(print_return_value): Use get_raw_print_options.
(default_print_registers_info): Use get_user_print_options,
get_formatted_print_options.
(registers_info): Use get_formatted_print_options.
* gdbtypes.h (struct value_print_options): Declare.
(print_scalar_formatted): Update.
* f-valprint.c (f77_print_array_1): Remove format, deref_ref,
pretty arguments; add options. Update.
(f77_print_array): Likewise.
(f_val_print): Likewise.
* f-lang.h (f_val_print): Update.
* f-lang.c (f_printstr): Add options argument. Update.
(c_value_print): Update declaration.
* expprint.c: Include valprint.h.
(print_subexp_standard): Use get_raw_print_options,
get_user_print_options.
* eval.c: Include valprint.h.
(objectprint): Don't declare.
(evaluate_subexp_standard): Use get_user_print_options.
* cp-valprint.c (vtblprint, objectprint, static_field_print):
Remove.
(cp_print_value_fields): Remove format, pretty arguments; add
options. Update.
(cp_print_value): Likewise.
(cp_print_static_field): Likewise.
(_initialize_cp_valprint): Use user_print_options. Update.
* c-valprint.c (print_function_pointer_address): Add addressprint
argument.
(c_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(c_value_print): Add options argument. Update.
* c-lang.h (c_val_print, c_value_print, c_printstr): Update.
(vtblprint, static_field_print): Don't declare.
(cp_print_value_fields): Update.
* c-lang.c (c_printstr): Add options argument. Update.
* breakpoint.c: Include valprint.h.
(addressprint): Don't declare.
(watchpoint_value_print): Use get_user_print_options.
(print_one_breakpoint_location): Likewise.
(breakpoint_1, print_it_catch_fork, print_it_catch_vfork, mention,
print_exception_catchpoint): Likewise.
* auxv.c (fprint_target_auxv): Don't declare addressprint. Use
get_user_print_options.
* ada-valprint.c (struct ada_val_print_args): Remove format,
deref_ref, and pretty; add options.
(print_optional_low_bound): Add options argument.
(val_print_packed_array_elements): Remove format and pretty
arguments; add options. Update.
(printstr): Add options argument. Update.
(ada_printstr): Likewise.
(ada_val_print): Remove format, deref_ref, pretty arguments; add
options argument. Update.
(ada_val_print_stub): Update.
(ada_val_print_array): Remove format, deref_ref, pretty arguments;
add options. Update.
(ada_val_print_1): Likewise.
(print_variant_part): Likewise.
(ada_value_print): Remove format, pretty arguments; add options.
Update.
(print_record): Likewise.
(print_field_values): Likewise.
* ada-lang.h (ada_val_print, ada_value_print, ada_printstr):
Update.
* ada-lang.c (ada_print_array_index): Add options argument; remove
format and pretty arguments.
(print_one_exception): Use get_user_print_options.
gdb/testsuite
* gdb.base/exprs.exp (test_expr): Add enum formatting tests.
2008-10-28 18:19:58 +01:00
|
|
|
|
things_printed += options->repeat_count_threshold;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
need_comma = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!in_quotes)
|
|
|
|
|
{
|
gdb
* varobj.c (value_get_print_value): Include valprint.h.
(value_get_print_value): Use get_formatted_print_options.
* value.h (struct value_print_options): Declare.
(value_print, val_print, common_val_print, val_print_string):
Update.
* value.c: Include valprint.h.
(show_values): Use get_user_print_options.
(show_convenience): Likewise.
* valprint.h (prettyprint_arrays, prettyprint_structs): Don't
declare.
(struct value_print_options): New type.
(vtblprint, unionprint, addressprint, objectprint, print_max,
inspect_it, repeat_count_threshold, output_format,
stop_print_at_null): Don't declare.
(user_print_options, get_user_print_options,
get_raw_print_options, get_formatted_print_options): Declare.
(print_array_indexes_p): Don't declare.
(maybe_print_array_index, val_print_array_elements): Update.
* valprint.c (print_max): Remove.
(user_print_options): New global.
(get_user_print_options, get_raw_print_options,
get_formatted_print_options): New functions.
(print_array_indexes, repeat_count_threshold, stop_print_at_null,
prettyprint_structs, prettyprint_arrays, unionprint,
addressprint): Remove.
(val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(common_val_print): Likewise.
(print_array_indexes_p): Remove.
(maybe_print_array_index): Remove format, pretty arguments; add
options. Update.
(val_print_array_elements): Remove format, deref_ref, pretty
arguments; add options. Update.
(val_print_string): Add options argument. Update.
(_initialize_valprint): Use user_print_options.
(output_format): Remove.
(set_output_radix_1): Use user_print_options.
* typeprint.c: Include valprint.h.
(objectprint): Don't declare.
(whatis_exp): Use get_user_print_options.
* tui/tui-regs.c: Include valprint.h.
(tui_register_format): Use get_formatted_print_options.
* tracepoint.c: Include valprint.h.
(addressprint): Don't declare.
(trace_mention): Use get_user_print_options.
(tracepoints_info): Likewise.
* stack.c (print_frame_args): Use get_raw_print_options.
(print_frame_info): Use get_user_print_options.
(print_frame): Likewise.
* sh64-tdep.c: Include valprint.h
(sh64_do_register): Use get_formatted_print_options.
* scm-valprint.c (scm_inferior_print): Remove format, deref_ref,
pretty arguments; add options.
(scm_scmlist_print): Likewise. Update.
(scm_scmval_print): Likewise.
(scm_val_print): Likewise.
(scm_value_print): Remove format, pretty arguments; add options.
Update.
* scm-lang.h (scm_value_print, scm_val_print, scm_scmval_print):
Update.
* scm-lang.c (scm_printstr): Add options argument.
* python/python-value.c: Include valprint.h.
(valpy_str): Use get_user_print_options.
* printcmd.c: Include valprint.h.
(addressprint): Don't declare.
(inspect_it): Remove.
(print_formatted): Remove format option; add options. Update.
(print_scalar_formatted): Likewise.
(print_address_demangle): Use get_user_print_options.
(do_examine): Use get_formatted_print_options.
(print_command_1): Likewise.
(output_command): Use get_formatted_print_options.
(do_one_display): Likewise.
(print_variable_value): Use get_user_print_options.
* p-valprint.c (pascal_val_print): Remove format, deref_ref,
pretty arguments; add options. Update.
(pascal_value_print): Remove format, pretty arguments; add
options. Update.
(vtblprint, objectprint): Don't declare.
(pascal_static_field_print): Remove.
(pascal_object_print_value_fields): Remove format, pretty
arguments; add options. Update.
(pascal_object_print_static_field): Likewise.
(_initialize_pascal_valprint): Use user_print_options. Update.
* p-lang.h (pascal_val_print, pascal_value_print,
pascal_printstr, pascal_object_print_value_fields): Update.
(vtblprint, static_field_print): Don't declare.
* p-lang.c (pascal_printstr): Add options argument. Update.
* objc-lang.c (objc_printstr): Add options argument. Update.
* mt-tdep.c: Include valprint.h.
(mt_registers_info): Use get_raw_print_options.
* mips-tdep.c: Include valprint.h.
(mips_print_fp_register): Use get_formatted_print_options.
(mips_print_register): Likewise.
* mi/mi-main.c: Include valprint.h.
(get_register): Use get_user_print_options.
(mi_cmd_data_evaluate_expression): Likewise.
(mi_cmd_data_read_memory): Use get_formatted_print_options.
* mi/mi-cmd-stack.c: Include valprint.h.
(list_args_or_locals): Use get_raw_print_options.
* m2-valprint.c (print_function_pointer_address): Add addressprint
argument.
(m2_print_long_set): Remove format, pretty arguments.
(m2_print_unbounded_array): Remove format, deref_ref, pretty
arguments; add options. Update.
(print_unpacked_pointer): Remove format argument; add options.
Now static. Update.
(print_variable_at_address): Remove format, deref_ref, pretty
arguments; add options. Update.
(m2_print_array_contents): Likewise.
(m2_val_print): Likewise.
* m2-lang.h (m2_val_print): Update.
* m2-lang.c (m2_printstr): Add options argument. Update.
* language.h (struct value_print_options): Declare.
(struct language_defn) <la_printstr>: Add options argument.
<la_val_print>: Remove format, deref_ref, pretty argument; add
options.
<la_value_print>: Remove format, pretty arguments; add options.
<la_print_array_index>: Likewise.
(LA_VAL_PRINT, LA_VALUE_PRINT, LA_PRINT_STRING,
LA_PRINT_ARRAY_INDEX): Update.
(default_print_array_index): Update.
* language.c (default_print_array_index): Remove format, pretty
arguments; add options. Update.
(unk_lang_printstr): Add options argument.
(unk_lang_val_print): Remove format, deref_ref, pretty arguments;
add options.
(unk_lang_value_print): Remove format, pretty arguments; add
options.
* jv-valprint.c (java_value_print): Remove format, pretty
arguments; add options. Update.
(java_print_value_fields): Likewise.
(java_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
* jv-lang.h (java_val_print, java_value_print): Declare.
* infcmd.c: Include valprint.h.
(print_return_value): Use get_raw_print_options.
(default_print_registers_info): Use get_user_print_options,
get_formatted_print_options.
(registers_info): Use get_formatted_print_options.
* gdbtypes.h (struct value_print_options): Declare.
(print_scalar_formatted): Update.
* f-valprint.c (f77_print_array_1): Remove format, deref_ref,
pretty arguments; add options. Update.
(f77_print_array): Likewise.
(f_val_print): Likewise.
* f-lang.h (f_val_print): Update.
* f-lang.c (f_printstr): Add options argument. Update.
(c_value_print): Update declaration.
* expprint.c: Include valprint.h.
(print_subexp_standard): Use get_raw_print_options,
get_user_print_options.
* eval.c: Include valprint.h.
(objectprint): Don't declare.
(evaluate_subexp_standard): Use get_user_print_options.
* cp-valprint.c (vtblprint, objectprint, static_field_print):
Remove.
(cp_print_value_fields): Remove format, pretty arguments; add
options. Update.
(cp_print_value): Likewise.
(cp_print_static_field): Likewise.
(_initialize_cp_valprint): Use user_print_options. Update.
* c-valprint.c (print_function_pointer_address): Add addressprint
argument.
(c_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(c_value_print): Add options argument. Update.
* c-lang.h (c_val_print, c_value_print, c_printstr): Update.
(vtblprint, static_field_print): Don't declare.
(cp_print_value_fields): Update.
* c-lang.c (c_printstr): Add options argument. Update.
* breakpoint.c: Include valprint.h.
(addressprint): Don't declare.
(watchpoint_value_print): Use get_user_print_options.
(print_one_breakpoint_location): Likewise.
(breakpoint_1, print_it_catch_fork, print_it_catch_vfork, mention,
print_exception_catchpoint): Likewise.
* auxv.c (fprint_target_auxv): Don't declare addressprint. Use
get_user_print_options.
* ada-valprint.c (struct ada_val_print_args): Remove format,
deref_ref, and pretty; add options.
(print_optional_low_bound): Add options argument.
(val_print_packed_array_elements): Remove format and pretty
arguments; add options. Update.
(printstr): Add options argument. Update.
(ada_printstr): Likewise.
(ada_val_print): Remove format, deref_ref, pretty arguments; add
options argument. Update.
(ada_val_print_stub): Update.
(ada_val_print_array): Remove format, deref_ref, pretty arguments;
add options. Update.
(ada_val_print_1): Likewise.
(print_variant_part): Likewise.
(ada_value_print): Remove format, pretty arguments; add options.
Update.
(print_record): Likewise.
(print_field_values): Likewise.
* ada-lang.h (ada_val_print, ada_value_print, ada_printstr):
Update.
* ada-lang.c (ada_print_array_index): Add options argument; remove
format and pretty arguments.
(print_one_exception): Use get_user_print_options.
gdb/testsuite
* gdb.base/exprs.exp (test_expr): Add enum formatting tests.
2008-10-28 18:19:58 +01:00
|
|
|
|
if (options->inspect_it)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
fputs_filtered ("\\\"", stream);
|
|
|
|
|
else
|
|
|
|
|
fputs_filtered ("\"", stream);
|
|
|
|
|
in_quotes = 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
|
|
|
|
LA_EMIT_CHAR (string[i], type, stream, '"');
|
1999-04-16 03:35:26 +02:00
|
|
|
|
++things_printed;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Terminate the quotes if necessary. */
|
|
|
|
|
if (in_quotes)
|
|
|
|
|
{
|
gdb
* varobj.c (value_get_print_value): Include valprint.h.
(value_get_print_value): Use get_formatted_print_options.
* value.h (struct value_print_options): Declare.
(value_print, val_print, common_val_print, val_print_string):
Update.
* value.c: Include valprint.h.
(show_values): Use get_user_print_options.
(show_convenience): Likewise.
* valprint.h (prettyprint_arrays, prettyprint_structs): Don't
declare.
(struct value_print_options): New type.
(vtblprint, unionprint, addressprint, objectprint, print_max,
inspect_it, repeat_count_threshold, output_format,
stop_print_at_null): Don't declare.
(user_print_options, get_user_print_options,
get_raw_print_options, get_formatted_print_options): Declare.
(print_array_indexes_p): Don't declare.
(maybe_print_array_index, val_print_array_elements): Update.
* valprint.c (print_max): Remove.
(user_print_options): New global.
(get_user_print_options, get_raw_print_options,
get_formatted_print_options): New functions.
(print_array_indexes, repeat_count_threshold, stop_print_at_null,
prettyprint_structs, prettyprint_arrays, unionprint,
addressprint): Remove.
(val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(common_val_print): Likewise.
(print_array_indexes_p): Remove.
(maybe_print_array_index): Remove format, pretty arguments; add
options. Update.
(val_print_array_elements): Remove format, deref_ref, pretty
arguments; add options. Update.
(val_print_string): Add options argument. Update.
(_initialize_valprint): Use user_print_options.
(output_format): Remove.
(set_output_radix_1): Use user_print_options.
* typeprint.c: Include valprint.h.
(objectprint): Don't declare.
(whatis_exp): Use get_user_print_options.
* tui/tui-regs.c: Include valprint.h.
(tui_register_format): Use get_formatted_print_options.
* tracepoint.c: Include valprint.h.
(addressprint): Don't declare.
(trace_mention): Use get_user_print_options.
(tracepoints_info): Likewise.
* stack.c (print_frame_args): Use get_raw_print_options.
(print_frame_info): Use get_user_print_options.
(print_frame): Likewise.
* sh64-tdep.c: Include valprint.h
(sh64_do_register): Use get_formatted_print_options.
* scm-valprint.c (scm_inferior_print): Remove format, deref_ref,
pretty arguments; add options.
(scm_scmlist_print): Likewise. Update.
(scm_scmval_print): Likewise.
(scm_val_print): Likewise.
(scm_value_print): Remove format, pretty arguments; add options.
Update.
* scm-lang.h (scm_value_print, scm_val_print, scm_scmval_print):
Update.
* scm-lang.c (scm_printstr): Add options argument.
* python/python-value.c: Include valprint.h.
(valpy_str): Use get_user_print_options.
* printcmd.c: Include valprint.h.
(addressprint): Don't declare.
(inspect_it): Remove.
(print_formatted): Remove format option; add options. Update.
(print_scalar_formatted): Likewise.
(print_address_demangle): Use get_user_print_options.
(do_examine): Use get_formatted_print_options.
(print_command_1): Likewise.
(output_command): Use get_formatted_print_options.
(do_one_display): Likewise.
(print_variable_value): Use get_user_print_options.
* p-valprint.c (pascal_val_print): Remove format, deref_ref,
pretty arguments; add options. Update.
(pascal_value_print): Remove format, pretty arguments; add
options. Update.
(vtblprint, objectprint): Don't declare.
(pascal_static_field_print): Remove.
(pascal_object_print_value_fields): Remove format, pretty
arguments; add options. Update.
(pascal_object_print_static_field): Likewise.
(_initialize_pascal_valprint): Use user_print_options. Update.
* p-lang.h (pascal_val_print, pascal_value_print,
pascal_printstr, pascal_object_print_value_fields): Update.
(vtblprint, static_field_print): Don't declare.
* p-lang.c (pascal_printstr): Add options argument. Update.
* objc-lang.c (objc_printstr): Add options argument. Update.
* mt-tdep.c: Include valprint.h.
(mt_registers_info): Use get_raw_print_options.
* mips-tdep.c: Include valprint.h.
(mips_print_fp_register): Use get_formatted_print_options.
(mips_print_register): Likewise.
* mi/mi-main.c: Include valprint.h.
(get_register): Use get_user_print_options.
(mi_cmd_data_evaluate_expression): Likewise.
(mi_cmd_data_read_memory): Use get_formatted_print_options.
* mi/mi-cmd-stack.c: Include valprint.h.
(list_args_or_locals): Use get_raw_print_options.
* m2-valprint.c (print_function_pointer_address): Add addressprint
argument.
(m2_print_long_set): Remove format, pretty arguments.
(m2_print_unbounded_array): Remove format, deref_ref, pretty
arguments; add options. Update.
(print_unpacked_pointer): Remove format argument; add options.
Now static. Update.
(print_variable_at_address): Remove format, deref_ref, pretty
arguments; add options. Update.
(m2_print_array_contents): Likewise.
(m2_val_print): Likewise.
* m2-lang.h (m2_val_print): Update.
* m2-lang.c (m2_printstr): Add options argument. Update.
* language.h (struct value_print_options): Declare.
(struct language_defn) <la_printstr>: Add options argument.
<la_val_print>: Remove format, deref_ref, pretty argument; add
options.
<la_value_print>: Remove format, pretty arguments; add options.
<la_print_array_index>: Likewise.
(LA_VAL_PRINT, LA_VALUE_PRINT, LA_PRINT_STRING,
LA_PRINT_ARRAY_INDEX): Update.
(default_print_array_index): Update.
* language.c (default_print_array_index): Remove format, pretty
arguments; add options. Update.
(unk_lang_printstr): Add options argument.
(unk_lang_val_print): Remove format, deref_ref, pretty arguments;
add options.
(unk_lang_value_print): Remove format, pretty arguments; add
options.
* jv-valprint.c (java_value_print): Remove format, pretty
arguments; add options. Update.
(java_print_value_fields): Likewise.
(java_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
* jv-lang.h (java_val_print, java_value_print): Declare.
* infcmd.c: Include valprint.h.
(print_return_value): Use get_raw_print_options.
(default_print_registers_info): Use get_user_print_options,
get_formatted_print_options.
(registers_info): Use get_formatted_print_options.
* gdbtypes.h (struct value_print_options): Declare.
(print_scalar_formatted): Update.
* f-valprint.c (f77_print_array_1): Remove format, deref_ref,
pretty arguments; add options. Update.
(f77_print_array): Likewise.
(f_val_print): Likewise.
* f-lang.h (f_val_print): Update.
* f-lang.c (f_printstr): Add options argument. Update.
(c_value_print): Update declaration.
* expprint.c: Include valprint.h.
(print_subexp_standard): Use get_raw_print_options,
get_user_print_options.
* eval.c: Include valprint.h.
(objectprint): Don't declare.
(evaluate_subexp_standard): Use get_user_print_options.
* cp-valprint.c (vtblprint, objectprint, static_field_print):
Remove.
(cp_print_value_fields): Remove format, pretty arguments; add
options. Update.
(cp_print_value): Likewise.
(cp_print_static_field): Likewise.
(_initialize_cp_valprint): Use user_print_options. Update.
* c-valprint.c (print_function_pointer_address): Add addressprint
argument.
(c_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(c_value_print): Add options argument. Update.
* c-lang.h (c_val_print, c_value_print, c_printstr): Update.
(vtblprint, static_field_print): Don't declare.
(cp_print_value_fields): Update.
* c-lang.c (c_printstr): Add options argument. Update.
* breakpoint.c: Include valprint.h.
(addressprint): Don't declare.
(watchpoint_value_print): Use get_user_print_options.
(print_one_breakpoint_location): Likewise.
(breakpoint_1, print_it_catch_fork, print_it_catch_vfork, mention,
print_exception_catchpoint): Likewise.
* auxv.c (fprint_target_auxv): Don't declare addressprint. Use
get_user_print_options.
* ada-valprint.c (struct ada_val_print_args): Remove format,
deref_ref, and pretty; add options.
(print_optional_low_bound): Add options argument.
(val_print_packed_array_elements): Remove format and pretty
arguments; add options. Update.
(printstr): Add options argument. Update.
(ada_printstr): Likewise.
(ada_val_print): Remove format, deref_ref, pretty arguments; add
options argument. Update.
(ada_val_print_stub): Update.
(ada_val_print_array): Remove format, deref_ref, pretty arguments;
add options. Update.
(ada_val_print_1): Likewise.
(print_variant_part): Likewise.
(ada_value_print): Remove format, pretty arguments; add options.
Update.
(print_record): Likewise.
(print_field_values): Likewise.
* ada-lang.h (ada_val_print, ada_value_print, ada_printstr):
Update.
* ada-lang.c (ada_print_array_index): Add options argument; remove
format and pretty arguments.
(print_one_exception): Use get_user_print_options.
gdb/testsuite
* gdb.base/exprs.exp (test_expr): Add enum formatting tests.
2008-10-28 18:19:58 +01:00
|
|
|
|
if (options->inspect_it)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
fputs_filtered ("\\\"", stream);
|
|
|
|
|
else
|
|
|
|
|
fputs_filtered ("\"", stream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (force_ellipses || i < length)
|
|
|
|
|
fputs_filtered ("...", stream);
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-16 19:36:51 +02:00
|
|
|
|
static struct value *
|
|
|
|
|
evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp,
|
|
|
|
|
int *pos, enum noside noside)
|
|
|
|
|
{
|
|
|
|
|
enum exp_opcode op = exp->elts[*pos].opcode;
|
|
|
|
|
struct value *arg1;
|
|
|
|
|
struct value *arg2;
|
|
|
|
|
struct type *type;
|
2010-05-16 02:18:02 +02:00
|
|
|
|
|
2007-10-16 19:36:51 +02:00
|
|
|
|
switch (op)
|
|
|
|
|
{
|
|
|
|
|
case UNOP_HIGH:
|
|
|
|
|
(*pos)++;
|
|
|
|
|
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
|
|
|
|
|
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
return arg1;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
arg1 = coerce_ref (arg1);
|
|
|
|
|
type = check_typedef (value_type (arg1));
|
|
|
|
|
|
|
|
|
|
if (m2_is_unbounded_array (type))
|
|
|
|
|
{
|
|
|
|
|
struct value *temp = arg1;
|
2010-05-16 02:18:02 +02:00
|
|
|
|
|
2007-10-16 19:36:51 +02:00
|
|
|
|
type = TYPE_FIELD_TYPE (type, 1);
|
|
|
|
|
/* i18n: Do not translate the "_m2_high" part! */
|
|
|
|
|
arg1 = value_struct_elt (&temp, NULL, "_m2_high", NULL,
|
|
|
|
|
_("unbounded structure "
|
|
|
|
|
"missing _m2_high field"));
|
|
|
|
|
|
|
|
|
|
if (value_type (arg1) != type)
|
|
|
|
|
arg1 = value_cast (type, arg1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return arg1;
|
|
|
|
|
|
|
|
|
|
case BINOP_SUBSCRIPT:
|
|
|
|
|
(*pos)++;
|
|
|
|
|
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
/* If the user attempts to subscript something that is not an
|
|
|
|
|
array or pointer type (like a plain int variable for example),
|
|
|
|
|
then report this as an error. */
|
|
|
|
|
|
|
|
|
|
arg1 = coerce_ref (arg1);
|
|
|
|
|
type = check_typedef (value_type (arg1));
|
|
|
|
|
|
|
|
|
|
if (m2_is_unbounded_array (type))
|
|
|
|
|
{
|
|
|
|
|
struct value *temp = arg1;
|
|
|
|
|
type = TYPE_FIELD_TYPE (type, 0);
|
2010-05-16 02:18:02 +02:00
|
|
|
|
if (type == NULL || (TYPE_CODE (type) != TYPE_CODE_PTR))
|
|
|
|
|
{
|
2011-01-09 04:20:33 +01:00
|
|
|
|
warning (_("internal error: unbounded "
|
|
|
|
|
"array structure is unknown"));
|
2010-05-16 02:18:02 +02:00
|
|
|
|
return evaluate_subexp_standard (expect_type, exp, pos, noside);
|
|
|
|
|
}
|
2007-10-16 19:36:51 +02:00
|
|
|
|
/* i18n: Do not translate the "_m2_contents" part! */
|
|
|
|
|
arg1 = value_struct_elt (&temp, NULL, "_m2_contents", NULL,
|
|
|
|
|
_("unbounded structure "
|
|
|
|
|
"missing _m2_contents field"));
|
|
|
|
|
|
|
|
|
|
if (value_type (arg1) != type)
|
|
|
|
|
arg1 = value_cast (type, arg1);
|
|
|
|
|
|
2011-02-28 23:55:06 +01:00
|
|
|
|
check_typedef (value_type (arg1));
|
* value.h (value_subscript, value_subscripted_rvalue,
value_bitstring_subscript, value_ptradd): Use LONGEST instead
of value as type of the index argument.
(value_ptrsub): Remove.
* valarith.c (value_subscript, value_subscripted_rvalue,
value_bitstring_subscript, value_ptradd): Use LONGEST instead
of value as type of the index argument.
(value_ptrsub): Remove.
* wrapper.h (gdb_value_subscript): Use LONGEST instead of
value as type of the index argument.
* wrapper.c (gdb_value_subscript): Likewise.
Update calls to gdb_value_subscript, value_subscript,
value_subscripted_rvalue, value_bitstring_subscript and
value_ptradd to use LONGEST instead of value as index
argument type. Use value_ptradd instead of value_ptrsub.
* ada-lang.c (ada_value_subscript, ada_value_ptr_subscript,
ada_tag_name_2): Update.
* ada-tasks.c (read_atcb): Update.
* eval.c (evaluate_subexp_standard): Update.
* valarith.c (value_subscript): Update.
* gnu-v2-abi.c (gnuv2_virtual_fn_field): Update.
* gnu-v3-abi.c (gnuv3_get_virtual_fn, gnuv3_baseclass_offset,
gnuv3_method_ptr_to_value): Update.
* jv-lang.c (evaluate_subexp_java): Update.
* m2-lang.c (evaluate_subexp_modula2): Update.
* python/python-value.c (valpy_getitem, valpy_binop): Update.
* wrapper.c (gdb_value_subscript): Update.
* varobj.c (c_describe_child): Update.
2009-06-29 15:24:41 +02:00
|
|
|
|
return value_ind (value_ptradd (arg1, value_as_long (arg2)));
|
2007-10-16 19:36:51 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (TYPE_CODE (type) != TYPE_CODE_ARRAY)
|
|
|
|
|
{
|
|
|
|
|
if (TYPE_NAME (type))
|
|
|
|
|
error (_("cannot subscript something of type `%s'"),
|
|
|
|
|
TYPE_NAME (type));
|
|
|
|
|
else
|
|
|
|
|
error (_("cannot subscript requested type"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
return value_zero (TYPE_TARGET_TYPE (type), VALUE_LVAL (arg1));
|
|
|
|
|
else
|
* value.h (value_subscript, value_subscripted_rvalue,
value_bitstring_subscript, value_ptradd): Use LONGEST instead
of value as type of the index argument.
(value_ptrsub): Remove.
* valarith.c (value_subscript, value_subscripted_rvalue,
value_bitstring_subscript, value_ptradd): Use LONGEST instead
of value as type of the index argument.
(value_ptrsub): Remove.
* wrapper.h (gdb_value_subscript): Use LONGEST instead of
value as type of the index argument.
* wrapper.c (gdb_value_subscript): Likewise.
Update calls to gdb_value_subscript, value_subscript,
value_subscripted_rvalue, value_bitstring_subscript and
value_ptradd to use LONGEST instead of value as index
argument type. Use value_ptradd instead of value_ptrsub.
* ada-lang.c (ada_value_subscript, ada_value_ptr_subscript,
ada_tag_name_2): Update.
* ada-tasks.c (read_atcb): Update.
* eval.c (evaluate_subexp_standard): Update.
* valarith.c (value_subscript): Update.
* gnu-v2-abi.c (gnuv2_virtual_fn_field): Update.
* gnu-v3-abi.c (gnuv3_get_virtual_fn, gnuv3_baseclass_offset,
gnuv3_method_ptr_to_value): Update.
* jv-lang.c (evaluate_subexp_java): Update.
* m2-lang.c (evaluate_subexp_modula2): Update.
* python/python-value.c (valpy_getitem, valpy_binop): Update.
* wrapper.c (gdb_value_subscript): Update.
* varobj.c (c_describe_child): Update.
2009-06-29 15:24:41 +02:00
|
|
|
|
return value_subscript (arg1, value_as_long (arg2));
|
2007-10-16 19:36:51 +02:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return evaluate_subexp_standard (expect_type, exp, pos, noside);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nosideret:
|
2009-07-02 14:20:18 +02:00
|
|
|
|
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1);
|
2007-10-16 19:36:51 +02:00
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
|
/* Table of operators and their precedences for printing expressions. */
|
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
|
static const struct op_print m2_op_print_tab[] =
|
|
|
|
|
{
|
|
|
|
|
{"+", BINOP_ADD, PREC_ADD, 0},
|
|
|
|
|
{"+", UNOP_PLUS, PREC_PREFIX, 0},
|
|
|
|
|
{"-", BINOP_SUB, PREC_ADD, 0},
|
|
|
|
|
{"-", UNOP_NEG, PREC_PREFIX, 0},
|
|
|
|
|
{"*", BINOP_MUL, PREC_MUL, 0},
|
|
|
|
|
{"/", BINOP_DIV, PREC_MUL, 0},
|
|
|
|
|
{"DIV", BINOP_INTDIV, PREC_MUL, 0},
|
|
|
|
|
{"MOD", BINOP_REM, PREC_MUL, 0},
|
|
|
|
|
{":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
|
|
|
|
|
{"OR", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
|
|
|
|
|
{"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
|
|
|
|
|
{"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
|
|
|
|
|
{"=", BINOP_EQUAL, PREC_EQUAL, 0},
|
|
|
|
|
{"<>", BINOP_NOTEQUAL, PREC_EQUAL, 0},
|
|
|
|
|
{"<=", BINOP_LEQ, PREC_ORDER, 0},
|
|
|
|
|
{">=", BINOP_GEQ, PREC_ORDER, 0},
|
|
|
|
|
{">", BINOP_GTR, PREC_ORDER, 0},
|
|
|
|
|
{"<", BINOP_LESS, PREC_ORDER, 0},
|
|
|
|
|
{"^", UNOP_IND, PREC_PREFIX, 0},
|
|
|
|
|
{"@", BINOP_REPEAT, PREC_REPEAT, 0},
|
|
|
|
|
{"CAP", UNOP_CAP, PREC_BUILTIN_FUNCTION, 0},
|
|
|
|
|
{"CHR", UNOP_CHR, PREC_BUILTIN_FUNCTION, 0},
|
|
|
|
|
{"ORD", UNOP_ORD, PREC_BUILTIN_FUNCTION, 0},
|
|
|
|
|
{"FLOAT", UNOP_FLOAT, PREC_BUILTIN_FUNCTION, 0},
|
|
|
|
|
{"HIGH", UNOP_HIGH, PREC_BUILTIN_FUNCTION, 0},
|
|
|
|
|
{"MAX", UNOP_MAX, PREC_BUILTIN_FUNCTION, 0},
|
|
|
|
|
{"MIN", UNOP_MIN, PREC_BUILTIN_FUNCTION, 0},
|
|
|
|
|
{"ODD", UNOP_ODD, PREC_BUILTIN_FUNCTION, 0},
|
|
|
|
|
{"TRUNC", UNOP_TRUNC, PREC_BUILTIN_FUNCTION, 0},
|
|
|
|
|
{NULL, 0, 0, 0}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* The built-in types of Modula-2. */
|
|
|
|
|
|
2007-06-16 19:23:12 +02:00
|
|
|
|
enum m2_primitive_types {
|
|
|
|
|
m2_primitive_type_char,
|
|
|
|
|
m2_primitive_type_int,
|
|
|
|
|
m2_primitive_type_card,
|
|
|
|
|
m2_primitive_type_real,
|
|
|
|
|
m2_primitive_type_bool,
|
|
|
|
|
nr_m2_primitive_types
|
1999-04-16 03:35:26 +02:00
|
|
|
|
};
|
|
|
|
|
|
2007-06-16 19:23:12 +02:00
|
|
|
|
static void
|
|
|
|
|
m2_language_arch_info (struct gdbarch *gdbarch,
|
|
|
|
|
struct language_arch_info *lai)
|
|
|
|
|
{
|
2007-06-16 22:10:51 +02:00
|
|
|
|
const struct builtin_m2_type *builtin = builtin_m2_type (gdbarch);
|
|
|
|
|
|
|
|
|
|
lai->string_char_type = builtin->builtin_char;
|
2007-06-16 19:23:12 +02:00
|
|
|
|
lai->primitive_type_vector
|
|
|
|
|
= GDBARCH_OBSTACK_CALLOC (gdbarch, nr_m2_primitive_types + 1,
|
|
|
|
|
struct type *);
|
|
|
|
|
|
|
|
|
|
lai->primitive_type_vector [m2_primitive_type_char]
|
2007-06-16 22:10:51 +02:00
|
|
|
|
= builtin->builtin_char;
|
2007-06-16 19:23:12 +02:00
|
|
|
|
lai->primitive_type_vector [m2_primitive_type_int]
|
2007-06-16 22:10:51 +02:00
|
|
|
|
= builtin->builtin_int;
|
2007-06-16 19:23:12 +02:00
|
|
|
|
lai->primitive_type_vector [m2_primitive_type_card]
|
2007-06-16 22:10:51 +02:00
|
|
|
|
= builtin->builtin_card;
|
2007-06-16 19:23:12 +02:00
|
|
|
|
lai->primitive_type_vector [m2_primitive_type_real]
|
2007-06-16 22:10:51 +02:00
|
|
|
|
= builtin->builtin_real;
|
2007-06-16 19:23:12 +02:00
|
|
|
|
lai->primitive_type_vector [m2_primitive_type_bool]
|
2007-06-16 22:10:51 +02:00
|
|
|
|
= builtin->builtin_bool;
|
2008-09-11 16:11:40 +02:00
|
|
|
|
|
|
|
|
|
lai->bool_type_symbol = "BOOLEAN";
|
|
|
|
|
lai->bool_type_default = builtin->builtin_bool;
|
2007-06-16 19:23:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
2007-10-16 19:36:51 +02:00
|
|
|
|
const struct exp_descriptor exp_descriptor_modula2 =
|
|
|
|
|
{
|
|
|
|
|
print_subexp_standard,
|
|
|
|
|
operator_length_standard,
|
2010-04-23 01:15:43 +02:00
|
|
|
|
operator_check_standard,
|
2007-10-16 19:36:51 +02:00
|
|
|
|
op_name_standard,
|
|
|
|
|
dump_subexp_body_standard,
|
|
|
|
|
evaluate_subexp_modula2
|
|
|
|
|
};
|
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
|
const struct language_defn m2_language_defn =
|
|
|
|
|
{
|
1999-04-16 03:35:26 +02:00
|
|
|
|
"modula-2",
|
|
|
|
|
language_m2,
|
|
|
|
|
range_check_on,
|
|
|
|
|
type_check_on,
|
2000-08-10 Jimmy Guo <guo@cup.hp.com>
* c-lang.c: Set case sensitivity on for c_language_defn,
cplus_language_defn, and asm_language_defn.
* ch-lang.c: Set case sensitivity on for chill_language_defn.
* f-lang.c: Set case sensivitity off for f_language_defn.
* jv-lang.c: Set case sensitivity on for java_language_defn.
* language.h: Add enum case_mode, case_sensitivity.
* language.c: Define case_mode, case_sensitivity. Set case
sensitivity on for unknown_language_defn, auto_language_defn,
and local_language_defn.
(show_case_command,set_case_command,set_case_str): New static func.
(set_type_range_case): New static func, replaces set_type_range ().
(set_language_command,set_type_command,set_range_command,set_language):
Call set_type_range_case ().
(language_info): Print case sensitivity setting.
(_initialize_language): Add set/show commands for 'case-sensitive'.
Set default case mode 'auto'. Set default language 'auto'.
* m2-lang.c: Set case sensitivity on for m2_language_defn.
* p-lang.c: Set case sensitivity on for pascal_language_defn.
* scm-lang.c: Set case sensitivity off for scm_language_defn.
* symtab.c (lookup_symbol): Downcase symbol name if case sensivitity
is off.
2000-08-11 03:02:35 +02:00
|
|
|
|
case_sensitive_on,
|
2004-08-29 12:12:24 +02:00
|
|
|
|
array_row_major,
|
2008-09-30 19:21:28 +02:00
|
|
|
|
macro_expansion_no,
|
2007-10-16 19:36:51 +02:00
|
|
|
|
&exp_descriptor_modula2,
|
1999-04-16 03:35:26 +02:00
|
|
|
|
m2_parse, /* parser */
|
|
|
|
|
m2_error, /* parser error function */
|
2004-04-11 00:10:01 +02:00
|
|
|
|
null_post_parser,
|
1999-04-16 03:35:26 +02:00
|
|
|
|
m2_printchar, /* Print character constant */
|
|
|
|
|
m2_printstr, /* function to print string constant */
|
|
|
|
|
m2_emit_char, /* Function to print a single character */
|
|
|
|
|
m2_print_type, /* Print a type using appropriate syntax */
|
2008-09-27 23:29:30 +02:00
|
|
|
|
m2_print_typedef, /* Print a typedef using appropriate syntax */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
m2_val_print, /* Print a value using appropriate syntax */
|
|
|
|
|
c_value_print, /* Print a top-level value */
|
2003-03-26 04:39:44 +01:00
|
|
|
|
NULL, /* Language specific skip_trampoline */
|
2008-04-06 10:56:37 +02:00
|
|
|
|
NULL, /* name_of_this */
|
2003-05-20 03:55:18 +02:00
|
|
|
|
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
|
2004-01-24 00:03:31 +01:00
|
|
|
|
basic_lookup_transparent_type,/* lookup_transparent_type */
|
2003-04-02 05:02:46 +02:00
|
|
|
|
NULL, /* Language specific symbol demangler */
|
2011-01-09 04:20:33 +01:00
|
|
|
|
NULL, /* Language specific
|
|
|
|
|
class_name_from_physname */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
m2_op_print_tab, /* expression operators for printing */
|
|
|
|
|
0, /* arrays are first-class (not c-style) */
|
|
|
|
|
0, /* String lower bound */
|
2003-10-07 00:38:03 +02:00
|
|
|
|
default_word_break_characters,
|
2008-02-05 23:17:41 +01:00
|
|
|
|
default_make_symbol_completion_list,
|
2007-06-16 19:23:12 +02:00
|
|
|
|
m2_language_arch_info,
|
2005-10-03 23:21:20 +02:00
|
|
|
|
default_print_array_index,
|
2007-09-23 18:25:06 +02:00
|
|
|
|
default_pass_by_reference,
|
2009-02-05 13:16:25 +01:00
|
|
|
|
default_get_string,
|
the "ambiguous linespec" series
gdb
2011-12-06 Joel Brobecker <brobecker@acacore.com>
* language.h (struct language_defn): Add new component
la_symbol_name_compare.
* symfile.h (struct quick_symbol_functions): Update the profile
of parameter "name_matcher" for the expand_symtabs_matching
method. Update the documentation accordingly.
* ada-lang.h (ada_name_for_lookup): Add declaration.
* ada-lang.c (ada_name_for_lookup): New function, extracted out
from ada_iterate_over_symbols.
(ada_iterate_over_symbols): Do not encode symbol name anymore.
(ada_expand_partial_symbol_name): Adjust profile.
(ada_language_defn): Add value for la_symbol_name_compare field.
* linespec.c: #include "ada-lang.h".
(iterate_name_matcher): Add language parameter. Replace call
to strcmp_iw by call to language->la_symbol_name_compare.
(decode_variable): Encode COPY if current language is Ada.
* dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile
of name_matcher parameter. Adjust call to name_matcher.
* psymtab.c (expand_symtabs_matching_via_partial): Likewise.
(expand_partial_symbol_names): Update profile of parameter "fun".
* psymtab.h (expand_partial_symbol_names): Update profile of
parameter "fun".
* symtab.c (demangle_for_lookup): Update function documentation.
(search_symbols_name_matches): Add language parameter.
(expand_partial_symbol_name): Likewise.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Add value for
la_symbol_name_compare field.
* d-lang.c (d_language_defn): Likewise.
* f-lang.c (f_language_defn): Ditto.
* jv-lang.c (java_language_defn): Ditto.
* m2-lang.c (m2_language_defn): Ditto.
* objc-lang.c (objc_language_defn): Ditto.
* opencl-lang.c (opencl_language_defn): Ditto.
* p-lang.c (pascal_language_defn): Ditto.
* language.c (unknown_language_defn, auto_language_defn)
(local_language_defn): Ditto.
2011-12-06 Tom Tromey <tromey@redhat.com>
* linespec.c (iterate_over_all_matching_symtabs): Use
LA_ITERATE_OVER_SYMBOLS.
(lookup_prefix_sym, add_matching_symbols_to_info): Likewise.
(find_function_symbols, decode_variable): Remove Ada special
case.
* language.h (struct language_defn) <la_iterate_over_symbols>: New
field.
(LA_ITERATE_OVER_SYMBOLS): New macro.
* language.c (unknown_language_defn, auto_language_defn)
(local_language_defn): Update.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Update.
* d-lang.c (d_language_defn): Update.
* f-lang.c (f_language_defn): Update.
* jv-lang.c (java_language_defn): Update.
* m2-lang.c (m2_language_defn): Update.
* objc-lang.c (objc_language_defn): Update.
* opencl-lang.c (opencl_language_defn): Update.
* p-lang.c (pascal_language_defn): Update.
* ada-lang.c (ada_iterate_over_symbols): New function.
(ada_language_defn): Update.
2011-12-06 Tom Tromey <tromey@redhat.com>
Joel Brobecker <brobecker@acacore.com>
PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366,
PR objc/8535, PR breakpoints/11657, PR breakpoints/11970,
PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856,
PR shlibs/8929, PR shlibs/7393:
* python/py-type.c (compare_maybe_null_strings): Rename from
compare_strings.
(check_types_equal): Update.
* utils.c (compare_strings): New function.
* tui/tui-winsource.c (tui_update_breakpoint_info): Update for
location changes.
* tracepoint.c (scope_info): Update.
(trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE.
* symtab.h (iterate_over_minimal_symbols)
(iterate_over_some_symtabs, iterate_over_symtabs)
(find_pcs_for_symtab_line, iterate_over_symbols)
(demangle_for_lookup): Declare.
(expand_line_sal): Remove.
* symtab.c (iterate_over_some_symtabs, iterate_over_symtabs)
(lookup_symtab_callback): New functions.
(lookup_symtab): Rewrite.
(demangle_for_lookup): New function, extract from
lookup_symbol_in_language.
(lookup_symbol_in_language): Use it.
(iterate_over_symbols): New function.
(find_line_symtab): Update.
(find_pcs_for_symtab_line): New functions.
(find_line_common): Add 'start' argument.
(decode_line_spec): Update. Change argument to 'flags', change
interpretation.
(append_expanded_sal): Remove.
(append_exact_match_to_sals): Remove.
(expand_line_sal): Remove.
* symfile.h (struct quick_symbol_functions) <lookup_symtab>:
Remove.
<map_symtabs_matching_filename>: New field.
* stack.c (func_command): Only look in the current program space.
Use DECODE_LINE_FUNFIRSTLINE.
* source.c (line_info): Set pspace on sal. Check program space in
the loop. Use DECODE_LINE_LIST_MODE.
(select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE.
* solib-target.c: Remove DEF_VEC_I(CORE_ADDR).
* python/python.c (gdbpy_decode_line): Update.
* psymtab.c (partial_map_expand_apply): New function.
(partial_map_symtabs_matching_filename): Rename from
lookup_partial_symbol. Update arguments.
(lookup_symtab_via_partial_symtab): Remove.
(psym_functions): Update.
* objc-lang.h (parse_selector, parse_method): Don't declare.
(find_imps): Update.
* objc-lang.c (parse_selector, parse_method): Now static.
(find_methods): Change arguments. Fill in a vector of symbol
names.
(uniquify_strings): New function.
(find_imps): Change arguments.
* minsyms.c (iterate_over_minimal_symbols): New function.
* linespec.h (enum decode_line_flags): New.
(struct linespec_sals): New.
(struct linespec_result) <canonical>: Remove.
<pre_expanded, addr_string, sals>: New fields.
(destroy_linespec_result, make_cleanup_destroy_linespec_result)
(decode_line_full): Declare.
(decode_line_1): Update.
* linespec.c (struct address_entry, struct linespec_state, struct
collect_info): New types.
(add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry)
(eq_address_entry, maybe_add_address): New functions.
(total_number_of_methods): Remove.
(iterate_name_matcher, iterate_over_all_matching_symtabs): New
functions.
(find_methods): Change arguments. Don't canonicalize input.
Simplify logic.
(add_matching_methods, add_constructors)
(build_canonical_line_spec): Remove.
(filter_results, convert_results_to_lsals): New functions.
(decode_line_2): Change arguments. Rewrite for new data
structures.
(decode_line_internal): Rename from decode_line_1. Change
arguments. Add cleanups. Update for new data structures.
(linespec_state_constructor, linespec_state_destructor)
(decode_line_full, decode_line_1): New functions.
(decode_indirect): Change arguments. Update.
(locate_first_half): Use skip_spaces.
(decode_objc): Change arguments. Update for new data structures.
Simplify logic.
(decode_compound): Change arguments. Add cleanups. Remove
fallback code, replace with error.
(struct decode_compound_collector): New type.
(collect_one_symbol): New function.
(lookup_prefix_sym): Change arguments. Update.
(compare_symbol_name, add_all_symbol_names_from_pspace)
(find_superclass_methods ): New functions.
(find_method): Rewrite.
(struct symtab_collector): New type.
(add_symtabs_to_list, collect_symtabs_from_filename): New
functions.
(symtabs_from_filename): Change API. Rename from
symtab_from_filename.
(collect_function_symbols): New function.
(find_function_symbols): Change API. Rename from
find_function_symbol. Rewrite.
(decode_all_digits): Change arguments. Rewrite.
(decode_dollar): Change arguments. Use decode_variable.
(decode_label): Change arguments. Rewrite.
(collect_symbols): New function.
(minsym_found): Change arguments. Rewrite.
(check_minsym, search_minsyms_for_name)
(add_matching_symbols_to_info): New function.
(decode_variable): Change arguments. Iterate over all symbols.
(symbol_found): Remove.
(symbol_to_sal): New function.
(init_linespec_result, destroy_linespec_result)
(cleanup_linespec_result, make_cleanup_destroy_linespec_result):
New functions.
(decode_digits_list_mode, decode_digits_ordinary): New functions.
* dwarf2read.c (dw2_map_expand_apply): New function.
(dw2_map_symtabs_matching_filename): Rename from
dw2_lookup_symtab. Change arguments.
(dwarf2_gdb_index_functions): Update.
* dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR).
* defs.h (compare_strings): Declare.
* cli/cli-cmds.c (compare_strings): Move to utils.c.
(edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call
filter_sals.
(compare_symtabs, filter_sals): New functions.
* breakpoint.h (struct bp_location) <line_number, source_file>:
New fields.
(struct breakpoint) <line_number, source_file>: Remove.
<filter>: New field.
* breakpoint.c (print_breakpoint_location, init_raw_breakpoint)
(momentary_breakpoint_from_master, add_location_to_breakpoint):
Update for changes to locations.
(init_breakpoint_sal): Add 'filter' argument. Set 'filter' on
breakpoint.
(create_breakpoint_sal): Add 'filter' argument.
(remove_sal, expand_line_sal_maybe): Remove.
(create_breakpoints_sal): Remove 'sals' argument. Handle
pre-expanded sals and the filter.
(parse_breakpoint_sals): Use decode_line_full.
(check_fast_tracepoint_sals): Use get_sal_arch.
(create_breakpoint): Create a linespec_sals. Update.
(break_range_command): Use decode_line_full. Update.
(until_break_command): Update.
(clear_command): Update match conditions for linespec.c changes.
Use DECODE_LINE_LIST_MODE.
(say_where): Update for changes to locations.
(bp_location_dtor): Free 'source_file'.
(base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'.
(update_static_tracepoint): Update for changes to locations.
(update_breakpoint_locations): Disable ranged breakpoint if too
many locations match. Update.
(addr_string_to_sals): Use decode_line_full. Resolve all sal
PCs.
(breakpoint_re_set_default): Don't call expand_line_sal_maybe.
(decode_line_spec_1): Update. Change argument name to 'flags',
change interpretation.
* block.h (block_containing_function): Declare.
* block.c (block_containing_function): New function.
* skip.c (skip_function_command): Update.
(skip_re_set): Update.
* infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE.
* mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE.
* NEWS: Add entry.
2011-12-06 Tom Tromey <tromey@redhat.com>
* elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow
breakpoint's pspace to be NULL.
* breakpoint.h (struct breakpoint) <pspace>: Update comment.
* breakpoint.c (init_raw_breakpoint): Conditionally set
breakpoint's pspace.
(init_breakpoint_sal): Don't set breakpoint's pspace.
(prepare_re_set_context): Conditionally switch program space.
(addr_string_to_sals): Check executing_startup on location's
program space.
2011-12-06 Tom Tromey <tromey@redhat.com>
* breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove.
* breakpoint.c (should_be_inserted): Explicitly check if program
space is executing startup.
(describe_other_breakpoints): Update.
(disable_breakpoints_before_startup): Change executing_startup
earlier. Remove loop.
(enable_breakpoints_after_startup): Likewise.
(init_breakpoint_sal): Don't use bp_startup_disabled.
(create_breakpoint): Don't use bp_startup_disabled.
(update_global_location_list): Use should_be_inserted.
(bkpt_re_set): Update.
gdb/testsuite
2011-12-06 Joel Brobecker <brobecker@acacore.com>
* gdb.ada/fullname_bp.exp: Add tests for other valid linespecs
involving a fully qualified function name.
2011-12-06 Tom Tromey <tromey@redhat.com>
* gdb.ada/homonym.exp: Add three breakpoint tests.
2011-12-06 Tom Tromey <tromey@redhat.com>
* gdb.base/solib-weak.exp (do_test): Remove kfail.
* gdb.trace/tracecmd.exp: Disable pending breakpoints earlier.
* gdb.objc/objcdecode.exp: Update for output changes.
* gdb.linespec/linespec.exp: New file.
* gdb.linespec/lspec.cc: New file.
* gdb.linespec/lspec.h: New file.
* gdb.linespec/body.h: New file.
* gdb.linespec/base/two/thefile.cc: New file.
* gdb.linespec/base/one/thefile.cc: New file.
* gdb.linespec/Makefile.in: New file.
* gdb.cp/templates.exp (test_template_breakpoints): Update for
output changes.
* gdb.cp/re-set-overloaded.exp: Remove kfail.
* gdb.cp/ovldbreak.exp: Update for output changes. "all" test now
makes one breakpoint.
* gdb.cp/method2.exp (test_break): Update for output changes.
* gdb.cp/mb-templates.exp: Update for output changes.
* gdb.cp/mb-inline.exp: Update for output changes.
* gdb.cp/mb-ctor.exp: Update for output changes.
* gdb.cp/ovsrch.exp: Use fully-qualified names.
* gdb.base/solib-symbol.exp: Run to main later. Breakpoint now
has multiple matches.
* gdb.base/sepdebug.exp: Disable pending breakpoints. Update for
error message change.
* gdb.base/list.exp (test_list_filename_and_number): Update for
error message change.
* gdb.base/break.exp: Disable pending breakpoints. Update for
output changes.
* configure.ac: Add gdb.linespec.
* configure: Rebuild.
* Makefile.in (ALL_SUBDIRS): Add gdb.linespec.
gdb/doc
2011-12-06 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
|
|
|
|
strcmp_iw_ordered,
|
|
|
|
|
iterate_over_symbols,
|
1999-04-16 03:35:26 +02:00
|
|
|
|
LANG_MAGIC
|
|
|
|
|
};
|
|
|
|
|
|
2007-06-16 22:10:51 +02:00
|
|
|
|
static void *
|
|
|
|
|
build_m2_types (struct gdbarch *gdbarch)
|
1999-04-16 03:35:26 +02:00
|
|
|
|
{
|
2007-06-16 22:10:51 +02:00
|
|
|
|
struct builtin_m2_type *builtin_m2_type
|
|
|
|
|
= GDBARCH_OBSTACK_ZALLOC (gdbarch, struct builtin_m2_type);
|
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
|
/* Modula-2 "pervasive" types. NOTE: these can be redefined!!! */
|
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
(TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement.
(alloc_type_arch): Add prototype.
(alloc_type_copy): Likewise.
(get_type_arch): Likewise.
(arch_type): Likewise.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
* gdbtypes.c (alloc_type): No longer support NULL objfile.
(init_type): Likewise.
(alloc_type_arch): New function.
(alloc_type_copy): New function.
(get_type_arch): New function.
(smash_type): Preserve type ownership information.
(make_pointer_type, make_reference_type, make_function_type,
smash_to_memberptr_type, smash_to_method_type): No longer
preserve OBJFILE across smash_type calls.
(make_pointer_type, make_reference_type, make_function_type,
lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method,
create_range_type, create_array_type, create_set_type, copy_type):
Use alloc_type_copy when allocating types.
(check_typedef): Use alloc_type_arch.
(copy_type_recursive): Likewise. Preserve type ownership data
after copying type.
(recursive_dump_type): Dump type ownership data.
(alloc_type_instance): Update type ownership check.
(copy_type, copy_type_recursive): Likewise.
(arch_type): New function.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(append_flags_type_flag): Move down.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
(append_composite_type_field_aligned,
append_composite_type_field): Move down.
* gdbarch.c (gdbtypes_post_init): Allocate all types
using per-architecture routines.
* ada-lang.c (ada_language_arch_info): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* jv-lang.c (build_java_types): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* scm-lang.c (build_scm_types): Likewise.
* ada-lang.c (ada_type_of_array): Use alloc_type_copy.
(packed_array_type): Likewise.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_variant_branch_type): Likewise.
(to_fixed_array_type): Likewise.
(to_fixed_range_type): Likewise.
(empty_record): Use type instead of objfile argument.
Use alloc_type_copy.
(to_fixed_variant_branch_type): Update call to empty_record.
* jv-lang.c (type_from_class): Use alloc_type_arch.
* arm-tdep.c (arm_ext_type): Allocate per-architecture type.
* i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type,
i386_mmx_type, i386_sse_type): Likewise.
* ia64-tdep.c (ia64_ext_type): Likewise.
* m32c-tdep.c (make_types): Likewise.
* m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type,
sparc64_fprs_type): Likewise.
* spu-tdep.c (spu_builtin_type_vec128): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* linux-tdep.c (linux_get_siginfo_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
2009-07-02 14:55:30 +02:00
|
|
|
|
builtin_m2_type->builtin_int
|
|
|
|
|
= arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "INTEGER");
|
|
|
|
|
builtin_m2_type->builtin_card
|
|
|
|
|
= arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "CARDINAL");
|
|
|
|
|
builtin_m2_type->builtin_real
|
|
|
|
|
= arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "REAL", NULL);
|
|
|
|
|
builtin_m2_type->builtin_char
|
|
|
|
|
= arch_character_type (gdbarch, TARGET_CHAR_BIT, 1, "CHAR");
|
|
|
|
|
builtin_m2_type->builtin_bool
|
|
|
|
|
= arch_boolean_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "BOOLEAN");
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
2007-06-16 22:10:51 +02:00
|
|
|
|
return builtin_m2_type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static struct gdbarch_data *m2_type_data;
|
|
|
|
|
|
|
|
|
|
const struct builtin_m2_type *
|
|
|
|
|
builtin_m2_type (struct gdbarch *gdbarch)
|
|
|
|
|
{
|
|
|
|
|
return gdbarch_data (gdbarch, m2_type_data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Initialization for Modula-2 */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_initialize_m2_language (void)
|
|
|
|
|
{
|
|
|
|
|
m2_type_data = gdbarch_data_register_post_init (build_m2_types);
|
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
|
add_language (&m2_language_defn);
|
|
|
|
|
}
|