forked from Imagelibrary/binutils-gdb
Handle multi-byte bracket sequences in Ada lexer
As noted in an earlier patch, the Ada lexer does not handle multi-byte bracket sequences. This patch adds support for these for character literals. gdb does not generally seem to handle the Ada wide string types, so for the time being these continue to be excluded -- but an explicit error is added to make this more clear.
This commit is contained in:
@@ -10187,7 +10187,7 @@ ada_resolvable::replace (operation_up &&owner,
|
||||
return std::move (owner);
|
||||
}
|
||||
|
||||
/* Convert the character literal whose ASCII value would be VAL to the
|
||||
/* Convert the character literal whose value would be VAL to the
|
||||
appropriate value of type TYPE, if there is a translation.
|
||||
Otherwise return VAL. Hence, in an enumeration type ('A', 'B'),
|
||||
the literal 'A' (VAL == 65), returns 0. */
|
||||
@@ -10195,7 +10195,7 @@ ada_resolvable::replace (operation_up &&owner,
|
||||
static LONGEST
|
||||
convert_char_literal (struct type *type, LONGEST val)
|
||||
{
|
||||
char name[7];
|
||||
char name[12];
|
||||
int f;
|
||||
|
||||
if (type == NULL)
|
||||
@@ -10206,8 +10206,12 @@ convert_char_literal (struct type *type, LONGEST val)
|
||||
|
||||
if ((val >= 'a' && val <= 'z') || (val >= '0' && val <= '9'))
|
||||
xsnprintf (name, sizeof (name), "Q%c", (int) val);
|
||||
else if (val >= 0 && val < 256)
|
||||
xsnprintf (name, sizeof (name), "QU%02x", (unsigned) val);
|
||||
else if (val >= 0 && val < 0x10000)
|
||||
xsnprintf (name, sizeof (name), "QW%04x", (unsigned) val);
|
||||
else
|
||||
xsnprintf (name, sizeof (name), "QU%02x", (int) val);
|
||||
xsnprintf (name, sizeof (name), "QWW%08lx", (unsigned long) val);
|
||||
size_t len = strlen (name);
|
||||
for (f = 0; f < type->num_fields (); f += 1)
|
||||
{
|
||||
@@ -13005,9 +13009,11 @@ public:
|
||||
add (arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch),
|
||||
0, "short_integer"));
|
||||
struct type *char_type = arch_character_type (gdbarch, TARGET_CHAR_BIT,
|
||||
0, "character");
|
||||
1, "character");
|
||||
lai->set_string_char_type (char_type);
|
||||
add (char_type);
|
||||
add (arch_character_type (gdbarch, 16, 1, "wide_character"));
|
||||
add (arch_character_type (gdbarch, 32, 1, "wide_wide_character"));
|
||||
add (arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
|
||||
"float", gdbarch_float_format (gdbarch)));
|
||||
add (arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
|
||||
|
||||
Reference in New Issue
Block a user