gdb:
2003-05-02 Elena Zannoni <ezannoni@redhat.com> * charset.c (GDB_DEFAULT_TARGET_CHARSET, GDB_DEFAULT_HOST_CHARSET): Move to earlier in the file. (host_charset_name, target_charset_name): New vars for use by set/show commands. (host_charset_enum, target_charset_enum): New enums for set/show commands. (set_charset_sfunc, set_host_charset_sfunc, set_target_charset_sfunc): New functions. (set_host_charset, set_target_charset): Make static. (list_charsets, set_host_charset_command, set_target_charset_command): Delete functions. (show_charset_command): Rewrite as.... (show_charset): Hook this up with the set/show command mechanism. (_initialize_charset): Change names of charsets to match the set/show enums. Use host_charset_name and target_charset_name. Use set/show mechanism for charset, host-charset, target-charset commands. Do not make 'show host-charset' and 'show target-charset' be aliases of 'show charset'. * charset.h (set_host_charset, set_target_charset): Don't export, they are not used outside the file. gdb/testsuite: 2003-05-01 Elena Zannoni <ezannoni@redhat.com> * gdb.base/charset.exp: Update based on new behavior of set/show charset commands. gdb/doc: 2003-05-02 Elena Zannoni <ezannoni@redhat.com> * gdb.texinfo (Character Sets): Update to reflect new behavior of set/show charsets commands.
This commit is contained in:
parent
2968149b03
commit
e33d66ec21
7 changed files with 369 additions and 287 deletions
|
@ -1,3 +1,27 @@
|
||||||
|
2003-05-02 Elena Zannoni <ezannoni@redhat.com>
|
||||||
|
|
||||||
|
* charset.c (GDB_DEFAULT_TARGET_CHARSET,
|
||||||
|
GDB_DEFAULT_HOST_CHARSET): Move to earlier in the file.
|
||||||
|
(host_charset_name, target_charset_name): New vars for use by
|
||||||
|
set/show commands.
|
||||||
|
(host_charset_enum, target_charset_enum): New enums for set/show
|
||||||
|
commands.
|
||||||
|
(set_charset_sfunc, set_host_charset_sfunc,
|
||||||
|
set_target_charset_sfunc): New functions.
|
||||||
|
(set_host_charset, set_target_charset): Make static.
|
||||||
|
(list_charsets, set_host_charset_command,
|
||||||
|
set_target_charset_command): Delete functions.
|
||||||
|
(show_charset_command): Rewrite as....
|
||||||
|
(show_charset): Hook this up with the set/show command mechanism.
|
||||||
|
(_initialize_charset): Change names of charsets to match the
|
||||||
|
set/show enums. Use host_charset_name and target_charset_name.
|
||||||
|
Use set/show mechanism for charset, host-charset, target-charset
|
||||||
|
commands. Do not make 'show host-charset' and 'show
|
||||||
|
target-charset' be aliases of 'show charset'.
|
||||||
|
|
||||||
|
* charset.h (set_host_charset, set_target_charset): Don't export,
|
||||||
|
they are not used outside the file.
|
||||||
|
|
||||||
2003-05-01 Andrew Cagney <cagney@redhat.com>
|
2003-05-01 Andrew Cagney <cagney@redhat.com>
|
||||||
|
|
||||||
* disasm.c (gdb_disassemble_from_exec): Delete global variable.
|
* disasm.c (gdb_disassemble_from_exec): Delete global variable.
|
||||||
|
|
366
gdb/charset.c
366
gdb/charset.c
|
@ -96,7 +96,7 @@ struct charset {
|
||||||
struct charset *next;
|
struct charset *next;
|
||||||
|
|
||||||
/* The name of the character set. Comparisons on character set
|
/* The name of the character set. Comparisons on character set
|
||||||
names are case-insensitive. */
|
names are case-sensitive. */
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
/* Non-zero iff this character set can be used as a host character
|
/* Non-zero iff this character set can be used as a host character
|
||||||
|
@ -125,7 +125,7 @@ struct translation {
|
||||||
|
|
||||||
/* This structure describes functions going from the FROM character
|
/* This structure describes functions going from the FROM character
|
||||||
set to the TO character set. Comparisons on character set names
|
set to the TO character set. Comparisons on character set names
|
||||||
are case-insensitive. */
|
are case-sensitive. */
|
||||||
const char *from, *to;
|
const char *from, *to;
|
||||||
|
|
||||||
/* Pointers to translation-specific functions, and data pointers to
|
/* Pointers to translation-specific functions, and data pointers to
|
||||||
|
@ -156,16 +156,32 @@ struct translation {
|
||||||
/* The global lists of character sets and translations. */
|
/* The global lists of character sets and translations. */
|
||||||
|
|
||||||
|
|
||||||
/* Character set names are always compared ignoring case. */
|
#ifndef GDB_DEFAULT_HOST_CHARSET
|
||||||
static int
|
#define GDB_DEFAULT_HOST_CHARSET "ISO-8859-1"
|
||||||
strcmp_case_insensitive (const char *p, const char *q)
|
#endif
|
||||||
|
|
||||||
|
#ifndef GDB_DEFAULT_TARGET_CHARSET
|
||||||
|
#define GDB_DEFAULT_TARGET_CHARSET "ISO-8859-1"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static const char *host_charset_name = GDB_DEFAULT_HOST_CHARSET;
|
||||||
|
static const char *target_charset_name = GDB_DEFAULT_TARGET_CHARSET;
|
||||||
|
|
||||||
|
static const char *host_charset_enum[] =
|
||||||
{
|
{
|
||||||
while (*p && *q && tolower (*p) == tolower (*q))
|
"ASCII",
|
||||||
p++, q++;
|
"ISO-8859-1",
|
||||||
|
0
|
||||||
return tolower (*p) - tolower (*q);
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
static const char *target_charset_enum[] =
|
||||||
|
{
|
||||||
|
"ASCII",
|
||||||
|
"ISO-8859-1",
|
||||||
|
"EBCDIC-US",
|
||||||
|
"IBM1047",
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
/* The global list of all the charsets GDB knows about. */
|
/* The global list of all the charsets GDB knows about. */
|
||||||
static struct charset *all_charsets;
|
static struct charset *all_charsets;
|
||||||
|
@ -192,7 +208,7 @@ lookup_charset (const char *name)
|
||||||
struct charset *cs;
|
struct charset *cs;
|
||||||
|
|
||||||
for (cs = all_charsets; cs; cs = cs->next)
|
for (cs = all_charsets; cs; cs = cs->next)
|
||||||
if (! strcmp_case_insensitive (name, cs->name))
|
if (! strcmp (name, cs->name))
|
||||||
return cs;
|
return cs;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -217,8 +233,8 @@ lookup_translation (const char *from, const char *to)
|
||||||
struct translation *t;
|
struct translation *t;
|
||||||
|
|
||||||
for (t = all_translations; t; t = t->next)
|
for (t = all_translations; t; t = t->next)
|
||||||
if (! strcmp_case_insensitive (from, t->from)
|
if (! strcmp (from, t->from)
|
||||||
&& ! strcmp_case_insensitive (to, t->to))
|
&& ! strcmp (to, t->to))
|
||||||
return t;
|
return t;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -897,6 +913,26 @@ static void *target_char_to_host_baton;
|
||||||
static struct cached_iconv cached_iconv_host_to_target;
|
static struct cached_iconv cached_iconv_host_to_target;
|
||||||
static struct cached_iconv cached_iconv_target_to_host;
|
static struct cached_iconv cached_iconv_target_to_host;
|
||||||
|
|
||||||
|
|
||||||
|
/* Charset structures manipulation functions. */
|
||||||
|
|
||||||
|
static struct charset *
|
||||||
|
lookup_charset_or_error (const char *name)
|
||||||
|
{
|
||||||
|
struct charset *cs = lookup_charset (name);
|
||||||
|
|
||||||
|
if (! cs)
|
||||||
|
error ("GDB doesn't know of any character set named `%s'.", name);
|
||||||
|
|
||||||
|
return cs;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
check_valid_host_charset (struct charset *cs)
|
||||||
|
{
|
||||||
|
if (! cs->valid_host_charset)
|
||||||
|
error ("GDB can't use `%s' as its host character set.", cs->name);
|
||||||
|
}
|
||||||
|
|
||||||
/* Set the host and target character sets to HOST and TARGET. */
|
/* Set the host and target character sets to HOST and TARGET. */
|
||||||
static void
|
static void
|
||||||
|
@ -986,28 +1022,8 @@ set_host_and_target_charsets (struct charset *host, struct charset *target)
|
||||||
current_target_charset = target;
|
current_target_charset = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Do the real work of setting the host charset. */
|
||||||
static struct charset *
|
|
||||||
lookup_charset_or_error (const char *name)
|
|
||||||
{
|
|
||||||
struct charset *cs = lookup_charset (name);
|
|
||||||
|
|
||||||
if (! cs)
|
|
||||||
error ("GDB doesn't know of any character set named `%s'.", name);
|
|
||||||
|
|
||||||
return cs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_valid_host_charset (struct charset *cs)
|
|
||||||
{
|
|
||||||
if (! cs->valid_host_charset)
|
|
||||||
error ("GDB can't use `%s' as its host character set.", cs->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
set_host_charset (const char *charset)
|
set_host_charset (const char *charset)
|
||||||
{
|
{
|
||||||
struct charset *cs = lookup_charset_or_error (charset);
|
struct charset *cs = lookup_charset_or_error (charset);
|
||||||
|
@ -1015,15 +1031,8 @@ set_host_charset (const char *charset)
|
||||||
set_host_and_target_charsets (cs, current_target_charset);
|
set_host_and_target_charsets (cs, current_target_charset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Do the real work of setting the target charset. */
|
||||||
const char *
|
static void
|
||||||
host_charset (void)
|
|
||||||
{
|
|
||||||
return current_host_charset->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
set_target_charset (const char *charset)
|
set_target_charset (const char *charset)
|
||||||
{
|
{
|
||||||
struct charset *cs = lookup_charset_or_error (charset);
|
struct charset *cs = lookup_charset_or_error (charset);
|
||||||
|
@ -1031,6 +1040,64 @@ set_target_charset (const char *charset)
|
||||||
set_host_and_target_charsets (current_host_charset, cs);
|
set_host_and_target_charsets (current_host_charset, cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 'Set charset', 'set host-charset', 'set target-charset', 'show
|
||||||
|
charset' sfunc's. */
|
||||||
|
|
||||||
|
/* This is the sfunc for the 'set charset' command. */
|
||||||
|
static void
|
||||||
|
set_charset_sfunc (char *charset, int from_tty, struct cmd_list_element *c)
|
||||||
|
{
|
||||||
|
struct charset *cs = lookup_charset_or_error (host_charset_name);
|
||||||
|
check_valid_host_charset (cs);
|
||||||
|
/* CAREFUL: set the target charset here as well. */
|
||||||
|
target_charset_name = host_charset_name;
|
||||||
|
set_host_and_target_charsets (cs, cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 'set host-charset' command sfunc. We need a wrapper here because
|
||||||
|
the function needs to have a specific signature. */
|
||||||
|
static void
|
||||||
|
set_host_charset_sfunc (char *charset, int from_tty,
|
||||||
|
struct cmd_list_element *c)
|
||||||
|
{
|
||||||
|
set_host_charset (host_charset_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wrapper for the 'set target-charset' command. */
|
||||||
|
static void
|
||||||
|
set_target_charset_sfunc (char *charset, int from_tty,
|
||||||
|
struct cmd_list_element *c)
|
||||||
|
{
|
||||||
|
set_target_charset (target_charset_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sfunc for the 'show charset' command. */
|
||||||
|
static void
|
||||||
|
show_charset (char *arg, int from_tty)
|
||||||
|
{
|
||||||
|
if (current_host_charset == current_target_charset)
|
||||||
|
{
|
||||||
|
printf_filtered ("The current host and target character set is `%s'.\n",
|
||||||
|
host_charset ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf_filtered ("The current host character set is `%s'.\n",
|
||||||
|
host_charset ());
|
||||||
|
printf_filtered ("The current target character set is `%s'.\n",
|
||||||
|
target_charset ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Accessor functions. */
|
||||||
|
|
||||||
|
const char *
|
||||||
|
host_charset (void)
|
||||||
|
{
|
||||||
|
return current_host_charset->name;
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
target_charset (void)
|
target_charset (void)
|
||||||
|
@ -1093,105 +1160,15 @@ target_char_to_host (int target_char, int *host_char)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Commands. */
|
|
||||||
|
|
||||||
|
|
||||||
/* List the valid character sets. If HOST_ONLY is non-zero, list only
|
|
||||||
those character sets which can be used as GDB's host character set. */
|
|
||||||
static void
|
|
||||||
list_charsets (int host_only)
|
|
||||||
{
|
|
||||||
struct charset *cs;
|
|
||||||
|
|
||||||
printf_filtered ("Valid character sets are:\n");
|
|
||||||
|
|
||||||
for (cs = all_charsets; cs; cs = cs->next)
|
|
||||||
if (host_only && cs->valid_host_charset)
|
|
||||||
printf_filtered (" %s\n", cs->name);
|
|
||||||
else
|
|
||||||
printf_filtered (" %s %s\n",
|
|
||||||
cs->name,
|
|
||||||
cs->valid_host_charset ? "*" : " ");
|
|
||||||
|
|
||||||
if (! host_only)
|
|
||||||
printf_filtered ("* - can be used as a host character set\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
set_charset_command (char *arg, int from_tty)
|
|
||||||
{
|
|
||||||
if (! arg || arg[0] == '\0')
|
|
||||||
list_charsets (0);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
struct charset *cs = lookup_charset_or_error (arg);
|
|
||||||
check_valid_host_charset (cs);
|
|
||||||
set_host_and_target_charsets (cs, cs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
set_host_charset_command (char *arg, int from_tty)
|
|
||||||
{
|
|
||||||
if (! arg || arg[0] == '\0')
|
|
||||||
list_charsets (1);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
struct charset *cs = lookup_charset_or_error (arg);
|
|
||||||
check_valid_host_charset (cs);
|
|
||||||
set_host_and_target_charsets (cs, current_target_charset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
set_target_charset_command (char *arg, int from_tty)
|
|
||||||
{
|
|
||||||
if (! arg || arg[0] == '\0')
|
|
||||||
list_charsets (0);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
struct charset *cs = lookup_charset_or_error (arg);
|
|
||||||
set_host_and_target_charsets (current_host_charset, cs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
show_charset_command (char *arg, int from_tty)
|
|
||||||
{
|
|
||||||
if (current_host_charset == current_target_charset)
|
|
||||||
{
|
|
||||||
printf_filtered ("The current host and target character set is `%s'.\n",
|
|
||||||
host_charset ());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf_filtered ("The current host character set is `%s'.\n",
|
|
||||||
host_charset ());
|
|
||||||
printf_filtered ("The current target character set is `%s'.\n",
|
|
||||||
target_charset ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* The charset.c module initialization function. */
|
/* The charset.c module initialization function. */
|
||||||
|
|
||||||
#ifndef GDB_DEFAULT_HOST_CHARSET
|
|
||||||
#define GDB_DEFAULT_HOST_CHARSET "ISO-8859-1"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GDB_DEFAULT_TARGET_CHARSET
|
|
||||||
#define GDB_DEFAULT_TARGET_CHARSET "ISO-8859-1"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_initialize_charset (void)
|
_initialize_charset (void)
|
||||||
{
|
{
|
||||||
|
struct cmd_list_element *new_cmd;
|
||||||
|
|
||||||
/* Register all the character set GDB knows about.
|
/* Register all the character set GDB knows about.
|
||||||
|
|
||||||
You should use the same names that iconv does, where possible, to
|
You should use the same names that iconv does, where possible, to
|
||||||
|
@ -1204,28 +1181,28 @@ _initialize_charset (void)
|
||||||
when a translation's function pointer for a particular operation
|
when a translation's function pointer for a particular operation
|
||||||
is zero. Hopefully, these defaults will be correct often enough
|
is zero. Hopefully, these defaults will be correct often enough
|
||||||
that we won't need to provide too many translations. */
|
that we won't need to provide too many translations. */
|
||||||
register_charset (simple_charset ("ascii", 1,
|
register_charset (simple_charset ("ASCII", 1,
|
||||||
ascii_print_literally, 0,
|
ascii_print_literally, 0,
|
||||||
ascii_to_control, 0));
|
ascii_to_control, 0));
|
||||||
register_charset (iso_8859_family_charset ("iso-8859-1"));
|
register_charset (iso_8859_family_charset ("ISO-8859-1"));
|
||||||
register_charset (ebcdic_family_charset ("ebcdic-us"));
|
register_charset (ebcdic_family_charset ("EBCDIC-US"));
|
||||||
register_charset (ebcdic_family_charset ("ibm1047"));
|
register_charset (ebcdic_family_charset ("IBM1047"));
|
||||||
register_iconv_charsets ();
|
register_iconv_charsets ();
|
||||||
|
|
||||||
{
|
{
|
||||||
struct { char *from; char *to; int *table; } tlist[] = {
|
struct { char *from; char *to; int *table; } tlist[] = {
|
||||||
{ "ascii", "iso-8859-1", ascii_to_iso_8859_1_table },
|
{ "ASCII", "ISO-8859-1", ascii_to_iso_8859_1_table },
|
||||||
{ "ascii", "ebcdic-us", ascii_to_ebcdic_us_table },
|
{ "ASCII", "EBCDIC-US", ascii_to_ebcdic_us_table },
|
||||||
{ "ascii", "ibm1047", ascii_to_ibm1047_table },
|
{ "ASCII", "IBM1047", ascii_to_ibm1047_table },
|
||||||
{ "iso-8859-1", "ascii", iso_8859_1_to_ascii_table },
|
{ "ISO-8859-1", "ASCII", iso_8859_1_to_ascii_table },
|
||||||
{ "iso-8859-1", "ebcdic-us", iso_8859_1_to_ebcdic_us_table },
|
{ "ISO-8859-1", "EBCDIC-US", iso_8859_1_to_ebcdic_us_table },
|
||||||
{ "iso-8859-1", "ibm1047", iso_8859_1_to_ibm1047_table },
|
{ "ISO-8859-1", "IBM1047", iso_8859_1_to_ibm1047_table },
|
||||||
{ "ebcdic-us", "ascii", ebcdic_us_to_ascii_table },
|
{ "EBCDIC-US", "ASCII", ebcdic_us_to_ascii_table },
|
||||||
{ "ebcdic-us", "iso-8859-1", ebcdic_us_to_iso_8859_1_table },
|
{ "EBCDIC-US", "ISO-8859-1", ebcdic_us_to_iso_8859_1_table },
|
||||||
{ "ebcdic-us", "ibm1047", ebcdic_us_to_ibm1047_table },
|
{ "EBCDIC-US", "IBM1047", ebcdic_us_to_ibm1047_table },
|
||||||
{ "ibm1047", "ascii", ibm1047_to_ascii_table },
|
{ "IBM1047", "ASCII", ibm1047_to_ascii_table },
|
||||||
{ "ibm1047", "iso-8859-1", ibm1047_to_iso_8859_1_table },
|
{ "IBM1047", "ISO-8859-1", ibm1047_to_iso_8859_1_table },
|
||||||
{ "ibm1047", "ebcdic-us", ibm1047_to_ebcdic_us_table }
|
{ "IBM1047", "EBCDIC-US", ibm1047_to_ebcdic_us_table }
|
||||||
};
|
};
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
@ -1236,40 +1213,63 @@ _initialize_charset (void)
|
||||||
tlist[i].table));
|
tlist[i].table));
|
||||||
}
|
}
|
||||||
|
|
||||||
set_host_charset (GDB_DEFAULT_HOST_CHARSET);
|
set_host_charset (host_charset_name);
|
||||||
set_target_charset (GDB_DEFAULT_TARGET_CHARSET);
|
set_target_charset (target_charset_name);
|
||||||
|
|
||||||
add_cmd ("charset", class_support, set_charset_command,
|
new_cmd = add_set_enum_cmd ("charset",
|
||||||
"Use CHARSET as the host and target character set.\n"
|
class_support,
|
||||||
"The `host character set' is the one used by the system GDB is running on.\n"
|
host_charset_enum,
|
||||||
"The `target character set' is the one used by the program being debugged.\n"
|
&host_charset_name,
|
||||||
"You may only use supersets of ASCII for your host character set; GDB does\n"
|
"Set the host and target character sets.\n"
|
||||||
"not support any others.\n"
|
"The `host character set' is the one used by the system GDB is running on.\n"
|
||||||
"To see a list of the character sets GDB supports, type `set charset'\n"
|
"The `target character set' is the one used by the program being debugged.\n"
|
||||||
"with no argument.",
|
"You may only use supersets of ASCII for your host character set; GDB does\n"
|
||||||
&setlist);
|
"not support any others.\n"
|
||||||
|
"To see a list of the character sets GDB supports, type `set charset <TAB>'.",
|
||||||
|
&setlist);
|
||||||
|
|
||||||
add_cmd ("host-charset", class_support, set_host_charset_command,
|
/* Note that the sfunc below needs to set target_charset_name, because
|
||||||
"Use CHARSET as the host character set.\n"
|
the 'set charset' command sets two variables. */
|
||||||
"The `host character set' is the one used by the system GDB is running on.\n"
|
set_cmd_sfunc (new_cmd, set_charset_sfunc);
|
||||||
"You may only use supersets of ASCII for your host character set; GDB does\n"
|
/* Don't use set_from_show - need to print some extra info. */
|
||||||
"not support any others.\n"
|
add_cmd ("charset", class_support, show_charset,
|
||||||
"To see a list of the character sets GDB supports, type `set host-charset'\n"
|
"Show the host and target character sets.\n"
|
||||||
"with no argument.",
|
"The `host character set' is the one used by the system GDB is running on.\n"
|
||||||
&setlist);
|
"The `target character set' is the one used by the program being debugged.\n"
|
||||||
|
"You may only use supersets of ASCII for your host character set; GDB does\n"
|
||||||
|
"not support any others.\n"
|
||||||
|
"To see a list of the character sets GDB supports, type `set charset <TAB>'.",
|
||||||
|
&showlist);
|
||||||
|
|
||||||
add_cmd ("target-charset", class_support, set_target_charset_command,
|
|
||||||
"Use CHARSET as the target character set.\n"
|
|
||||||
"The `target character set' is the one used by the program being debugged.\n"
|
|
||||||
"GDB translates characters and strings between the host and target\n"
|
|
||||||
"character sets as needed.\n"
|
|
||||||
"To see a list of the character sets GDB supports, type `set target-charset'\n"
|
|
||||||
"with no argument.",
|
|
||||||
&setlist);
|
|
||||||
|
|
||||||
add_cmd ("charset", class_support, show_charset_command,
|
new_cmd = add_set_enum_cmd ("host-charset",
|
||||||
"Show the current host and target character sets.",
|
class_support,
|
||||||
&showlist);
|
host_charset_enum,
|
||||||
add_alias_cmd ("host-charset", "charset", class_alias, 1, &showlist);
|
&host_charset_name,
|
||||||
add_alias_cmd ("target-charset", "charset", class_alias, 1, &showlist);
|
"Set the host character set.\n"
|
||||||
|
"The `host character set' is the one used by the system GDB is running on.\n"
|
||||||
|
"You may only use supersets of ASCII for your host character set; GDB does\n"
|
||||||
|
"not support any others.\n"
|
||||||
|
"To see a list of the character sets GDB supports, type `set host-charset <TAB>'.",
|
||||||
|
&setlist);
|
||||||
|
|
||||||
|
set_cmd_sfunc (new_cmd, set_host_charset_sfunc);
|
||||||
|
|
||||||
|
add_show_from_set (new_cmd, &showlist);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
new_cmd = add_set_enum_cmd ("target-charset",
|
||||||
|
class_support,
|
||||||
|
target_charset_enum,
|
||||||
|
&target_charset_name,
|
||||||
|
"Set the target character set.\n"
|
||||||
|
"The `target character set' is the one used by the program being debugged.\n"
|
||||||
|
"GDB translates characters and strings between the host and target\n"
|
||||||
|
"character sets as needed.\n"
|
||||||
|
"To see a list of the character sets GDB supports, type `set target-charset'<TAB>",
|
||||||
|
&setlist);
|
||||||
|
|
||||||
|
set_cmd_sfunc (new_cmd, set_target_charset_sfunc);
|
||||||
|
add_show_from_set (new_cmd, &showlist);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,23 +46,12 @@
|
||||||
the requirements above, it's easy to plug an entry into GDB's table
|
the requirements above, it's easy to plug an entry into GDB's table
|
||||||
that uses iconv to handle the details. */
|
that uses iconv to handle the details. */
|
||||||
|
|
||||||
|
|
||||||
/* Set the host character set to CHARSET. CHARSET must be a superset
|
|
||||||
of ASCII, since GDB's code assumes this. */
|
|
||||||
void set_host_charset (const char *charset);
|
|
||||||
|
|
||||||
|
|
||||||
/* Set the target character set to CHARSET. */
|
|
||||||
void set_target_charset (const char *charset);
|
|
||||||
|
|
||||||
|
|
||||||
/* Return the name of the current host/target character set. The
|
/* Return the name of the current host/target character set. The
|
||||||
result is owned by the charset module; the caller should not free
|
result is owned by the charset module; the caller should not free
|
||||||
it. */
|
it. */
|
||||||
const char *host_charset (void);
|
const char *host_charset (void);
|
||||||
const char *target_charset (void);
|
const char *target_charset (void);
|
||||||
|
|
||||||
|
|
||||||
/* In general, the set of C backslash escapes (\n, \f) is specific to
|
/* In general, the set of C backslash escapes (\n, \f) is specific to
|
||||||
the character set. Not all character sets will have form feed
|
the character set. Not all character sets will have form feed
|
||||||
characters, for example.
|
characters, for example.
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2003-05-02 Elena Zannoni <ezannoni@redhat.com>
|
||||||
|
|
||||||
|
* gdb.texinfo (Character Sets): Update to reflect new behavior of
|
||||||
|
set/show charsets commands.
|
||||||
|
|
||||||
2003-04-28 Andrew Cagney <cagney@redhat.com>
|
2003-04-28 Andrew Cagney <cagney@redhat.com>
|
||||||
|
|
||||||
* gdbint.texinfo (Target Architecture Definition): Replace
|
* gdbint.texinfo (Target Architecture Definition): Replace
|
||||||
|
|
|
@ -5952,7 +5952,7 @@ remote protocol (@pxref{Remote,Remote Debugging}) to debug a program
|
||||||
running on an IBM mainframe, which uses the @sc{ebcdic} character set,
|
running on an IBM mainframe, which uses the @sc{ebcdic} character set,
|
||||||
then the host character set is Latin-1, and the target character set is
|
then the host character set is Latin-1, and the target character set is
|
||||||
@sc{ebcdic}. If you give @value{GDBN} the command @code{set
|
@sc{ebcdic}. If you give @value{GDBN} the command @code{set
|
||||||
target-charset ebcdic-us}, then @value{GDBN} translates between
|
target-charset EBCDIC-US}, then @value{GDBN} translates between
|
||||||
@sc{ebcdic} and Latin 1 as you print character or string values, or use
|
@sc{ebcdic} and Latin 1 as you print character or string values, or use
|
||||||
character and string literals in expressions.
|
character and string literals in expressions.
|
||||||
|
|
||||||
|
@ -5967,9 +5967,9 @@ support:
|
||||||
@item set target-charset @var{charset}
|
@item set target-charset @var{charset}
|
||||||
@kindex set target-charset
|
@kindex set target-charset
|
||||||
Set the current target character set to @var{charset}. We list the
|
Set the current target character set to @var{charset}. We list the
|
||||||
character set names @value{GDBN} recognizes below, but if you invoke the
|
character set names @value{GDBN} recognizes below, but if you type
|
||||||
@code{set target-charset} command with no argument, @value{GDBN} lists
|
@code{set target-charset} followed by @key{TAB}@key{TAB}, @value{GDBN} will
|
||||||
the character sets it supports.
|
list the target character sets it supports.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
@ -5983,28 +5983,29 @@ system it is running on; you can override that default using the
|
||||||
|
|
||||||
@value{GDBN} can only use certain character sets as its host character
|
@value{GDBN} can only use certain character sets as its host character
|
||||||
set. We list the character set names @value{GDBN} recognizes below, and
|
set. We list the character set names @value{GDBN} recognizes below, and
|
||||||
indicate which can be host character sets, but if you invoke the
|
indicate which can be host character sets, but if you type
|
||||||
@code{set host-charset} command with no argument, @value{GDBN} lists the
|
@code{set target-charset} followed by @key{TAB}@key{TAB}, @value{GDBN} will
|
||||||
character sets it supports, placing an asterisk (@samp{*}) after those
|
list the host character sets it supports.
|
||||||
it can use as a host character set.
|
|
||||||
|
|
||||||
@item set charset @var{charset}
|
@item set charset @var{charset}
|
||||||
@kindex set charset
|
@kindex set charset
|
||||||
Set the current host and target character sets to @var{charset}. If you
|
Set the current host and target character sets to @var{charset}. As
|
||||||
invoke the @code{set charset} command with no argument, it lists the
|
above, if you type @code{set charset} followed by @key{TAB}@key{TAB},
|
||||||
character sets it supports. @value{GDBN} can only use certain character
|
@value{GDBN} will list the name of the character sets that can be used
|
||||||
sets as its host character set; it marks those in the list with an
|
for both host and target.
|
||||||
asterisk (@samp{*}).
|
|
||||||
|
|
||||||
@item show charset
|
@item show charset
|
||||||
@itemx show host-charset
|
|
||||||
@itemx show target-charset
|
|
||||||
@kindex show charset
|
@kindex show charset
|
||||||
|
Show the names of the current host and target charsets.
|
||||||
|
|
||||||
|
@itemx show host-charset
|
||||||
@kindex show host-charset
|
@kindex show host-charset
|
||||||
|
Show the name of the current host charset.
|
||||||
|
|
||||||
|
@itemx show target-charset
|
||||||
@kindex show target-charset
|
@kindex show target-charset
|
||||||
Show the current host and target charsets. The @code{show host-charset}
|
Show the name of the current target charset.
|
||||||
and @code{show target-charset} commands are synonyms for @code{show
|
|
||||||
charset}.
|
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
@ -6021,7 +6022,7 @@ character set.
|
||||||
@item ISO-8859-1
|
@item ISO-8859-1
|
||||||
@cindex ISO 8859-1 character set
|
@cindex ISO 8859-1 character set
|
||||||
@cindex ISO Latin 1 character set
|
@cindex ISO Latin 1 character set
|
||||||
The ISO Latin 1 character set. This extends ASCII with accented
|
The ISO Latin 1 character set. This extends @sc{ascii} with accented
|
||||||
characters needed for French, German, and Spanish. @value{GDBN} can use
|
characters needed for French, German, and Spanish. @value{GDBN} can use
|
||||||
this as its host character set.
|
this as its host character set.
|
||||||
|
|
||||||
|
@ -6080,16 +6081,16 @@ strings:
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
(gdb) show charset
|
(gdb) show charset
|
||||||
The current host and target character set is `iso-8859-1'.
|
The current host and target character set is `ISO-8859-1'.
|
||||||
(gdb)
|
(gdb)
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
For the sake of printing this manual, let's use @sc{ascii} as our
|
For the sake of printing this manual, let's use @sc{ascii} as our
|
||||||
initial character set:
|
initial character set:
|
||||||
@smallexample
|
@smallexample
|
||||||
(gdb) set charset ascii
|
(gdb) set charset ASCII
|
||||||
(gdb) show charset
|
(gdb) show charset
|
||||||
The current host and target character set is `ascii'.
|
The current host and target character set is `ASCII'.
|
||||||
(gdb)
|
(gdb)
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
|
@ -6131,17 +6132,13 @@ $5 = 200 '\310'
|
||||||
(gdb)
|
(gdb)
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
If we invoke the @code{set target-charset} command without an argument,
|
If we invoke the @code{set target-charset} followed by @key{TAB}@key{TAB},
|
||||||
@value{GDBN} tells us the character sets it supports:
|
@value{GDBN} tells us the character sets it supports:
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
(gdb) set target-charset
|
(gdb) set target-charset
|
||||||
Valid character sets are:
|
ASCII EBCDIC-US IBM1047 ISO-8859-1
|
||||||
ascii *
|
(gdb) set target-charset
|
||||||
iso-8859-1 *
|
|
||||||
ebcdic-us
|
|
||||||
ibm1047
|
|
||||||
* - can be used as a host character set
|
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
We can select @sc{ibm1047} as our target character set, and examine the
|
We can select @sc{ibm1047} as our target character set, and examine the
|
||||||
|
@ -6151,10 +6148,10 @@ target character set, @sc{ibm1047}, to the host character set,
|
||||||
@sc{ascii}, and they display correctly:
|
@sc{ascii}, and they display correctly:
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
(gdb) set target-charset ibm1047
|
(gdb) set target-charset IBM1047
|
||||||
(gdb) show charset
|
(gdb) show charset
|
||||||
The current host character set is `ascii'.
|
The current host character set is `ASCII'.
|
||||||
The current target character set is `ibm1047'.
|
The current target character set is `IBM1047'.
|
||||||
(gdb) print ascii_hello
|
(gdb) print ascii_hello
|
||||||
$6 = 0x401698 "\110\145%%?\054\040\167?\162%\144\041\012"
|
$6 = 0x401698 "\110\145%%?\054\040\167?\162%\144\041\012"
|
||||||
(gdb) print ascii_hello[0]
|
(gdb) print ascii_hello[0]
|
||||||
|
@ -6175,7 +6172,7 @@ $10 = 78 '+'
|
||||||
(gdb)
|
(gdb)
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
The IBM1047 character set uses the number 78 to encode the @samp{+}
|
The @sc{ibm1047} character set uses the number 78 to encode the @samp{+}
|
||||||
character.
|
character.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2003-05-02 Elena Zannoni <ezannoni@redhat.com>
|
||||||
|
|
||||||
|
* gdb.base/charset.exp: Update based on new behavior of set/show
|
||||||
|
charset commands.
|
||||||
|
|
||||||
2003-05-01 Andrew Cagney <cagney@redhat.com>
|
2003-05-01 Andrew Cagney <cagney@redhat.com>
|
||||||
|
|
||||||
* gdb.asm/asm-source.exp: Check that "disassm" and "x/i" of a
|
* gdb.asm/asm-source.exp: Check that "disassm" and "x/i" of a
|
||||||
|
|
|
@ -48,11 +48,23 @@ proc parse_show_charset_output {testname} {
|
||||||
-re "The current host and target character set is `(.*)'\\.\[\r\n\]+$gdb_prompt $" {
|
-re "The current host and target character set is `(.*)'\\.\[\r\n\]+$gdb_prompt $" {
|
||||||
set host_charset $expect_out(1,string)
|
set host_charset $expect_out(1,string)
|
||||||
set target_charset $expect_out(1,string)
|
set target_charset $expect_out(1,string)
|
||||||
|
set retlist [list $host_charset $target_charset]
|
||||||
pass $testname
|
pass $testname
|
||||||
}
|
}
|
||||||
-re "The current host character set is `(.*)'\\.\[\r\n\]+The current target character set is `(.*)'\\.\[\r\n\]+$gdb_prompt $" {
|
-re "The current host character set is `(.*)'\\.\[\r\n\]+The current target character set is `(.*)'\\.\[\r\n\]+$gdb_prompt $" {
|
||||||
set host_charset $expect_out(1,string)
|
set host_charset $expect_out(1,string)
|
||||||
set target_charset $expect_out(2,string)
|
set target_charset $expect_out(2,string)
|
||||||
|
set retlist [list $host_charset $target_charset]
|
||||||
|
pass $testname
|
||||||
|
}
|
||||||
|
-re "The host character set is \"(.*)\"\\.\[\r\n\]+$gdb_prompt $" {
|
||||||
|
set host_charset $expect_out(1,string)
|
||||||
|
set retlist [list $host_charset]
|
||||||
|
pass $testname
|
||||||
|
}
|
||||||
|
-re "The target character set is \"(.*)\"\\.\[\r\n\]+$gdb_prompt $" {
|
||||||
|
set target_charset $expect_out(1,string)
|
||||||
|
set retlist [list $target_charset]
|
||||||
pass $testname
|
pass $testname
|
||||||
}
|
}
|
||||||
-re ".*$gdb_prompt $" {
|
-re ".*$gdb_prompt $" {
|
||||||
|
@ -63,7 +75,7 @@ proc parse_show_charset_output {testname} {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [list $host_charset $target_charset]
|
return $retlist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,7 +89,7 @@ set show_charset [parse_show_charset_output "show charset"]
|
||||||
send_gdb "show target-charset\n"
|
send_gdb "show target-charset\n"
|
||||||
set show_target_charset [parse_show_charset_output "show target-charset"]
|
set show_target_charset [parse_show_charset_output "show target-charset"]
|
||||||
|
|
||||||
if {! [string compare $show_charset $show_target_charset]} {
|
if {[lsearch $show_charset $show_target_charset] >= 0} {
|
||||||
pass "check `show target-charset' against `show charset'"
|
pass "check `show target-charset' against `show charset'"
|
||||||
} else {
|
} else {
|
||||||
fail "check `show target-charset' against `show charset'"
|
fail "check `show target-charset' against `show charset'"
|
||||||
|
@ -86,21 +98,71 @@ if {! [string compare $show_charset $show_target_charset]} {
|
||||||
send_gdb "show host-charset\n"
|
send_gdb "show host-charset\n"
|
||||||
set show_host_charset [parse_show_charset_output "show host-charset"]
|
set show_host_charset [parse_show_charset_output "show host-charset"]
|
||||||
|
|
||||||
if {! [string compare $show_charset $show_host_charset]} {
|
if {[lsearch $show_charset $show_host_charset] >= 0} {
|
||||||
pass "check `show host-charset' against `show charset'"
|
pass "check `show host-charset' against `show charset'"
|
||||||
} else {
|
} else {
|
||||||
fail "check `show host-charset' against `show charset'"
|
fail "check `show host-charset' against `show charset'"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Get the list of supported charsets.
|
# Get the list of supported (host) charsets as possible completions.
|
||||||
send_gdb "set charset\n"
|
send_gdb "set charset \t\t"
|
||||||
|
|
||||||
# True iff we've seen the "Valid character sets are:" message.
|
# Check that we can at least use ASCII as a host character set.
|
||||||
set seen_valid 0
|
sleep 1
|
||||||
|
gdb_expect {
|
||||||
|
-re "^set charset .*\r\nASCII.*\r\n$gdb_prompt set charset " {
|
||||||
|
# We got the output that we wanted, including ASCII as possible
|
||||||
|
# charset. Send a newline to get us back to the prompt. This will
|
||||||
|
# also generate an error message. Let's not check here that the error
|
||||||
|
# message makes sense, we do that below, as a separate testcase.
|
||||||
|
send_gdb "\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re ".*Requires an argument.*$gdb_prompt $" {
|
||||||
|
pass "get valid character sets"
|
||||||
|
}
|
||||||
|
-re ".*$gdb_prompt $" {
|
||||||
|
send_gdb "\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re ".*$gdb_prompt $" {
|
||||||
|
fail "get valid character sets"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "(timeout) get valid character sets"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-re ".*$gdb_prompt $" {
|
||||||
|
# We got some output that ended with a regular prompt
|
||||||
|
fail "get valid character sets"
|
||||||
|
}
|
||||||
|
-re "^set charset.*$" {
|
||||||
|
# We got some other output, send a cntrl-c to gdb to get us back
|
||||||
|
# to the prompt.
|
||||||
|
send_gdb "\003"
|
||||||
|
fail "get valid character sets"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "get valid character sets (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# True iff we've seen the "can be used as a host character set" message.
|
# Try a malformed `set charset'.
|
||||||
set seen_can_host 0
|
gdb_test "set charset" \
|
||||||
|
"Requires an argument. Valid arguments are.*" \
|
||||||
|
"try malformed `set charset'"
|
||||||
|
|
||||||
|
# Try using `set host-charset' on an invalid character set.
|
||||||
|
gdb_test "set host-charset my_grandma_bonnie" \
|
||||||
|
"Undefined item: \"my_grandma_bonnie\"." \
|
||||||
|
"try `set host-charset' with invalid charset"
|
||||||
|
|
||||||
|
# Try using `set target-charset' on an invalid character set.
|
||||||
|
gdb_test "set target-charset my_grandma_bonnie" \
|
||||||
|
"Undefined item: \"my_grandma_bonnie\"." \
|
||||||
|
"try `set target-charset' with invalid charset"
|
||||||
|
|
||||||
# A Tcl array mapping the names of all the character sets we've seen
|
# A Tcl array mapping the names of all the character sets we've seen
|
||||||
# to "1" if the character set can be used as a host character set, or
|
# to "1" if the character set can be used as a host character set, or
|
||||||
|
@ -113,74 +175,74 @@ proc all_charset_names {} {
|
||||||
return [array names charsets]
|
return [array names charsets]
|
||||||
}
|
}
|
||||||
|
|
||||||
proc charset_exists {charset} {
|
|
||||||
global charsets
|
|
||||||
return [info exists charsets($charset)]
|
|
||||||
}
|
|
||||||
|
|
||||||
proc valid_host_charset {charset} {
|
proc valid_host_charset {charset} {
|
||||||
global charsets
|
global charsets
|
||||||
return $charsets($charset)
|
return $charsets($charset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
send_gdb "set host-charset\n"
|
||||||
gdb_expect {
|
gdb_expect {
|
||||||
-re "Valid character sets are:\[\r\n\]+" {
|
-re "Requires an argument. Valid arguments are (\[^ \t\n\r,.\]*)" {
|
||||||
# There's no ^ at the beginning of the pattern above, so that
|
#set host_charset_list $expect_out(1,string)
|
||||||
# expect can skip the echoed `set charset' command.
|
set charsets($expect_out(1,string)) 1
|
||||||
set seen_valid 1
|
exp_continue
|
||||||
exp_continue
|
#pass "capture valid host charsets"
|
||||||
}
|
}
|
||||||
-re "^ (\[^ \t\n\]*) \\*\[\r\n\]+" {
|
|
||||||
set charsets($expect_out(1,string)) 1
|
-re ", (\[^ \t\n\r,.\]*)" {
|
||||||
exp_continue
|
#set host_charset_list $expect_out(1,string)
|
||||||
|
set charsets($expect_out(1,string)) 1
|
||||||
|
exp_continue
|
||||||
|
#pass "capture valid host charsets"
|
||||||
}
|
}
|
||||||
-re "^ (\[^ \t\n\]*)\[ \t\]*\[\r\n\]+" {
|
|
||||||
set charsets($expect_out(1,string)) 0
|
-re "\\.\r\n$gdb_prompt $" {
|
||||||
exp_continue
|
#set host_charset_list $expect_out(1,string)
|
||||||
|
set charsets($expect_out(1,string)) 1
|
||||||
|
pass "capture valid host charsets"
|
||||||
}
|
}
|
||||||
-re "^\\* - can be used as a host character set\[\r\n\]+" {
|
|
||||||
set seen_can_host 1
|
-re ".*$gdb_prompt $" {
|
||||||
exp_continue
|
fail "capture valid host charsets"
|
||||||
}
|
|
||||||
-re ".*${gdb_prompt} $" {
|
|
||||||
# We don't do an exp_continue here.
|
|
||||||
}
|
}
|
||||||
timeout {
|
timeout {
|
||||||
fail "get valid character sets (timeout)"
|
fail "(timeout) capture valid host charsets"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Check that we've seen all the right pieces of the output, and that
|
send_gdb "set target-charset\n"
|
||||||
# we can at least use ASCII as a host character set.
|
gdb_expect {
|
||||||
if {$seen_valid && $seen_can_host && [charset_exists ascii]} {
|
-re "Requires an argument. Valid arguments are (\[^ \t\n\r,.\]*)" {
|
||||||
# We can't do the below as part of the test above, since all the
|
set target_charset $expect_out(1,string)
|
||||||
# [] substitution takes place before any expression evaluation
|
if {! [info exists charsets($target_charset)]} {
|
||||||
# takes place; && doesn't really short circuit things the way
|
set charsets($target_charset) 0
|
||||||
# you'd like. We'd get an "can't read $charsets(ascii)" error
|
}
|
||||||
# even when `info exists' had returned zero.
|
exp_continue
|
||||||
if {[valid_host_charset ascii]} {
|
}
|
||||||
pass "get valid character sets"
|
|
||||||
} else {
|
-re ", (\[^ \t\n\r,.\]*)" {
|
||||||
fail "get valid character sets"
|
set target_charset $expect_out(1,string)
|
||||||
|
if {! [info exists charsets($target_charset)]} {
|
||||||
|
set charsets($target_charset) 0
|
||||||
|
}
|
||||||
|
exp_continue
|
||||||
|
}
|
||||||
|
|
||||||
|
-re "\\.\r\n$gdb_prompt $" {
|
||||||
|
pass "capture valid target charsets"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
-re ".*$gdb_prompt $" {
|
||||||
|
fail "capture valid target charsets"
|
||||||
|
}
|
||||||
|
|
||||||
|
timeout {
|
||||||
|
fail "(timeout) capture valid target charsets"
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
fail "get valid character sets (no ascii charset)"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Try using `set host-charset' on an invalid character set.
|
|
||||||
gdb_test "set host-charset my_grandma_bonnie" \
|
|
||||||
"GDB doesn't know of any character set named `my_grandma_bonnie'." \
|
|
||||||
"try `set host-charset' with invalid charset"
|
|
||||||
|
|
||||||
|
|
||||||
# Try using `set target-charset' on an invalid character set.
|
|
||||||
gdb_test "set target-charset my_grandma_bonnie" \
|
|
||||||
"GDB doesn't know of any character set named `my_grandma_bonnie'." \
|
|
||||||
"try `set target-charset' with invalid charset"
|
|
||||||
|
|
||||||
|
|
||||||
# Make sure that GDB supports every host/target charset combination.
|
# Make sure that GDB supports every host/target charset combination.
|
||||||
foreach host_charset [all_charset_names] {
|
foreach host_charset [all_charset_names] {
|
||||||
if {[valid_host_charset $host_charset]} {
|
if {[valid_host_charset $host_charset]} {
|
||||||
|
@ -341,7 +403,7 @@ gdb_expect {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gdb_test "set host-charset ascii" ""
|
gdb_test "set host-charset ASCII" ""
|
||||||
foreach target_charset [all_charset_names] {
|
foreach target_charset [all_charset_names] {
|
||||||
send_gdb "set target-charset $target_charset\n"
|
send_gdb "set target-charset $target_charset\n"
|
||||||
gdb_expect {
|
gdb_expect {
|
||||||
|
|
Loading…
Reference in a new issue