aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-03-05 20:18:19 +0000
committerTom Tromey <tromey@redhat.com>2010-03-05 20:18:19 +0000
commitf870a310ee7fbfd6ccaea95d632063cbdbd2b9c9 (patch)
tree62dfe8a2ba48221f364d24a689dc29c8911f856e /gdb/gdbarch.c
parent78e2826bcc9ddadf05c070c479a3f5e608654b16 (diff)
downloadgdb-f870a310ee7fbfd6ccaea95d632063cbdbd2b9c9.zip
gdb-f870a310ee7fbfd6ccaea95d632063cbdbd2b9c9.tar.gz
gdb-f870a310ee7fbfd6ccaea95d632063cbdbd2b9c9.tar.bz2
gdb
2010-03-05 Corinna Vinschen <vinschen@redhat.com> Tom Tromey <tromey@redhat.com> * utils.c (host_char_to_target): Add 'gdbarch' argument. (parse_escape): Likewise. * python/py-utils.c (unicode_to_target_string): Update. (unicode_to_target_python_string): Update. (target_string_to_unicode): Update. * printcmd.c (printf_command): Update. * p-exp.y (yylex): Update. * objc-exp.y (yylex): Update. * mi/mi-parse.c: Include charset.h. (mi_parse_escape): New function. (mi_parse_argv): Use it. * jv-exp.y (yylex): Update. * i386-cygwin-tdep.c (i386_cygwin_auto_wide_charset): New function. (i386_cygwin_init_abi): Call set_gdbarch_auto_wide_charset. * gdbarch.sh (auto_charset, auto_wide_charset): New. * gdbarch.c: Rebuild. * gdbarch.h: Rebuild. * defs.h (parse_escape): Update. * cli/cli-setshow.c: Include arch-utils.h. (do_setshow_command): Update. * cli/cli-cmds.c (echo_command): Update. * charset.h (target_charset, target_wide_charset): Update. * charset.c: Include arch-utils.h. (target_charset_name): Default to "auto". (target_wide_charset_name): Likewise. (show_target_charset_name): Handle "auto". (show_target_wide_charset_name): Likewise. (be_le_arch): New global. (set_be_le_names): Add 'gdbarch' argument. (validate): Likewise. Don't call set_be_le_names. (set_charset_sfunc, set_host_charset_sfunc) (set_target_charset_sfunc, set_target_wide_charset_sfunc): Update. (target_charset): Add 'gdbarch' argument. (target_wide_charset): Likewise. Remove 'byte_order' argument. (auto_target_charset_name): New global. (default_auto_charset, default_auto_wide_charset): New functions. (_initialize_charset): Set auto_target_charset_name. Allow "auto" for target charsets. Copy result of nl_langinfo. Use GetACP if USE_WIN32API. * c-lang.c (charset_for_string_type): Add 'gdbarch' argument, remove 'byte_order' argument. Update. (classify_type): Likewise. (c_emit_char): Update. (c_printchar): Update. (c_printstr): Update. (c_get_string): Update. (evaluate_subexp_c): Update. * arch-utils.h (default_auto_charset, default_auto_wide_charset): Declare. * python/python.c (gdbpy_target_charset): New function. (gdbpy_target_wide_charset): Likewise. (GdbMethods): Update. * NEWS: Update. gdb/doc * gdb.texinfo (Basic Python): Document target_charset and target_wide_charset. gdb/testsuite * gdb.python/py-prettyprint.py (pp_nullstr.to_string): Use gdb.target_charset. (pp_ns.to_string): Likewise.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r--gdb/gdbarch.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index cfb042b..f482572 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -253,6 +253,8 @@ struct gdbarch
gdbarch_has_shared_address_space_ftype *has_shared_address_space;
gdbarch_fast_tracepoint_valid_at_ftype *fast_tracepoint_valid_at;
const char * qsupported;
+ gdbarch_auto_charset_ftype *auto_charset;
+ gdbarch_auto_wide_charset_ftype *auto_wide_charset;
};
@@ -397,6 +399,8 @@ struct gdbarch startup_gdbarch =
default_has_shared_address_space, /* has_shared_address_space */
default_fast_tracepoint_valid_at, /* fast_tracepoint_valid_at */
0, /* qsupported */
+ default_auto_charset, /* auto_charset */
+ default_auto_wide_charset, /* auto_wide_charset */
/* startup_gdbarch() */
};
@@ -483,6 +487,8 @@ gdbarch_alloc (const struct gdbarch_info *info,
gdbarch->target_signal_to_host = default_target_signal_to_host;
gdbarch->has_shared_address_space = default_has_shared_address_space;
gdbarch->fast_tracepoint_valid_at = default_fast_tracepoint_valid_at;
+ gdbarch->auto_charset = default_auto_charset;
+ gdbarch->auto_wide_charset = default_auto_wide_charset;
/* gdbarch_alloc() */
return gdbarch;
@@ -664,6 +670,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of has_shared_address_space, invalid_p == 0 */
/* Skip verify of fast_tracepoint_valid_at, invalid_p == 0 */
/* Skip verify of qsupported, invalid_p == 0 */
+ /* Skip verify of auto_charset, invalid_p == 0 */
+ /* Skip verify of auto_wide_charset, invalid_p == 0 */
buf = ui_file_xstrdup (log, &length);
make_cleanup (xfree, buf);
if (length > 0)
@@ -720,6 +728,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: adjust_breakpoint_address = <%s>\n",
host_address_to_string (gdbarch->adjust_breakpoint_address));
fprintf_unfiltered (file,
+ "gdbarch_dump: auto_charset = <%s>\n",
+ host_address_to_string (gdbarch->auto_charset));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: auto_wide_charset = <%s>\n",
+ host_address_to_string (gdbarch->auto_wide_charset));
+ fprintf_unfiltered (file,
"gdbarch_dump: believe_pcc_promotion = %s\n",
plongest (gdbarch->believe_pcc_promotion));
fprintf_unfiltered (file,
@@ -3599,6 +3613,40 @@ set_gdbarch_qsupported (struct gdbarch *gdbarch,
gdbarch->qsupported = qsupported;
}
+const char *
+gdbarch_auto_charset (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->auto_charset != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_auto_charset called\n");
+ return gdbarch->auto_charset ();
+}
+
+void
+set_gdbarch_auto_charset (struct gdbarch *gdbarch,
+ gdbarch_auto_charset_ftype auto_charset)
+{
+ gdbarch->auto_charset = auto_charset;
+}
+
+const char *
+gdbarch_auto_wide_charset (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->auto_wide_charset != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_auto_wide_charset called\n");
+ return gdbarch->auto_wide_charset ();
+}
+
+void
+set_gdbarch_auto_wide_charset (struct gdbarch *gdbarch,
+ gdbarch_auto_wide_charset_ftype auto_wide_charset)
+{
+ gdbarch->auto_wide_charset = auto_wide_charset;
+}
+
/* Keep a registry of per-architecture data-pointers required by GDB
modules. */