GDB (xrefs)

Classes | Macros | Functions | Variables
/tmp/gdb-8.1/gdb/charset.c File Reference
`#include "defs.h"`
`#include "charset.h"`
`#include "gdbcmd.h"`
`#include "gdb_obstack.h"`
`#include "gdb_wait.h"`
`#include "charset-list.h"`
`#include "vec.h"`
`#include "environ.h"`
`#include "arch-utils.h"`
`#include "gdb_vecs.h"`
`#include <ctype.h>`

Go to the source code of this file.

## Classes
class | iconv_wrapper

## Macros
#define | GDB_DEFAULT_HOST_CHARSET "ISO-8859-1"
#define | GDB_DEFAULT_TARGET_CHARSET GDB_DEFAULT_HOST_CHARSET
#define | GDB_DEFAULT_TARGET_WIDE_CHARSET "UTF-32"
#define | DEFAULT_CHARSET_NAMES GDB_DEFAULT_HOST_CHARSET ,
#define | iconv_t int
#define | iconv_open phony_iconv_open
#define | iconv phony_iconv
#define | iconv_close phony_iconv_close
#define | ICONV_CONST const

## Functions
static iconv_t | phony_iconv_open (const char *to, const char *from)
static int | phony_iconv_close (iconv_t arg)
static size_t | phony_iconv (iconv_t utf_flag, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
static void | show_host_charset_name (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void | show_target_charset_name (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void | show_target_wide_charset_name (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void | set_be_le_names (struct gdbarch *gdbarch)
static void | validate (struct gdbarch *gdbarch)
static void | set_charset_sfunc (const char *charset, int from_tty, struct cmd_list_element *c)
static void | set_host_charset_sfunc (const char *charset, int from_tty, struct cmd_list_element *c)
static void | set_target_charset_sfunc (const char *charset, int from_tty, struct cmd_list_element *c)
static void | set_target_wide_charset_sfunc (const char *charset, int from_tty, struct cmd_list_element *c)
static void | show_charset (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *name)
const char * | host_charset (void)
const char * | target_charset (struct gdbarch *gdbarch)
const char * | target_wide_charset (struct gdbarch *gdbarch)
char | host_letter_to_control_character (char c)
int | host_hex_value (char c)
void | convert_between_encodings (const char *from, const char *to, const gdb_byte *bytes, unsigned int num_bytes, int width, struct obstack *output, enum transliterations translit)
static | VEC (char_ptr)
const char * | default_auto_charset (void)
const char * | default_auto_wide_charset (void)
void | _initialize_charset (void)

## Variables
static const char * | auto_host_charset_name = GDB_DEFAULT_HOST_CHARSET
static const char * | host_charset_name = "auto"
static const char * | target_charset_name = "auto"
static const char * | target_wide_charset_name = "auto"
static const char * | default_charset_names []
static const char ** | charset_enum
static const char * | target_wide_charset_be_name
static const char * | target_wide_charset_le_name
static struct gdbarch * | be_le_arch
static const char * | auto_target_charset_name = GDB_DEFAULT_TARGET_CHARSET

## Macro Definition Documentation

## ◆ DEFAULT_CHARSET_NAMES

#define DEFAULT_CHARSET_NAMES GDB_DEFAULT_HOST_CHARSET ,

Definition at line 88 of file charset.c.

## ◆ GDB_DEFAULT_HOST_CHARSET

#define GDB_DEFAULT_HOST_CHARSET "ISO-8859-1"

Definition at line 83 of file charset.c.

Referenced by phony_iconv_open(), and VEC().

## ◆ GDB_DEFAULT_TARGET_CHARSET

#define GDB_DEFAULT_TARGET_CHARSET GDB_DEFAULT_HOST_CHARSET

Definition at line 85 of file charset.c.

## ◆ GDB_DEFAULT_TARGET_WIDE_CHARSET

#define GDB_DEFAULT_TARGET_WIDE_CHARSET "UTF-32"

Definition at line 86 of file charset.c.

Referenced by default_auto_wide_charset().

## ◆ iconv

#define iconv phony_iconv

Definition at line 95 of file charset.c.

Referenced by iconv_wrapper::convert(), and wchar_iterator::iterate().

## ◆ iconv_close

#define iconv_close phony_iconv_close

Definition at line 97 of file charset.c.

Referenced by validate(), iconv_wrapper::~iconv_wrapper(), and wchar_iterator::~wchar_iterator().

## ◆ ICONV_CONST

#define ICONV_CONST const

Definition at line 100 of file charset.c.

Referenced by convert_between_encodings(), and wchar_iterator::iterate().

## ◆ iconv_open

#define iconv_open phony_iconv_open

Definition at line 93 of file charset.c.

Referenced by iconv_wrapper::iconv_wrapper(), validate(), and wchar_iterator::wchar_iterator().

## ◆ iconv_t

#define iconv_t int

Definition at line 91 of file charset.c.

Referenced by iconv_wrapper::iconv_wrapper(), validate(), wchar_iterator::wchar_iterator(), and wchar_iterator::~wchar_iterator().

## Function Documentation

## ◆ _initialize_charset()

void _initialize_charset | ( | void |  | ) |

Definition at line 994 of file charset.c.

References _, add_setshow_enum_cmd(), auto_host_charset_name, auto_target_charset_name, charset_enum, class_support, CODESET, default_charset_names, host_charset_name, nl_langinfo(), set_charset_sfunc(), set_host_charset_sfunc(), set_target_charset_sfunc(), set_target_wide_charset_sfunc(), setlist, show_charset(), show_host_charset_name(), show_target_charset_name(), show_target_wide_charset_name(), showlist, target_charset_name, target_wide_charset_name, VEC_address, VEC_length, and VEC_safe_push.

## ◆ convert_between_encodings()

void convert_between_encodings | ( | const char * | from,
|  | const char * | to,
|  | const gdb_byte * | bytes,
|  | unsigned int | num_bytes,
|  | int | width,
|  | struct obstack * | output,
|  | enum transliterations | translit
| ) |  |

Definition at line 512 of file charset.c.

References _, iconv_wrapper::convert(), error(), ICONV_CONST, obstack_grow_str, perror_with_name(), translit_none, and xsnprintf().

Referenced by convert_ucn(), generic_emit_char(), generic_printstr(), host_char_to_target(), lex_string(), parse_one_string(), printf_wide_c_string(), and ui_printf().

## ◆ default_auto_charset()

const char* default_auto_charset | ( | void |  | ) |

Definition at line 917 of file charset.c.

References auto_target_charset_name.

Referenced by gdbarch_alloc().

## ◆ default_auto_wide_charset()

const char* default_auto_wide_charset | ( | void |  | ) |

Definition at line 923 of file charset.c.

References GDB_DEFAULT_TARGET_WIDE_CHARSET.

Referenced by gdbarch_alloc().

## ◆ host_charset()

const char* host_charset | ( | void |  | ) |

Definition at line 417 of file charset.c.

References auto_host_charset_name, and host_charset_name.

Referenced by cmdpy_completer_helper(), cmdpy_function(), cmdscm_add_completion(), cmdscm_completer(), cmdscm_function(), frapy_name(), gdbpy_frame_stop_reason_string(), gdbpy_target_charset(), gdbpy_target_wide_charset(), gdbscm_scm_from_host_string(), gdbscm_scm_to_host_string(), gdbscm_value_print(), generic_emit_char(), generic_printstr(), host_char_to_target(), host_string_to_python_string(), parse_one_string(), printf_wide_c_string(), python_string_to_host_string(), python_string_to_unicode(), typy_str(), ui_printf(), validate(), and valpy_str().

## ◆ host_hex_value()

int host_hex_value | ( | char | c | ) |

Definition at line 471 of file charset.c.

References gdb_assert.

Referenced by convert_hex(), convert_octal(), convert_ucn(), mi_parse_escape(), objfpy_build_id_matches(), and parse_escape().

## ◆ host_letter_to_control_character()

char host_letter_to_control_character | ( | char | c | ) |

Definition at line 460 of file charset.c.

## ◆ phony_iconv()

static size_t phony_iconv | ( | iconv_t | utf_flag,
|  | const char ** | inbuf,
|  | size_t * | inbytesleft,
|  | char ** | outbuf,
|  | size_t * | outbytesleft
| ) |  |
| static

Definition at line 132 of file charset.c.

References extract_unsigned_integer().

## ◆ phony_iconv_close()

static int phony_iconv_close | ( | iconv_t | arg | ) |
| static

Definition at line 126 of file charset.c.

## ◆ phony_iconv_open()

static iconv_t phony_iconv_open | ( | const char * | to,
|  | const char * | from
| ) |  |
| static

Definition at line 108 of file charset.c.

References GDB_DEFAULT_HOST_CHARSET.

## ◆ set_be_le_names()

static void set_be_le_names | ( | struct gdbarch * | gdbarch | ) |
| static

Definition at line 296 of file charset.c.

References be_le_arch, charset_enum, gdbarch_auto_wide_charset(), target_wide_charset_be_name, target_wide_charset_le_name, and target_wide_charset_name.

Referenced by target_wide_charset().

## ◆ set_charset_sfunc()

static void set_charset_sfunc | ( | const char * | charset,
|  | int | from_tty,
|  | struct cmd_list_element * | c
| ) |  |
| static

Definition at line 368 of file charset.c.

References get_current_arch(), host_charset_name, target_charset_name, and validate().

Referenced by _initialize_charset().

## ◆ set_host_charset_sfunc()

static void set_host_charset_sfunc | ( | const char * | charset,
|  | int | from_tty,
|  | struct cmd_list_element * | c
| ) |  |
| static

Definition at line 379 of file charset.c.

References get_current_arch(), and validate().

Referenced by _initialize_charset().

## ◆ set_target_charset_sfunc()

static void set_target_charset_sfunc | ( | const char * | charset,
|  | int | from_tty,
|  | struct cmd_list_element * | c
| ) |  |
| static

Definition at line 387 of file charset.c.

References get_current_arch(), and validate().

Referenced by _initialize_charset().

## ◆ set_target_wide_charset_sfunc()

static void set_target_wide_charset_sfunc | ( | const char * | charset,
|  | int | from_tty,
|  | struct cmd_list_element * | c
| ) |  |
| static

Definition at line 395 of file charset.c.

References get_current_arch(), and validate().

Referenced by _initialize_charset().

## ◆ show_charset()

static void show_charset | ( | struct ui_file * | file,
|  | int | from_tty,
|  | struct cmd_list_element * | c,
|  | const char * | name
| ) |  |
| static

Definition at line 403 of file charset.c.

References host_charset_name, show_host_charset_name(), show_target_charset_name(), show_target_wide_charset_name(), target_charset_name, and target_wide_charset_name.

Referenced by _initialize_charset().

## ◆ show_host_charset_name()

static void show_host_charset_name | ( | struct ui_file * | file,
|  | int | from_tty,
|  | struct cmd_list_element * | c,
|  | const char * | value
| ) |  |
| static

Definition at line 231 of file charset.c.

References _, auto_host_charset_name, and fprintf_filtered().

Referenced by _initialize_charset(), and show_charset().

## ◆ show_target_charset_name()

static void show_target_charset_name | ( | struct ui_file * | file,
|  | int | from_tty,
|  | struct cmd_list_element * | c,
|  | const char * | value
| ) |  |
| static

Definition at line 245 of file charset.c.

References _, fprintf_filtered(), gdbarch_auto_charset(), and get_current_arch().

Referenced by _initialize_charset(), and show_charset().

## ◆ show_target_wide_charset_name()

static void show_target_wide_charset_name | ( | struct ui_file * | file,
|  | int | from_tty,
|  | struct cmd_list_element * | c,
|  | const char * | value
| ) |  |
| static

Definition at line 260 of file charset.c.

References _, fprintf_filtered(), gdbarch_auto_wide_charset(), and get_current_arch().

Referenced by _initialize_charset(), and show_charset().

## ◆ target_charset()

const char* target_charset | ( | struct gdbarch * | gdbarch | ) |

Definition at line 425 of file charset.c.

References gdbarch_auto_charset(), and target_charset_name.

Referenced by charset_for_string_type(), f_get_encoding(), gdbpy_target_charset(), gdbscm_arch_charset(), host_char_to_target(), parse_escape(), ppscm_print_string_repr(), rust_emitchar(), unicode_to_target_python_string(), unicode_to_target_string(), validate(), and vlscm_convert_typed_value_from_scheme().

## ◆ target_wide_charset()

const char* target_wide_charset | ( | struct gdbarch * | gdbarch | ) |

Definition at line 433 of file charset.c.

References gdbarch::byte_order, gdbarch_auto_wide_charset(), gdbarch_byte_order(), set_be_le_names(), target_wide_charset_be_name, target_wide_charset_le_name, and target_wide_charset_name.

Referenced by charset_for_string_type(), gdbpy_target_wide_charset(), gdbscm_arch_wide_charset(), printf_wide_c_string(), and ui_printf().

## ◆ validate()

static void validate | ( | struct gdbarch * | gdbarch | ) |
| static

Definition at line 340 of file charset.c.

References _, be_le_arch, error(), gdbarch_auto_wide_charset(), host_charset(), iconv_close, iconv_open, iconv_t, target_charset(), and target_wide_charset_name.

Referenced by set_charset_sfunc(), set_host_charset_sfunc(), set_target_charset_sfunc(), and set_target_wide_charset_sfunc().

## ◆ VEC()

static VEC | ( | char_ptr |  | ) |
| static

Definition at line 710 of file charset.c.

References GDB_DEFAULT_HOST_CHARSET, and VEC_safe_push.

## Variable Documentation

## ◆ auto_host_charset_name

const char* auto_host_charset_name = GDB_DEFAULT_HOST_CHARSET
| static

Definition at line 228 of file charset.c.

Referenced by _initialize_charset(), host_charset(), and show_host_charset_name().

## ◆ auto_target_charset_name

const char* auto_target_charset_name = GDB_DEFAULT_TARGET_CHARSET
| static

Definition at line 914 of file charset.c.

Referenced by _initialize_charset(), and default_auto_charset().

## ◆ be_le_arch

struct gdbarch* be_le_arch
| static

Definition at line 290 of file charset.c.

Referenced by set_be_le_names(), and validate().

## ◆ charset_enum

const char** charset_enum
| static

Definition at line 281 of file charset.c.

Referenced by _initialize_charset(), and set_be_le_names().

## ◆ default_charset_names

const char* default_charset_names[]
| static

Initial value:
=
{
DEFAULT_CHARSET_NAMES
0
}
DEFAULT_CHARSET_NAMES
#define DEFAULT_CHARSET_NAMES
Definition: charset.c:88

Definition at line 275 of file charset.c.

Referenced by _initialize_charset().

## ◆ host_charset_name

const char* host_charset_name = "auto"
| static

Definition at line 229 of file charset.c.

Referenced by _initialize_charset(), host_charset(), set_charset_sfunc(), and show_charset().

## ◆ target_charset_name

const char* target_charset_name = "auto"
| static

Definition at line 243 of file charset.c.

Referenced by _initialize_charset(), set_charset_sfunc(), show_charset(), and target_charset().

## ◆ target_wide_charset_be_name

const char* target_wide_charset_be_name
| static

Definition at line 286 of file charset.c.

Referenced by set_be_le_names(), and target_wide_charset().

## ◆ target_wide_charset_le_name

const char* target_wide_charset_le_name
| static

Definition at line 287 of file charset.c.

Referenced by set_be_le_names(), and target_wide_charset().

## ◆ target_wide_charset_name

const char* target_wide_charset_name = "auto"
| static

Definition at line 258 of file charset.c.

Referenced by _initialize_charset(), set_be_le_names(), show_charset(), target_wide_charset(), and validate().