GDB (xrefs)
Classes | Macros | Functions | Variables
/tmp/gdb-7.10/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

struct  wchar_iterator
 

Macros

#define GDB_DEFAULT_HOST_CHARSET   "ISO-8859-1"
 
#define GDB_DEFAULT_TARGET_CHARSET   "ISO-8859-1"
 
#define GDB_DEFAULT_TARGET_WIDE_CHARSET   "ISO-8859-1"
 
#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 (char *charset, int from_tty, struct cmd_list_element *c)
 
static void set_host_charset_sfunc (char *charset, int from_tty, struct cmd_list_element *c)
 
static void set_target_charset_sfunc (char *charset, int from_tty, struct cmd_list_element *c)
 
static void set_target_wide_charset_sfunc (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)
 
static void cleanup_iconv (void *p)
 
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)
 
struct wchar_iteratormake_wchar_iterator (const gdb_byte *input, size_t bytes, const char *charset, size_t width)
 
static void do_cleanup_iterator (void *p)
 
struct cleanupmake_cleanup_wchar_iterator (struct wchar_iterator *iter)
 
int wchar_iterate (struct wchar_iterator *iter, enum wchar_iterate_result *out_result, gdb_wchar_t **out_chars, const gdb_byte **ptr, size_t *len)
 
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 gdbarchbe_le_arch
 
initialize_file_ftype _initialize_charset
 
static const char * auto_target_charset_name = GDB_DEFAULT_TARGET_CHARSET
 

Macro Definition Documentation

#define DEFAULT_CHARSET_NAMES   GDB_DEFAULT_HOST_CHARSET ,

Definition at line 84 of file charset.c.

#define GDB_DEFAULT_HOST_CHARSET   "ISO-8859-1"

Definition at line 80 of file charset.c.

Referenced by phony_iconv_open(), and VEC().

#define GDB_DEFAULT_TARGET_CHARSET   "ISO-8859-1"

Definition at line 81 of file charset.c.

#define GDB_DEFAULT_TARGET_WIDE_CHARSET   "ISO-8859-1"

Definition at line 82 of file charset.c.

Referenced by default_auto_wide_charset().

#define iconv   phony_iconv

Definition at line 91 of file charset.c.

Referenced by convert_between_encodings(), and wchar_iterate().

#define iconv_close   phony_iconv_close

Definition at line 93 of file charset.c.

Referenced by cleanup_iconv(), do_cleanup_iterator(), and validate().

#define ICONV_CONST   const

Definition at line 96 of file charset.c.

Referenced by convert_between_encodings(), and wchar_iterate().

#define iconv_open   phony_iconv_open

Definition at line 89 of file charset.c.

Referenced by convert_between_encodings(), make_wchar_iterator(), and validate().

#define iconv_t   int

Definition at line 87 of file charset.c.

Referenced by cleanup_iconv(), convert_between_encodings(), make_wchar_iterator(), and validate().

Function Documentation

void _initialize_charset ( void  )
static void cleanup_iconv ( void *  p)
static

Definition at line 469 of file charset.c.

References iconv_close, and iconv_t.

Referenced by 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 
)
const char* default_auto_charset ( void  )

Definition at line 934 of file charset.c.

References auto_target_charset_name.

Referenced by gdbarch_alloc().

const char* default_auto_wide_charset ( void  )

Definition at line 940 of file charset.c.

References GDB_DEFAULT_TARGET_WIDE_CHARSET.

Referenced by gdbarch_alloc().

static void do_cleanup_iterator ( void *  p)
static

Definition at line 618 of file charset.c.

References wchar_iterator::desc, iconv_close, wchar_iterator::out, and xfree().

Referenced by make_cleanup_wchar_iterator().

const char* host_charset ( void  )
int host_hex_value ( char  c)
char host_letter_to_control_character ( char  c)

Definition at line 442 of file charset.c.

struct cleanup* make_cleanup_wchar_iterator ( struct wchar_iterator iter)

Definition at line 628 of file charset.c.

References do_cleanup_iterator(), and make_cleanup().

Referenced by generic_emit_char(), and generic_printstr().

struct wchar_iterator* make_wchar_iterator ( const gdb_byte input,
size_t  bytes,
const char *  charset,
size_t  width 
)
static size_t phony_iconv ( iconv_t  utf_flag,
const char **  inbuf,
size_t *  inbytesleft,
char **  outbuf,
size_t *  outbytesleft 
)
static

Definition at line 121 of file charset.c.

static int phony_iconv_close ( iconv_t  arg)
static

Definition at line 115 of file charset.c.

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

Definition at line 99 of file charset.c.

References GDB_DEFAULT_HOST_CHARSET.

static void set_be_le_names ( struct gdbarch gdbarch)
static

Definition at line 284 of file charset.c.

References gdbarch_auto_wide_charset(), len, and target_wide_charset_name.

Referenced by target_wide_charset().

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

Definition at line 350 of file charset.c.

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

Referenced by _initialize_charset().

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

Definition at line 361 of file charset.c.

References get_current_arch(), and validate().

Referenced by _initialize_charset().

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

Definition at line 369 of file charset.c.

References get_current_arch(), and validate().

Referenced by _initialize_charset().

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

Definition at line 377 of file charset.c.

References get_current_arch(), and validate().

Referenced by _initialize_charset().

static void show_charset ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  name 
)
static
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 219 of file charset.c.

References _, and fprintf_filtered().

Referenced by _initialize_charset(), and show_charset().

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

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

Referenced by _initialize_charset(), and show_charset().

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

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

Referenced by _initialize_charset(), and show_charset().

const char* target_charset ( struct gdbarch gdbarch)
const char* target_wide_charset ( struct gdbarch gdbarch)
static void validate ( struct gdbarch gdbarch)
static
static VEC ( char_ptr  )
static

Definition at line 729 of file charset.c.

References GDB_DEFAULT_HOST_CHARSET, and VEC_safe_push.

int wchar_iterate ( struct wchar_iterator iter,
enum wchar_iterate_result out_result,
gdb_wchar_t **  out_chars,
const gdb_byte **  ptr,
size_t *  len 
)

Variable Documentation

initialize_file_ftype _initialize_charset
const char* auto_host_charset_name = GDB_DEFAULT_HOST_CHARSET
static

Definition at line 216 of file charset.c.

Referenced by _initialize_charset(), and host_charset().

const char* auto_target_charset_name = GDB_DEFAULT_TARGET_CHARSET
static

Definition at line 931 of file charset.c.

Referenced by default_auto_charset().

struct gdbarch* be_le_arch
static

Definition at line 278 of file charset.c.

const char** charset_enum
static

Definition at line 269 of file charset.c.

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

Definition at line 263 of file charset.c.

Referenced by _initialize_charset().

const char* host_charset_name = "auto"
static

Definition at line 217 of file charset.c.

Referenced by host_charset(), and set_charset_sfunc().

const char* target_charset_name = "auto"
static

Definition at line 231 of file charset.c.

Referenced by target_charset().

const char* target_wide_charset_be_name
static

Definition at line 274 of file charset.c.

Referenced by target_wide_charset().

const char* target_wide_charset_le_name
static

Definition at line 275 of file charset.c.

Referenced by target_wide_charset().

const char* target_wide_charset_name = "auto"
static

Definition at line 246 of file charset.c.

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