GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
charset.c File Reference
#include "defs.h"
#include "charset.h"
#include "gdbcmd.h"
#include "gdbsupport/gdb_obstack.h"
#include "gdbsupport/gdb_wait.h"
#include "charset-list.h"
#include "gdbsupport/environ.h"
#include "arch-utils.h"
#include "gdbsupport/gdb_vecs.h"
#include <ctype.h>

Go to the source code of this file.

Classes

class  iconv_wrapper
 
struct  charset_vector
 

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)
 
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 void find_charset_names (void)
 
const char * default_auto_charset (void)
 
const char * default_auto_wide_charset (void)
 
void _initialize_charset ()
 

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 *const default_charset_names []
 
static const char *const * charset_enum
 
static const char * target_wide_charset_be_name
 
static const char * target_wide_charset_le_name
 
static struct gdbarchbe_le_arch
 
static charset_vector charsets
 
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 87 of file charset.c.

◆ GDB_DEFAULT_HOST_CHARSET

#define GDB_DEFAULT_HOST_CHARSET   "ISO-8859-1"

Definition at line 82 of file charset.c.

Referenced by find_charset_names(), and phony_iconv_open().

◆ GDB_DEFAULT_TARGET_CHARSET

#define GDB_DEFAULT_TARGET_CHARSET   GDB_DEFAULT_HOST_CHARSET

Definition at line 84 of file charset.c.

◆ GDB_DEFAULT_TARGET_WIDE_CHARSET

#define GDB_DEFAULT_TARGET_WIDE_CHARSET   "UTF-32"

Definition at line 85 of file charset.c.

Referenced by default_auto_wide_charset().

◆ iconv

#define iconv   phony_iconv

Definition at line 94 of file charset.c.

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

◆ iconv_close

#define iconv_close   phony_iconv_close

◆ ICONV_CONST

#define ICONV_CONST   const

Definition at line 99 of file charset.c.

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

◆ iconv_open

#define iconv_open   phony_iconv_open

◆ iconv_t

#define iconv_t   int

Function Documentation

◆ _initialize_charset()

void _initialize_charset ( )

Definition at line 988 of file charset.c.

Referenced by initialize_all_files().

◆ 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 )

◆ default_auto_charset()

const char * default_auto_charset ( void )

Definition at line 920 of file charset.c.

References auto_target_charset_name.

◆ default_auto_wide_charset()

const char * default_auto_wide_charset ( void )

Definition at line 926 of file charset.c.

References GDB_DEFAULT_TARGET_WIDE_CHARSET.

◆ find_charset_names()

static void find_charset_names ( void )
static

Definition at line 722 of file charset.c.

References charset_vector::charsets, charsets, and GDB_DEFAULT_HOST_CHARSET.

◆ host_charset()

const char * host_charset ( void )

◆ host_letter_to_control_character()

char host_letter_to_control_character ( char c)

Definition at line 459 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 131 of file charset.c.

References extract_unsigned_integer().

◆ phony_iconv_close()

static int phony_iconv_close ( iconv_t arg)
static

Definition at line 125 of file charset.c.

◆ phony_iconv_open()

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

Definition at line 107 of file charset.c.

References GDB_DEFAULT_HOST_CHARSET.

◆ set_be_le_names()

static void set_be_le_names ( struct gdbarch * gdbarch)
static

◆ set_charset_sfunc()

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

Definition at line 367 of file charset.c.

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

◆ 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 378 of file charset.c.

References get_current_arch(), and validate().

◆ 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 386 of file charset.c.

References get_current_arch(), and validate().

◆ 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 394 of file charset.c.

References get_current_arch(), and validate().

◆ show_charset()

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

◆ 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 230 of file charset.c.

References auto_host_charset_name, and gdb_printf().

Referenced by 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 244 of file charset.c.

References gdb_printf(), gdbarch_auto_charset(), and get_current_arch().

Referenced by 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 259 of file charset.c.

References gdb_printf(), gdbarch_auto_wide_charset(), and get_current_arch().

Referenced by show_charset().

◆ target_charset()

const char * target_charset ( struct gdbarch * gdbarch)

◆ target_wide_charset()

const char * target_wide_charset ( struct gdbarch * gdbarch)

◆ validate()

static void validate ( struct gdbarch * gdbarch)
static

Variable Documentation

◆ auto_host_charset_name

const char* auto_host_charset_name = GDB_DEFAULT_HOST_CHARSET
static

Definition at line 227 of file charset.c.

Referenced by 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 917 of file charset.c.

Referenced by default_auto_charset().

◆ be_le_arch

struct gdbarch* be_le_arch
static

Definition at line 289 of file charset.c.

Referenced by set_be_le_names(), and validate().

◆ charset_enum

const char* const* charset_enum
static

Definition at line 280 of file charset.c.

Referenced by set_be_le_names().

◆ charsets

charset_vector charsets
static

Definition at line 717 of file charset.c.

Referenced by find_charset_names().

◆ default_charset_names

const char* const default_charset_names[]
static
Initial value:
=
{
0
}
#define DEFAULT_CHARSET_NAMES
Definition charset.c:87

Definition at line 274 of file charset.c.

◆ host_charset_name

const char* host_charset_name = "auto"
static

Definition at line 228 of file charset.c.

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

◆ target_charset_name

const char* target_charset_name = "auto"
static

Definition at line 242 of file charset.c.

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

◆ target_wide_charset_be_name

const char* target_wide_charset_be_name
static

Definition at line 285 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 286 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 257 of file charset.c.

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