23#include "gdbsupport/gdb_regex.h"
38#include "gdbsupport/gdb_obstack.h"
58#include "gdbsupport/function-view.h"
59#include "gdbsupport/byte-vector.h"
68#ifndef TRUNCATION_TOWARDS_ZERO
69#define TRUNCATION_TOWARDS_ZERO ((-5 / 2) == -2)
105 const struct block *,
110 const struct block *,
114static int is_nonfunction (
const std::vector<struct block_symbol> &);
118 const struct block *);
142 CORE_ADDR,
struct value *);
192 struct type **,
int *,
int *,
int *,
int *);
195 struct value **,
int,
const char *,
196 struct type *,
bool);
272#define HASH_SIZE 1009
285 " \t\n!@#%^&*()+=|~`}{[]\";:?/,-";
287 " \t\n!@#$%^&*()+=|~`}{[]\";:?/,-";
292 =
"__gnat_ada_main_program_name";
431 while (
type->
code () == TYPE_CODE_TYPEDEF)
449 if (decoded_name[0] ==
'<')
452 result = strrchr (decoded_name,
'.');
456 result = decoded_name;
466 return string_printf (
"<%s>", str);
475 int len = strlen (target);
501 for (fieldno = 0; fieldno < struct_type->
num_fields (); fieldno++)
506 error (_(
"Unable to find field %s in struct %s. Aborting"),
521 const char *p = strstr (
name,
"___");
524 return strlen (
name);
541 len2 = strlen (suffix);
542 return (len1 >= len2 && strcmp (str + len1 - len2, suffix) == 0);
556 struct value *result;
579static const gdb_byte *
611 va_start (args, format);
623 LONGEST top_bit = (LONGEST) 1 << (
size * 8 - 2);
625 return top_bit | (top_bit - 1);
639 ULONGEST top_bit = (ULONGEST) 1 << (
size * 8 - 1);
641 return top_bit | (top_bit - 1);
671 case TYPE_CODE_RANGE:
695 error (_(
"Unexpected type in ada_discrete_type_high_bound."));
706 case TYPE_CODE_RANGE:
730 error (_(
"Unexpected type in ada_discrete_type_low_bound."));
740 while (
type != NULL &&
type->
code () == TYPE_CODE_RANGE)
763 if (
type->
code () == TYPE_CODE_TYPEDEF)
812 static gdb::unique_xmalloc_ptr<char> main_program_name;
824 if (main_program_name_addr == 0)
825 error (_(
"Invalid address for Ada main program name."));
828 return main_program_name.get ();
841 {
"Oadd",
"\"+\"", BINOP_ADD},
842 {
"Osubtract",
"\"-\"", BINOP_SUB},
843 {
"Omultiply",
"\"*\"", BINOP_MUL},
844 {
"Odivide",
"\"/\"", BINOP_DIV},
845 {
"Omod",
"\"mod\"", BINOP_MOD},
846 {
"Orem",
"\"rem\"", BINOP_REM},
847 {
"Oexpon",
"\"**\"", BINOP_EXP},
848 {
"Olt",
"\"<\"", BINOP_LESS},
849 {
"Ole",
"\"<=\"", BINOP_LEQ},
850 {
"Ogt",
"\">\"", BINOP_GTR},
851 {
"Oge",
"\">=\"", BINOP_GEQ},
852 {
"Oeq",
"\"=\"", BINOP_EQUAL},
853 {
"One",
"\"/=\"", BINOP_NOTEQUAL},
854 {
"Oand",
"\"and\"", BINOP_BITWISE_AND},
855 {
"Oor",
"\"or\"", BINOP_BITWISE_IOR},
856 {
"Oxor",
"\"xor\"", BINOP_BITWISE_XOR},
857 {
"Oconcat",
"\"&\"", BINOP_CONCAT},
858 {
"Oabs",
"\"abs\"", UNOP_ABS},
859 {
"Onot",
"\"not\"", UNOP_LOGICAL_NOT},
860 {
"Oadd",
"\"+\"", UNOP_PLUS},
861 {
"Osubtract",
"\"-\"", UNOP_NEG},
872 gdb_assert (*str ==
'[');
874 while (*str !=
'\0' && isalpha (*str))
877 return *str ==
'\0' || (str[0] ==
']' && str[1] ==
'\0');
884 if (one_char <= 0xff)
887 result.append (phex (one_char, 1));
889 else if (one_char <= 0xffff)
892 result.append (phex (one_char, 2));
896 result.append (
"WW");
897 result.append (phex (one_char, 4));
909 const T *chars = (
T *) obstack_base (storage);
910 int num_chars = obstack_object_size (storage) /
sizeof (
T);
912 for (
int i = 0; i < num_chars; ++i)
914 if (chars[i] <= 0x7f)
918 result.push_back (chars[i]);
936 std::string encoding_buffer;
937 bool saw_non_ascii =
false;
938 for (
const char *p =
decoded; *p !=
'\0'; p += 1)
940 if ((*p & 0x80) != 0)
941 saw_non_ascii =
true;
944 encoding_buffer.append (
"__");
947 encoding_buffer = encoding_buffer +
"." + (p + 1);
948 if (encoding_buffer.back () ==
']')
949 encoding_buffer.pop_back ();
963 error (_(
"invalid Ada operator name: %s"), p);
967 encoding_buffer.append (
mapping->encoded);
971 encoding_buffer.push_back (*p);
979 auto_obstack storage;
986 (
const gdb_byte *) encoding_buffer.c_str (),
987 encoding_buffer.length (), 1,
990 catch (
const gdb_exception &)
992 static bool warned =
false;
999 warning (_(
"charset conversion failure for '%s'.\n"
1000 "You may have the wrong value for 'set ada source-charset'."),
1001 encoding_buffer.c_str ());
1005 return encoding_buffer;
1009 return copy_and_hex_encode<uint32_t> (&storage);
1010 return copy_and_hex_encode<gdb_byte> (&storage);
1013 return encoding_buffer;
1039 static std::string fold_storage;
1041 if (!
name.empty () &&
name[0] ==
'\'')
1042 fold_storage = gdb::to_string (
name.substr (1,
name.size () - 2));
1060 auto_obstack storage;
1065 (
const gdb_byte *)
name.data (),
1069 catch (
const gdb_exception &)
1074 static bool warned =
false;
1081 warning (_(
"could not convert '%s' from the host encoding (%s) to UTF-32.\n"
1082 "This normally should not happen, please file a bug report."),
1088 fold_storage = gdb::to_string (
name);
1089 return fold_storage.c_str ();
1093 uint32_t *chars = (uint32_t *) obstack_base (&storage);
1094 int num_chars = obstack_object_size (&storage) /
sizeof (uint32_t);
1095 for (
int i = 0; i < num_chars; ++i)
1098 if (entry !=
nullptr)
1101 if (!is_utf8 || low <= 0xff)
1109 auto_obstack reconverted;
1114 (
const gdb_byte *) chars,
1115 num_chars *
sizeof (uint32_t),
1119 obstack_1grow (&reconverted,
'\0');
1120 fold_storage = std::string ((
const char *) obstack_base (&reconverted));
1122 catch (
const gdb_exception &)
1127 static bool warned =
false;
1135 warning (_(
"could not convert the lower-cased variant of '%s'\n"
1136 "from UTF-32 to the host encoding (%s)."),
1142 fold_storage = gdb::to_string (
name);
1146 return fold_storage.c_str ();
1156 if (fold && decoded[0] !=
'<')
1166 return (isdigit (c) || (isalpha (c) && islower (c)));
1184 if (*len > 1 && isdigit (encoded[*len - 1]))
1188 while (i > 0 && isdigit (encoded[i]))
1190 if (i >= 0 && encoded[i] ==
'.')
1192 else if (i >= 0 && encoded[i] ==
'$')
1194 else if (i >= 2 && startswith (encoded + i - 2,
"___"))
1196 else if (i >= 1 && startswith (encoded + i - 1,
"__"))
1218 && encoded[*len - 1] ==
'N'
1219 && (isdigit (encoded[*len - 2]) || islower (encoded[*len - 2])))
1230 int offset = *len - 1;
1231 while (offset > 0 && isalpha (encoded[offset]))
1233 if (offset > 0 && encoded[offset] ==
'.')
1247 uint32_t result = 0;
1249 for (
int i = 0; i < n; ++i)
1251 if (!isxdigit (str[i]))
1254 result |= fromhex (str[i]);
1282 gdb_byte one_char = (gdb_byte)
value;
1286 sizeof (one_char),
sizeof (one_char),
1291 (
const gdb_byte *) &
value,
1294 obstack_1grow (&bytes,
'\0');
1295 out.append ((
const char *) obstack_base (&bytes));
1297 catch (
const gdb_exception &)
1316 std::string decoded;
1321 if (encoded[0] ==
'.')
1327 if (startswith (encoded,
"_ada_"))
1332 if (startswith (encoded,
"___ghost_"))
1338 if (encoded[0] ==
'_' || encoded[0] ==
'<')
1341 len0 = strlen (encoded);
1352 p = strstr (encoded,
"___");
1353 if (p != NULL && p - encoded < len0 - 3)
1365 if (len0 > 3 && startswith (encoded + len0 - 3,
"TKB"))
1372 if (len0 > 2 && startswith (encoded + len0 - 2,
"TB"))
1378 if (len0 > 1 && startswith (encoded + len0 - 1,
"B"))
1383 if (len0 > 1 && isdigit (encoded[len0 - 1]))
1386 while ((i >= 0 && isdigit (encoded[i]))
1387 || (i >= 1 && encoded[i] ==
'_' && isdigit (encoded[i - 1])))
1389 if (i > 1 && encoded[i] ==
'_' && encoded[i - 1] ==
'_')
1391 else if (encoded[i] ==
'$')
1398 for (i = 0; i < len0 && !isalpha (encoded[i]); i += 1)
1399 decoded.push_back (encoded[i]);
1405 if (operators && at_start_name && encoded[i] ==
'O')
1414 && !isalnum (encoded[i + op_len]))
1430 if (i < len0 - 4 && startswith (encoded + i,
"TK__"))
1437 if (len0 - i > 5 && encoded [i] ==
'_' && encoded [i+1] ==
'_'
1438 && encoded [i+2] ==
'B' && encoded [i+3] ==
'_'
1439 && isdigit (encoded [i+4]))
1443 while (k < len0 && isdigit (encoded[k]))
1448 if (len0 - k > 2 && encoded [k] ==
'_' && encoded [k+1] ==
'_')
1465 if (len0 - i > 3 && encoded [i] ==
'_' && encoded[i+1] ==
'E'
1466 && isdigit (encoded[i+2]))
1470 while (k < len0 && isdigit (encoded[k]))
1474 && (encoded[k] ==
'b' || encoded[k] ==
's'))
1481 || (k < len0 && encoded[k] ==
'_'))
1490 && encoded[i] ==
'N' && encoded[i+1] ==
'_' && encoded[i+2] ==
'_')
1495 const char *ptr = encoded + i - 1;
1500 || (ptr > encoded && ptr[0] ==
'_' && ptr[-1] ==
'_'))
1504 if (i < len0 + 3 && encoded[i] ==
'U' && isxdigit (encoded[i + 1]))
1512 else if (i < len0 + 5 && encoded[i] ==
'W' && isxdigit (encoded[i + 1]))
1520 else if (i < len0 + 10 && encoded[i] ==
'W' && encoded[i + 1] ==
'W'
1521 && isxdigit (encoded[i + 2]))
1530 if (encoded[i] ==
'X' && i != 0 && isalnum (encoded[i - 1]))
1541 while (i < len0 && (encoded[i] ==
'b' || encoded[i] ==
'n'));
1545 else if (i < len0 - 2 && encoded[i] ==
'_' && encoded[i + 1] ==
'_')
1548 decoded.push_back (
'.');
1556 decoded.push_back (encoded[i]);
1566 for (i = 0; i < decoded.length(); ++i)
1567 if (isupper (decoded[i]) || decoded[i] ==
' ')
1573 decoded = decoded +
"[" + &encoded[suffix] +
"]";
1581 if (encoded[0] ==
'<')
1584 decoded =
'<' + std::string(encoded) +
'>';
1609 const char **resultp =
1619 if (obstack != NULL)
1620 *resultp = obstack_strdup (obstack, decoded.c_str ());
1629 decoded.c_str (), INSERT);
1632 *slot = xstrdup (decoded.c_str ());
1672 if (index_desc_type == NULL)
1674 gdb_assert (index_desc_type->
num_fields () > 0);
1685 index_desc_type->
field (0).
name ()) == 0)
1689 for (i = 0; i < index_desc_type->
num_fields (); i++)
1711 if (
type->
code () == TYPE_CODE_TYPEDEF)
1716 ||
type->
code () == TYPE_CODE_REF))
1739 if (base_type == NULL)
1747 if (alt_type == NULL)
1756static struct value *
1764 if (
type->
code () == TYPE_CODE_PTR)
1776 return (
type != NULL &&
type->
code () == TYPE_CODE_STRUCT
1801 else if (
type->
code () == TYPE_CODE_STRUCT)
1813static struct value *
1820 struct type *bounds_type =
1824 if (bounds_type == NULL)
1825 error (_(
"Bad GNAT array descriptor"));
1830 if (
type->
code () == TYPE_CODE_PTR)
1837 addr - bounds_type->
length ());
1843 _(
"Bad GNAT array descriptor"));
1847 && p_bounds_type->
code () == TYPE_CODE_PTR)
1857 error (_(
"Bad GNAT array descriptor"));
1916static struct value *
1925 _(
"Bad GNAT array descriptor"));
1958static struct value *
1961 char bound_name[20];
1962 xsnprintf (bound_name,
sizeof (bound_name),
"%cB%d",
1963 which ?
'U' :
'L', i - 1);
1965 _(
"Bad GNAT array descriptor bounds"));
2001 if (
type->
code () == TYPE_CODE_STRUCT)
2003 char bound_name[20];
2004 xsnprintf (bound_name,
sizeof (bound_name),
"LB%d", i - 1);
2034 return (
type->
code () == TYPE_CODE_ARRAY
2046 ||
type->
code () == TYPE_CODE_REF))
2059 return (
type->
code () == TYPE_CODE_ARRAY
2062 == TYPE_CODE_ARRAY)));
2075 return (data_type != NULL
2076 && data_type->
code () == TYPE_CODE_ARRAY
2090 &&
type->
code () == TYPE_CODE_STRUCT
2116 struct type *array_type =
2127 struct type *elt_type;
2129 struct value *descriptor;
2134 if (elt_type == NULL || arity == 0)
2170 array_type->
set_length ((array_bitsize + 7) / 8);
2191 if (arrType == NULL)
2213 error (_(
"Bounds unavailable for null array pointer."));
2283 if (
type->
code () == TYPE_CODE_TYPEDEF)
2299 || (
type->
code () == TYPE_CODE_ARRAY
2309 const char *raw_name;
2316 if (
type->
code () == TYPE_CODE_TYPEDEF)
2326 tail = strstr (raw_name,
"___XP");
2327 if (tail ==
nullptr)
2337 if (sscanf (tail +
sizeof (
"___XP") - 1,
"%ld", &
bits) != 1)
2340 (_(
"could not understand bit size information on packed array"));
2367 struct type *new_elt_type;
2369 struct type *index_type_desc;
2371 LONGEST low_bound, high_bound;
2374 if (
type->
code () != TYPE_CODE_ARRAY)
2378 if (index_type_desc)
2395 low_bound = high_bound = 0;
2396 if (high_bound < low_bound)
2403 *elt_bits *= (high_bound - low_bound + 1);
2420 struct type *shadow_type;
2429 name = (
char *) alloca (strlen (raw_name) + 1);
2430 tail = strstr (raw_name,
"___XP");
2433 memcpy (
name, raw_name, tail - raw_name);
2434 name[tail - raw_name] =
'\000';
2438 if (shadow_type == NULL)
2440 lim_warning (_(
"could not find bounds information on packed array"));
2445 if (shadow_type->
code () != TYPE_CODE_ARRAY)
2448 "information on packed array"));
2463 gdb_assert (
type->
code () == TYPE_CODE_ARRAY);
2469 LONGEST our_len = high - low + 1;
2472 if (elt_type->
code () == TYPE_CODE_ARRAY)
2491static struct value *
2510 error (_(
"can't unpack array"));
2521 gdb::array_view<const gdb_byte> view
2522 = gdb::make_array_view (valaddr,
type->
length ());
2545 bit_pos / HOST_CHAR_BIT,
2546 bit_pos % HOST_CHAR_BIT,
2558static struct value *
2562 int bits, elt_off, bit_off;
2563 long elt_total_bit_offset;
2564 struct type *elt_type;
2568 elt_total_bit_offset = 0;
2570 for (i = 0; i < arity; i += 1)
2572 if (elt_type->
code () != TYPE_CODE_ARRAY
2575 (_(
"attempt to do packed indexing of "
2576 "something other than a packed array"));
2580 LONGEST lowerbound, upperbound;
2586 lowerbound = upperbound = 0;
2590 if (idx < lowerbound || idx > upperbound)
2591 lim_warning (_(
"packed array index %ld out of bounds"),
2594 elt_total_bit_offset += (idx - lowerbound) *
bits;
2598 elt_off = elt_total_bit_offset / HOST_CHAR_BIT;
2599 bit_off = elt_total_bit_offset % HOST_CHAR_BIT;
2617 case TYPE_CODE_RANGE:
2638 gdb_byte *unpacked,
int unpacked_len,
2639 int is_big_endian,
int is_signed_type,
2650 int unpacked_bytes_left;
2652 unsigned long accum;
2658 int delta = is_big_endian ? -1 : 1;
2662 if ((
bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT > unpacked_len)
2663 error (_(
"Cannot unpack %d bits into buffer of %d bytes"),
2667 src_bytes_left = src_len;
2668 unpacked_bytes_left = unpacked_len;
2673 src_idx = src_len - 1;
2675 && ((src[0] <<
bit_offset) & (1 << (HOST_CHAR_BIT - 1))))
2685 unpacked_idx = unpacked_len - 1;
2691 (HOST_CHAR_BIT -
bit_size % HOST_CHAR_BIT) % HOST_CHAR_BIT;
2694 unpacked_idx = (
bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT - 1;
2695 unpacked_bytes_left = unpacked_idx + 1;
2702 src_idx = unpacked_idx = 0;
2706 if (is_signed_type && (src[src_len - 1] & (1 << sign_bit_offset)))
2711 while (src_bytes_left > 0)
2715 unsigned int unusedMSMask =
2716 (1 << (srcBitsLeft >= HOST_CHAR_BIT ? HOST_CHAR_BIT : srcBitsLeft)) -
2719 unsigned int signMask = sign & ~unusedMSMask;
2722 (((src[src_idx] >> unusedLS) & unusedMSMask) | signMask) << accumSize;
2723 accumSize += HOST_CHAR_BIT - unusedLS;
2724 if (accumSize >= HOST_CHAR_BIT)
2726 unpacked[unpacked_idx] = accum & ~(~0UL << HOST_CHAR_BIT);
2727 accumSize -= HOST_CHAR_BIT;
2728 accum >>= HOST_CHAR_BIT;
2729 unpacked_bytes_left -= 1;
2730 unpacked_idx += delta;
2732 srcBitsLeft -= HOST_CHAR_BIT - unusedLS;
2734 src_bytes_left -= 1;
2737 while (unpacked_bytes_left > 0)
2739 accum |= sign << accumSize;
2740 unpacked[unpacked_idx] = accum & ~(~0UL << HOST_CHAR_BIT);
2741 accumSize -= HOST_CHAR_BIT;
2744 accum >>= HOST_CHAR_BIT;
2745 unpacked_bytes_left -= 1;
2746 unpacked_idx += delta;
2761 long offset,
int bit_offset,
int bit_size,
2765 const gdb_byte *src;
2769 gdb::byte_vector staging;
2787 int staging_len = (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
2788 staging.resize (staging_len);
2791 staging.data (), staging.size (),
2795 if (
type->
length () < (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT)
2815 int src_len = (bit_size + bit_offset + HOST_CHAR_BIT - 1) / 8;
2819 buf = (gdb_byte *) alloca (src_len);
2831 long new_offset =
offset;
2862 memcpy (unpacked, staging.data (), staging.size ());
2877static struct value *
2892 error (_(
"Left operand of assignment is not a modifiable lvalue."));
2897 ||
type->
code () == TYPE_CODE_STRUCT))
2900 +
bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
2902 gdb_byte *buffer = (gdb_byte *) alloca (len);
2906 if (
type->
code () == TYPE_CODE_FLT)
2915 ULONGEST from_offset = 0;
2917 from_offset = from_size -
bits;
2920 bits, is_big_endian);
2951 LONGEST offset_in_container =
2953 int bit_offset_in_container =
2974 + offset_in_container),
2980 + offset_in_container),
2990 return (
type->
code () == TYPE_CODE_TYPEDEF
3003 struct type *elt_type;
3008 if (elt_type->
code () == TYPE_CODE_ARRAY
3012 for (k = 0; k < arity; k += 1)
3016 if (elt_type->
code () != TYPE_CODE_ARRAY)
3017 error (_(
"too many subscripts (%d expected)"), k);
3057static struct value *
3065 if (
type->
code () == TYPE_CODE_ARRAY
3069 for (k = 0; k < arity; k += 1)
3073 if (
type->
code () != TYPE_CODE_ARRAY)
3074 error (_(
"too many subscripts (%d expected)"), k);
3089static struct value *
3102 gdb::optional<LONGEST> base_low_pos, low_pos;
3108 if (!low_pos.has_value () || !base_low_pos.has_value ())
3110 warning (_(
"unable to get positions in slice, use bounds instead"));
3112 base_low_pos = base_low;
3124static struct value *
3135 gdb::optional<LONGEST> low_pos, high_pos;
3141 if (!low_pos.has_value () || !high_pos.has_value ())
3143 warning (_(
"unable to get positions in slice, use bounds instead"));
3149 value_slice (array, low, *high_pos - *low_pos + 1));
3168 if (
type->
code () == TYPE_CODE_STRUCT)
3171 while (
type->
code () == TYPE_CODE_ARRAY)
3190 if (
type->
code () == TYPE_CODE_STRUCT)
3193 struct type *p_array_type;
3202 if (nindices >= 0 && k > nindices)
3204 while (k > 0 && p_array_type != NULL)
3209 return p_array_type;
3211 else if (
type->
code () == TYPE_CODE_ARRAY)
3213 while (nindices != 0 &&
type->
code () == TYPE_CODE_ARRAY)
3235 struct type *result_type;
3240 error (_(
"invalid dimension number to '%s"),
name);
3246 for (i = 1; i < n; i += 1)
3261 if (result_type == NULL)
3262 error (_(
"attempt to take bound of something that is not an array"));
3280 gdb_assert (which == 0 || which == 1);
3286 return (LONGEST) - which;
3288 if (arr_type->
code () == TYPE_CODE_PTR)
3298 index_type_desc = NULL;
3306 if (index_type_desc != NULL)
3313 for (i = 1; i < n; i++)
3320 (LONGEST) (which == 0
3333 struct type *arr_type;
3381 struct type *base_type;
3390 return high - low + 1;
3397static struct value *
3404 high < low ? low - 1 : high);
3426 error (_(
"Could not find operator name for opcode"));
3440 else if (N0 == NULL)
3446 for (k0 = strlen (N0) - 1; k0 > 0 && isdigit (N0[k0]); k0 -= 1)
3448 for (k1 = strlen (N1) - 1; k1 > 0 && isdigit (N1[k1]); k1 -= 1)
3450 if ((N0[k0] ==
'_' || N0[k0] ==
'$') && N0[k0 + 1] !=
'\000'
3451 && (N1[k1] ==
'_' || N1[k1] ==
'$') && N1[k1 + 1] !=
'\000')
3456 while (N0[n0] ==
'_' && n0 > 0 && N0[n0 - 1] ==
'_')
3459 while (N1[
n1] ==
'_' &&
n1 > 0 && N1[
n1 - 1] ==
'_')
3461 if (n0 ==
n1 && strncmp (N0, N1, n0) == 0)
3462 return (atoi (N0 + k0 + 1) < atoi (N1 + k1 + 1));
3464 return (strcmp (N0, N1) < 0);
3476 for (i = 1; i < nsyms; i += 1)
3481 for (j = i - 1; j >= 0; j -= 1)
3486 syms[j + 1] = syms[j];
3510 ||
type->
code () != TYPE_CODE_FUNC)
3553 int is_all_choice,
const char *annotation_suffix)
3558 int first_choice = is_all_choice ? 2 : 1;
3560 prompt = getenv (
"PS2");
3579 args = skip_spaces (args);
3580 if (*args ==
'\0' && n_chosen == 0)
3582 else if (*args ==
'\0')
3585 choice = strtol (args, &args2, 10);
3586 if (args == args2 || choice < 0
3587 || choice > n_choices + first_choice - 1)
3588 error (_(
"Argument must be choice number"));
3592 error (_(
"cancelled"));
3594 if (choice < first_choice)
3596 n_chosen = n_choices;
3597 for (j = 0; j < n_choices; j += 1)
3601 choice -= first_choice;
3603 for (j = n_chosen - 1; j >= 0 && choice < choices[j]; j -= 1)
3607 if (j < 0 || choice != choices[j])
3611 for (k = n_chosen - 1; k > j; k -= 1)
3612 choices[k + 1] = choices[k];
3613 choices[j + 1] = choice;
3618 if (n_chosen > max_results)
3619 error (_(
"Select no more than %d of the above"), max_results);
3636 int *chosen = XALLOCAVEC (
int , nsyms);
3638 int first_choice = (max_results == 1) ? 1 : 2;
3641 if (max_results < 1)
3642 error (_(
"Request to select 0 symbols!"));
3648canceled because the command is ambiguous\n\
3649See set/show multiple-symbol."));
3658 if (max_results > 1)
3663 for (i = 0; i < nsyms; i += 1)
3665 if (syms[i].
symbol == NULL)
3677 gdb_printf (_(
" at %p[<no source file available>%p]:%d\n"),
3707 else if (is_enumeral
3724 ? _(
" in %s (enumeral)\n")
3729 ? _(
" (enumeral)\n")
3735 n_chosen =
get_selections (chosen, nsyms, max_results, max_results > 1,
3738 for (i = 0; i < n_chosen; i += 1)
3739 syms[i] = syms[chosen[i]];
3748 int nargs,
value *argvec[])
3752 std::vector<struct block_symbol> candidates
3760 return candidates[i];
3769 struct type *context_type,
3770 bool parse_completion,
3771 int nargs,
value *argvec[],
3774 std::vector<struct block_symbol> candidates
3778 if (candidates.size () == 1)
3786 context_type, parse_completion);
3788 error (_(
"Could not find a match for %s"), sym->
print_name ());
3791 tracker->
update (candidates[i]);
3792 return candidates[i];
3800 const char *
name,
struct type *context_type,
3801 bool parse_completion)
3803 gdb_assert (context_type->
code () == TYPE_CODE_ENUM);
3806 for (
int i = 0; i < syms.size (); ++i)
3814 error (_(
"No name '%s' in enumeration type '%s'"),
name,
3822 struct type *context_type,
3823 bool parse_completion,
3827 std::vector<struct block_symbol> candidates
3830 if (std::any_of (candidates.begin (),
3834 switch (bsym.symbol->aclass ())
3839 case LOC_REGPARM_ADDR:
3853 (candidates.begin (),
3857 return bsym.symbol->aclass () == LOC_TYPEDEF;
3865 (candidates.begin (),
3869 return bsym.symbol->is_artificial ();
3874 if (candidates.empty ())
3875 error (_(
"No definition found for %s"), sym->print_name ());
3876 else if (candidates.size () == 1)
3878 else if (context_type !=
nullptr
3879 && context_type->code () == TYPE_CODE_ENUM)
3885 (candidates, NULL, 0,
3886 sym->linkage_name (),
3887 context_type, parse_completion);
3889 error (_(
"Could not find a match for %s"), sym->print_name ());
3893 gdb_printf (_(
"Multiple matches for %s\n"), sym->print_name ());
3898 tracker->update (candidates[i]);
3899 return candidates[i];
3912 if (ftype->
code () == TYPE_CODE_REF)
3914 if (atype->
code () == TYPE_CODE_REF)
3917 switch (ftype->
code ())
3920 return ftype->
code () == atype->
code ();
3922 if (atype->
code () != TYPE_CODE_PTR)
3926 if (atype->
code () == TYPE_CODE_INT && atype->
length () == 0)
3930 case TYPE_CODE_ENUM:
3931 case TYPE_CODE_RANGE:
3932 switch (atype->
code ())
3935 case TYPE_CODE_ENUM:
3936 case TYPE_CODE_RANGE:
3942 case TYPE_CODE_ARRAY:
3943 return (atype->
code () == TYPE_CODE_ARRAY
3946 case TYPE_CODE_STRUCT:
3948 return (atype->
code () == TYPE_CODE_ARRAY
3951 return (atype->
code () == TYPE_CODE_STRUCT
3954 case TYPE_CODE_UNION:
3956 return (atype->
code () == ftype->
code ());
3972 &&
func_type->code () == TYPE_CODE_ENUM)
3973 return (n_actuals == 0);
3977 if (
func_type->num_fields () != n_actuals)
3980 for (i = 0; i < n_actuals; i += 1)
3982 if (actuals[i] == NULL)
4004 struct type *return_type;
4009 if (
func_type->code () == TYPE_CODE_FUNC)
4013 if (return_type == NULL)
4018 if (return_type->code () == TYPE_CODE_ENUM)
4019 return context_type == NULL || return_type == context_type;
4020 else if (context_type == NULL)
4021 return return_type->code () != TYPE_CODE_VOID;
4023 return return_type->code () == context_type->
code ();
4041 struct value **args,
int nargs,
4042 const char *
name,
struct type *context_type,
4043 bool parse_completion)
4053 for (fallback = 0; m == 0 && fallback < 2; fallback++)
4055 for (k = 0; k < syms.size (); k += 1)
4074 else if (m > 1 && !parse_completion)
4099 case TYPE_CODE_FIXED_POINT:
4101 case TYPE_CODE_RANGE:
4123 case TYPE_CODE_RANGE:
4144 case TYPE_CODE_RANGE:
4145 case TYPE_CODE_ENUM:
4147 case TYPE_CODE_FIXED_POINT:
4169 case TYPE_CODE_RANGE:
4170 case TYPE_CODE_ENUM:
4171 case TYPE_CODE_BOOL:
4172 case TYPE_CODE_CHAR:
4187 struct type *type0 =
4189 struct type *type1 =
4208 case BINOP_BITWISE_AND:
4209 case BINOP_BITWISE_IOR:
4210 case BINOP_BITWISE_XOR:
4214 case BINOP_NOTEQUAL:
4229 case UNOP_LOGICAL_NOT:
4271 const char **renamed_entity,
int *len,
4272 const char **renaming_expr)
4314 if (renamed_entity != NULL)
4315 *renamed_entity = info;
4316 suffix = strstr (info,
"___XE");
4317 if (suffix == NULL || suffix == info)
4320 *len = strlen (info) - strlen (suffix);
4322 if (renaming_expr != NULL)
4323 *renaming_expr = suffix;
4331static struct value *
4335 const char *sym_name;
4349static struct value *
4356 const CORE_ADDR addr =
4379static struct value *
4382 struct type *t, *t1;
4388 if (t->
code () == TYPE_CODE_REF)
4394 if (t1->
code () == TYPE_CODE_PTR)
4401 while (t->
code () == TYPE_CODE_PTR)
4407 if (t1->
code () == TYPE_CODE_PTR)
4416 if (t1->
code () != TYPE_CODE_STRUCT && t1->
code () != TYPE_CODE_UNION)
4423 int bit_offset, bit_size, byte_offset;
4424 struct type *field_type;
4427 if (t->
code () == TYPE_CODE_PTR)
4439 || (t1->
code () == TYPE_CODE_REF
4446 nullptr,
nullptr,
nullptr,
4458 address, NULL, check_tag);
4470 if (t->
code () == TYPE_CODE_REF)
4483 if (v != NULL || no_err)
4486 error (_(
"There is no member named %s."),
name);
4492 error (_(
"Attempt to extract a component of "
4493 "a value that is not a record."));
4506 struct type *formal_target =
4507 formal_type->
code () == TYPE_CODE_PTR
4509 struct type *actual_target =
4510 actual_type->
code () == TYPE_CODE_PTR
4514 && actual_target->
code () == TYPE_CODE_ARRAY)
4516 else if (formal_type->
code () == TYPE_CODE_PTR
4517 || formal_type->
code () == TYPE_CODE_REF)
4519 struct value *result;
4521 if (formal_target->
code () == TYPE_CODE_ARRAY
4524 else if (formal_type->
code () != TYPE_CODE_PTR)
4541 else if (actual_type->
code () == TYPE_CODE_PTR)
4566 gdb_byte *buf = (gdb_byte *) alloca (len);
4582static struct value *
4624 if (
type->
code () == TYPE_CODE_PTR)
4679 for (e = &sym_cache->
root[h]; *e != NULL; e = &(*e)->
next)
4681 if (
domain == (*e)->domain && strcmp (
name, (*e)->name) == 0)
4704 *
block = (*e)->block;
4740 sym_cache->
root[h] = e;
4758 return (strstr (lookup_name,
"__") == NULL
4788 if (sym.symbol->type ()->code () != TYPE_CODE_FUNC
4789 && (sym.symbol->type ()->code () != TYPE_CODE_ENUM
4804 if (type0 == NULL || type1 == NULL
4805 || type0->
code () != type1->
code ())
4807 if ((type0->
code () == TYPE_CODE_STRUCT
4808 || type0->
code () == TYPE_CODE_ENUM)
4834 struct type *type0 = sym0->
type ();
4835 struct type *type1 = sym1->
type ();
4838 int len0 = strlen (name0);
4843 || (len0 < strlen (name1) && strncmp (name0, name1, len0) == 0
4844 && startswith (name1 + len0,
"___XV")));
4854 return (strcmp (name0, name1) == 0
4880 for (
int i = result.size () - 1; i >= 0; i -= 1)
4886 result[i].symbol = sym;
4895 result.push_back (info);
4917 [&result, lookup_name, match_name] (
struct objfile *obj)
4921 if (match_name (msymbol->linkage_name (), lookup_name, nullptr)
4922 && msymbol->type () != mst_solib_trampoline)
4924 result.minsym = msymbol;
4925 result.objfile = obj;
4944 return (
name != NULL && strcmp (
name,
"<variable, no debug info>") == 0);
4973 const char *name_1 = type1->
field (i).
name ();
4974 const char *name_2 = type2->
field (i).
name ();
4975 int len_1 = strlen (name_1);
4976 int len_2 = strlen (name_2);
5023 for (i = 0; i < syms.size (); i++)
5028 for (i = 1; i < syms.size (); i++)
5033 for (i = 1; i < syms.size (); i++)
5035 != syms[0].symbol->type ()->num_fields ())
5041 for (i = 1; i < syms.size (); i++)
5043 syms[0].symbol->type ()))
5063 if (syms->size () < 2)
5067 while (i < syms->
size ())
5075 && (*syms)[i].symbol->linkage_name () != NULL)
5077 for (j = 0; j < syms->size (); j++)
5081 && (*syms)[j].symbol->linkage_name () != NULL
5083 (*syms)[j].symbol->linkage_name ()) == 0)
5092 && (*syms)[i].symbol->aclass () ==
LOC_STATIC
5095 for (j = 0; j < syms->size (); j += 1)
5100 (*syms)[j].symbol->linkage_name ()) == 0
5101 && ((*syms)[i].symbol->aclass ()
5102 == (*syms)[j].symbol->aclass ())
5103 && (*syms)[i].symbol->value_address ()
5104 == (*syms)[j].symbol->value_address ())
5110 syms->erase (syms->begin () + i);
5144 const char *
name = renaming_type->
name ();
5145 const char *suffix = strstr (
name,
"___XR");
5151 for (last = suffix - 3; last >
name; last--)
5152 if (last[0] ==
'_' && last[1] ==
'_')
5156 return std::string (
name, last);
5180 if (strstr (
name,
"__") != NULL)
5183 std::string fun_name = string_printf (
"_ada_%s",
name);
5210 if (startswith (function_name,
"_ada_"))
5213 return !startswith (function_name, scope.c_str ());
5255 const struct block *current_block)
5257 struct symbol *current_function;
5258 const char *current_function_name;
5260 int is_new_style_renaming;
5265 is_new_style_renaming = 0;
5266 for (i = 0; i < syms->size (); i += 1)
5269 const struct block *
block = (*syms)[i].block;
5276 suffix = strstr (
name,
"___XR");
5280 int name_len = suffix -
name;
5283 is_new_style_renaming = 1;
5284 for (j = 0; j < syms->size (); j += 1)
5285 if (i != j && (*syms)[j].
symbol != NULL
5288 &&
block == (*syms)[j].block)
5289 (*syms)[j].symbol = NULL;
5292 if (is_new_style_renaming)
5296 for (j = k = 0; j < syms->size (); j += 1)
5297 if ((*syms)[j].
symbol != NULL)
5299 (*syms)[k] = (*syms)[j];
5309 if (current_block == NULL)
5313 if (current_function == NULL)
5316 current_function_name = current_function->
linkage_name ();
5317 if (current_function_name == NULL)
5325 while (i < syms->
size ())
5330 current_function_name))
5331 syms->erase (syms->begin () + i);
5347 while (
block != NULL)
5426 int defns_mark = result.size ();
5433 renaming = renaming->
next)
5457 r_name = (renaming->
alias != NULL
5460 if (name_match (r_name, lookup_name, NULL))
5469 return result.size () != defns_mark;
5479 while (*string1 !=
'\0' && *string2 !=
'\0')
5483 if (isspace (*string1) || isspace (*string2))
5488 c1 = tolower (*string1);
5489 c2 = tolower (*string2);
5508 if (*string2 ==
'\0')
5517 if (*string2 ==
'(')
5522 return tolower (*string1) - tolower (*string2);
5524 return *string1 - *string2;
5586 =
symtab->blockvector ()->block (block_kind);
5615 = cu->blockvector ()->global_block ();
5619 data.found_sym =
true;
5623 if (result.empty () && global && !is_wild_match)
5626 std::string bracket_name = std::string (
"<_ada_") +
name +
'>';
5657 int *made_global_lookup_p)
5661 if (made_global_lookup_p)
5662 *made_global_lookup_p = 0;
5687 if (!result.empty () || !full_search)
5703 if (made_global_lookup_p)
5704 *made_global_lookup_p = 1;
5713 if (result.empty ())
5732static std::vector<struct block_symbol>
5738 int syms_from_global_search;
5739 std::vector<struct block_symbol> results;
5742 domain, full_search, &syms_from_global_search);
5746 if (results.empty () && full_search && syms_from_global_search)
5749 if (results.size () == 1 && full_search && syms_from_global_search)
5762std::vector<struct block_symbol>
5792 gdb_assert (info != NULL);
5805 std::vector<struct block_symbol> candidates
5808 if (candidates.empty ())
5836 const char *matching;
5837 const int len = strlen (str);
5841 if (len > 3 && str[0] ==
'_' && str[1] ==
'_' && isdigit (str[2]))
5844 while (isdigit (str[0]))
5850 if (str[0] ==
'.' || str[0] ==
'$')
5853 while (isdigit (matching[0]))
5855 if (matching[0] ==
'\0')
5861 if (len > 3 && str[0] ==
'_' && str[1] ==
'_' && str[2] ==
'_')
5864 while (isdigit (matching[0]))
5866 if (matching[0] ==
'\0')
5872 if (strcmp (str,
"TKB") == 0)
5888 if (len == 1 && str [0] ==
'N')
5893 if (len > 3 && str[0] ==
'_' && str [1] ==
'E' && isdigit (str[2]))
5896 while (isdigit (matching[0]))
5898 if ((matching[0] ==
'b' || matching[0] ==
's')
5899 && matching [1] ==
'\0')
5911 while (str[0] !=
'_' && str[0] !=
'\0')
5913 if (str[0] !=
'n' && str[0] !=
'b')
5919 if (str[0] ==
'\000')
5924 if (str[1] !=
'_' || str[2] ==
'\000')
5928 if (strcmp (str + 3,
"JM") == 0)
5935 if (strcmp (str + 3,
"LJM") == 0)
5939 if (str[4] ==
'F' || str[4] ==
'D' || str[4] ==
'B'
5940 || str[4] ==
'U' || str[4] ==
'P')
5942 if (str[4] ==
'R' && str[5] !=
'T')
5946 if (!isdigit (str[2]))
5948 for (k = 3; str[k] !=
'\0'; k += 1)
5949 if (!isdigit (str[k]) && str[k] !=
'_')
5953 if (str[0] ==
'$' && isdigit (str[1]))
5955 for (k = 2; str[k] !=
'\0'; k += 1)
5956 if (!isdigit (str[k]) && str[k] !=
'_')
5969 std::string decoded_name =
ada_decode (name0);
5975 if (decoded_name[0] ==
'<')
5978 for (i=0; decoded_name[i] !=
'\0'; i++)
5979 if (isalpha (decoded_name[i]) && !islower (decoded_name[i]))
5992 const char *
name = *namep;
6002 if ((t1 >=
'a' && t1 <=
'z') || (t1 >=
'0' && t1 <=
'9'))
6005 if (
name == name0 + 5 && startswith (name0,
"_ada"))
6010 else if (t1 ==
'_' && ((
name[2] >=
'a' &&
name[2] <=
'z')
6011 ||
name[2] == target0))
6016 else if (t1 ==
'_' &&
name[2] ==
'B' &&
name[3] ==
'_')
6026 else if ((t0 >=
'a' && t0 <=
'z') || (t0 >=
'0' && t0 <=
'9'))
6045 const char *name0 =
name;
6047 if (startswith (
name,
"___ghost_"))
6052 const char *match =
name;
6056 for (
name += 1, p = patn + 1; *p !=
'\0';
name += 1, p += 1)
6062 if (
name[-1] ==
'_')
6114 if (!found_sym && arg_sym != NULL)
6166 if (!found_sym && arg_sym != NULL)
6182 (
const char *sym_name,
6192 if (strncmp (sym_name, text, text_len) == 0)
6195 std::string decoded_name =
ada_decode (sym_name);
6203 bool has_angle_bracket = (decoded_name[0] ==
'<');
6216 for (tmp = sym_name; *tmp !=
'\0' && !isupper (*tmp); tmp++);
6230 if (strncmp (sym_name, text, text_len) == 0)
6239 if (comp_match_res != NULL)
6241 std::string &match_str = comp_match_res->
match.
storage ();
6250 match_str = sym_name;
6254 comp_match_res->
set_match (match_str.c_str ());
6270 if (
type->
code () != TYPE_CODE_PTR)
6277 return (strcmp (
name,
"ada__tags__dispatch_table") == 0);
6290 return (strcmp (
name,
"ada__tags__interface_tag") == 0);
6319 if (
name[0] ==
'_' && !startswith (
name,
"_parent"))
6327 if (
name[0] ==
'S' ||
name[0] ==
'R' ||
name[0] ==
'O')
6331 else if (isupper (
name[0]))
6368 return (
name != NULL
6369 && strcmp (
name,
"ada__tags__dispatch_table") == 0);
6392static struct value *
6402static struct value *
6404 const gdb_byte *valaddr,
6407 int tag_byte_offset;
6408 struct type *tag_type;
6410 gdb::array_view<const gdb_byte> contents;
6411 if (valaddr !=
nullptr)
6412 contents = gdb::make_array_view (valaddr,
type->
length ());
6417 const gdb_byte *valaddr1 = ((valaddr == NULL)
6419 : valaddr + tag_byte_offset);
6420 CORE_ADDR address1 = (address == 0) ? 0 : address + tag_byte_offset;
6430 gdb::unique_xmalloc_ptr<char> type_name =
ada_tag_name (tag);
6432 if (type_name != NULL)
6447 LONGEST offset_to_top = 0;
6448 struct type *ptr_type, *obj_type;
6450 CORE_ADDR base_address;
6456 if (obj_type->
code () == TYPE_CODE_PTR || obj_type->
code () == TYPE_CODE_REF)
6486 catch (
const gdb_exception_error &e)
6493 if (offset_to_top == 0)
6500 if (offset_to_top == -1)
6506 ULONGEST last = (((ULONGEST) 1) << (8 *
offset_type->length () - 1)) - 1;
6507 if (offset_to_top == last)
6515 if (offset_to_top > 0)
6524 offset_to_top = -offset_to_top;
6552 if (data->tsd_type == 0)
6554 return data->tsd_type;
6562static struct value *
6597static gdb::unique_xmalloc_ptr<char>
6605 gdb::unique_xmalloc_ptr<char> buffer
6607 if (buffer ==
nullptr)
6616 return make_unique_xstrdup (folded);
6618 catch (
const gdb_exception &)
6630gdb::unique_xmalloc_ptr<char>
6633 gdb::unique_xmalloc_ptr<char>
name;
6654 catch (
const gdb_exception_error &e)
6679 if (parent_type->
code () == TYPE_CODE_PTR)
6699 return (
name != NULL
6700 && (startswith (
name,
"PARENT")
6701 || startswith (
name,
"_parent")));
6715 if (
name != NULL && strcmp (
name,
"RETVAL") == 0)
6726 return (
name != NULL
6727 && (startswith (
name,
"PARENT")
6728 || strcmp (
name,
"REP") == 0
6729 || startswith (
name,
"_parent")
6730 ||
name[0] ==
'S' ||
name[0] ==
'R' ||
name[0] ==
'O'));
6746 return (field_type->
code () == TYPE_CODE_UNION
6749 == TYPE_CODE_UNION)));
6774 return (
name != NULL &&
name[0] ==
'O');
6784 static std::string result;
6787 const char *discrim_end;
6788 const char *discrim_start;
6790 if (type0->
code () == TYPE_CODE_PTR)
6797 if (
name == NULL ||
name[0] ==
'\000')
6800 for (discrim_end =
name + strlen (
name) - 6; discrim_end !=
name;
6803 if (startswith (discrim_end,
"___XVN"))
6806 if (discrim_end ==
name)
6809 for (discrim_start = discrim_end; discrim_start !=
name + 3;
6812 if (discrim_start ==
name + 1)
6814 if ((discrim_start >
name + 3
6815 && startswith (discrim_start - 3,
"___"))
6816 || discrim_start[-1] ==
'.')
6820 result = std::string (discrim_start, discrim_end - discrim_start);
6821 return result.c_str ();
6837 if (!isdigit (str[k]))
6844 while (isdigit (str[k]))
6846 RU = RU * 10 + (str[k] -
'0');
6853 *
R = (-(LONGEST) (RU - 1)) - 1;
6904 if (val >=
L && val <= U)
6925 struct type *arg_type)
6942 offset + bit_pos / 8,
7016 struct type **field_type_p,
7017 int *byte_offset_p,
int *bit_offset_p,
int *bit_size_p,
7021 int parent_offset = -1;
7025 if (field_type_p != NULL)
7026 *field_type_p = NULL;
7027 if (byte_offset_p != NULL)
7029 if (bit_offset_p != NULL)
7031 if (bit_size_p != NULL)
7039 int bit_pos = 0, fld_offset = 0;
7040 if (byte_offset_p !=
nullptr || bit_offset_p !=
nullptr)
7043 fld_offset = offset + bit_pos / 8;
7048 if (t_field_name == NULL)
7069 if (field_type_p != NULL)
7071 if (byte_offset_p != NULL)
7072 *byte_offset_p = fld_offset;
7073 if (bit_offset_p != NULL)
7074 *bit_offset_p = bit_pos % 8;
7075 if (bit_size_p != NULL)
7082 field_type_p, byte_offset_p, bit_offset_p,
7083 bit_size_p, index_p))
7091 struct type *field_type
7094 for (j = 0; j < field_type->
num_fields (); j += 1)
7099 field_type_p, byte_offset_p,
7100 bit_offset_p, bit_size_p, index_p))
7104 else if (index_p != NULL)
7111 if (parent_offset != -1)
7114 int fld_offset = offset;
7115 if (byte_offset_p !=
nullptr || bit_offset_p !=
nullptr)
7118 fld_offset += bit_pos / 8;
7122 fld_offset, field_type_p, byte_offset_p,
7123 bit_offset_p, bit_size_p, index_p))
7151static struct value *
7156 int parent_offset = -1;
7163 if (t_field_name == NULL)
7201 for (j = 0; j < field_type->
num_fields (); j += 1)
7218 if (parent_offset != -1)
7232 int,
struct type *);
7240static struct value *
7252static struct value *
7278 error (_(
"Cannot assign this kind of variant record"));
7280 else if (*index_p == 0)
7325 int parent_offset = -1;
7330 if (refok &&
type != NULL)
7340 || (
type->
code () != TYPE_CODE_STRUCT
7341 &&
type->
code () != TYPE_CODE_UNION))
7346 error (_(
"Type %s is not a structure or union type"),
7357 if (t_field_name == NULL)
7390 for (j = field_type->
num_fields () - 1; j >= 0; j -= 1)
7396 const char *v_field_name = field_type->
field (j).
name ();
7398 if (v_field_name != NULL
7415 if (parent_offset != -1)
7428 const char *name_str =
name != NULL ?
name : _(
"<null>");
7430 error (_(
"Type %s has no component named %s"),
7461 struct value *discrim;
7462 LONGEST discrim_val;
7468 if (discrim == NULL)
7473 for (i = 0; i < var_type->
num_fields (); i += 1)
7481 return others_clause;
7539static struct value *
7544 struct value *val = val0;
7572 len = strlen (
name);
7574 if (!isdigit (
name[len - 1]))
7577 if (isdigit (
name[len - 2]))
7578 align_offset = len - 2;
7580 align_offset = len - 1;
7582 if (align_offset < 7 || !startswith (
name + align_offset - 6,
"___XV"))
7583 return TARGET_CHAR_BIT;
7585 return atoi (
name + align_offset) * TARGET_CHAR_BIT;
7613 return sym->
type ();
7628 return strstr (
name,
"___XR") != NULL;
7641 else if (type0 == NULL)
7643 else if (type1->
code () == TYPE_CODE_VOID)
7645 else if (type0->
code () == TYPE_CODE_VOID)
7647 else if (type1->
name () == NULL && type0->
name () != NULL)
7656 const char *type0_name = type0->
name ();
7657 const char *type1_name = type1->
name ();
7659 if (type0_name != NULL && strstr (type0_name,
"___XR") != NULL
7660 && (type1_name == NULL || strstr (type1_name,
"___XR") == NULL))
7683 struct type *result, *tmp;
7694 while (result != NULL)
7698 if (result_name == NULL)
7700 warning (_(
"unexpected null name on descriptive type"));
7705 if (strcmp (result_name,
name) == 0)
7744 struct type *result = NULL;
7764 if (type_name == NULL)
7767 len = strlen (type_name);
7769 name = (
char *) alloca (len + strlen (suffix) + 1);
7771 strcpy (
name, type_name);
7772 strcpy (
name + len, suffix);
7808 && templ_type->
field (field_num).
type ()->
code () == TYPE_CODE_PTR
7809 && strstr (
name,
"___XVL") != NULL;
7864 const gdb_byte *valaddr,
7865 CORE_ADDR address,
struct value *dval0,
7866 int keep_dynamic_fields)
7870 int nfields, bit_len;
7881 if (keep_dynamic_fields)
7893 rtype->
set_code (TYPE_CODE_STRUCT);
7905 for (
f = 0;
f < nfields;
f += 1)
7919 const gdb_byte *field_valaddr = valaddr;
7920 CORE_ADDR field_address = address;
7952 off / TARGET_CHAR_BIT);
7954 off / TARGET_CHAR_BIT);
7964 field_address, dval, 0);
8001 if (field_type->
code () == TYPE_CODE_TYPEDEF)
8008 if (off + fld_bit_len > bit_len)
8009 bit_len = off + fld_bit_len;
8011 rtype->
set_length (align_up (bit_len, TARGET_CHAR_BIT) / TARGET_CHAR_BIT);
8020 struct type *branch_type;
8041 if (branch_type == NULL)
8053 if (off + fld_bit_len > bit_len)
8054 bit_len = off + fld_bit_len;
8057 (align_up (bit_len, TARGET_CHAR_BIT) / TARGET_CHAR_BIT);
8070 warning (_(
"Invalid type size for `%s' detected: %s."),
8073 warning (_(
"Invalid type size for <unnamed> detected: %s."),
8087 CORE_ADDR address,
struct value *dval0)
8125 for (
f = 0;
f < nfields;
f += 1)
8152 memcpy (fields, type0->
fields (),
8153 sizeof (
struct field) * nfields);
8177 CORE_ADDR address,
struct value *dval0)
8181 struct type *branch_type;
8198 rtype->
set_code (TYPE_CODE_STRUCT);
8218 / TARGET_CHAR_BIT), dval);
8219 if (branch_type == NULL)
8261 CORE_ADDR address,
struct value *dval)
8263 struct type *templ_type;
8270 if (templ_type != NULL)
8274 if (dval == NULL && valaddr == NULL && address == 0)
8297 CORE_ADDR address,
struct value *dval)
8300 struct type *templ_type;
8301 struct type *var_type;
8303 if (var_type0->
code () == TYPE_CODE_PTR)
8306 var_type = var_type0;
8310 if (templ_type != NULL)
8311 var_type = templ_type;
8325 (var_type->
field (which).
type (), valaddr, address, dval);
8336 struct type *encoding_type)
8338 const char *bounds_str;
8342 gdb_assert (range_type->
code () == TYPE_CODE_RANGE);
8358 if (encoding_type->
name () == NULL)
8361 bounds_str = strstr (encoding_type->
name (),
"___XDLU_");
8362 if (bounds_str == NULL)
8386 struct type *desc_type)
8391 for (i = 0; i < desc_type->
num_fields (); i++)
8414 struct type *index_type_desc;
8415 struct type *result;
8416 int constrained_packed_array_p;
8417 static const char *xa_suffix =
"___XA";
8424 if (constrained_packed_array_p)
8427 if (type0 ==
nullptr)
8428 error (_(
"could not decode constrained packed array type"));
8437 if (index_type_desc == NULL)
8441 if (type_name != NULL)
8443 const int len = strlen (type_name);
8444 char *
name = (
char *) alloca (len + strlen (xa_suffix));
8446 if (type_name[len - 1] ==
'P')
8448 strcpy (
name, type_name);
8449 strcpy (
name + len - 1, xa_suffix);
8456 if (index_type_desc != NULL
8464 index_type_desc = NULL;
8467 if (index_type_desc == NULL)
8487 if (elt_type0 == elt_type && !constrained_packed_array_p)
8496 struct type *elt_type0;
8499 for (i = index_type_desc->
num_fields (); i > 0; i -= 1)
8517 for (i = index_type_desc->
num_fields () - 1; i >= 0; i -= 1)
8519 struct type *range_type =
8523 result, range_type);
8533 if (constrained_packed_array_p)
8543 result->
set_length (len * elt_bitsize / HOST_CHAR_BIT);
8544 if (result->
length () * HOST_CHAR_BIT < len * elt_bitsize)
8567 CORE_ADDR address,
struct value *dval,
int check_tag)
8579 case TYPE_CODE_STRUCT:
8582 struct type *fixed_record_type =
8605 if (real_type != NULL)
8617 = (
char *) alloca (strlen (
name) + 7 );
8618 bool xvz_found =
false;
8621 xsnprintf (xvz_name, strlen (
name) + 7,
"%s___XVZ",
name);
8626 catch (
const gdb_exception_error &except)
8633 throw_error (except.error,
8634 _(
"unable to read value of %s (%s)"),
8635 xvz_name, except.what ());
8638 if (xvz_found && fixed_record_type->
length () !=
size)
8640 fixed_record_type =
copy_type (fixed_record_type);
8666 return fixed_record_type;
8668 case TYPE_CODE_ARRAY:
8670 case TYPE_CODE_UNION:
8700 CORE_ADDR address,
struct value *dval,
int check_tag)
8703 struct type *fixed_type =
8723 if (
type->
code () == TYPE_CODE_TYPEDEF
8747 switch (type0->
code ())
8751 case TYPE_CODE_STRUCT:
8757 case TYPE_CODE_UNION:
8783 if (raw_real_type ==
type)
8836 if (type1->
code () == TYPE_CODE_TYPEDEF)
8849static struct value *
8855 if (
type == type0 && val0 != NULL)
8907 if (n >= OP_ATR_FIRST && n <= (
int) OP_ATR_VAL)
8922 error (_(
"'POS only defined on discrete types"));
8925 if (!result.has_value ())
8926 error (_(
"enumeration value is invalid: can't find 'POS"));
8945static struct value *
8949 if (
type->
code () == TYPE_CODE_RANGE)
8951 if (
type->
code () == TYPE_CODE_ENUM)
8954 error (_(
"argument to 'VAL out of range"));
8967 error (_(
"'VAL only defined on discrete types"));
8969 error (_(
"'VAL requires integral argument"));
8988 if (
type->
code () == TYPE_CODE_CHAR)
8994 return (
name != NULL
8996 ||
type->
code () == TYPE_CODE_RANGE)
8997 && (strcmp (
name,
"character") == 0
8998 || strcmp (
name,
"wide_character") == 0
8999 || strcmp (
name,
"wide_wide_character") == 0
9000 || strcmp (
name,
"unsigned char") == 0));
9046 return (
type->
code () == TYPE_CODE_STRUCT
9057 struct type *real_type_namer;
9058 struct type *raw_real_type;
9060 if (raw_type == NULL || raw_type->
code () != TYPE_CODE_STRUCT)
9079 if (real_type_namer == NULL
9080 || real_type_namer->
code () != TYPE_CODE_STRUCT
9084 if (real_type_namer->
field (0).
type ()->
code () != TYPE_CODE_REF)
9090 if (raw_real_type == NULL)
9093 return raw_real_type;
9133 static std::string storage;
9145 tmp = strrchr (
name,
'.');
9150 while ((tmp = strstr (
name,
"__")) != NULL)
9152 if (isdigit (tmp[2]))
9163 if (
name[1] ==
'U' ||
name[1] ==
'W')
9166 if (
name[1] ==
'W' &&
name[2] ==
'W')
9171 if (sscanf (
name + offset,
"%x", &v) != 1)
9174 else if (((
name[1] >=
'0' &&
name[1] <=
'9')
9175 || (
name[1] >=
'a' &&
name[1] <=
'z'))
9178 storage = string_printf (
"'%c'",
name[1]);
9179 return storage.c_str ();
9184 if (isascii (v) && isprint (v))
9185 storage = string_printf (
"'%c'", v);
9186 else if (
name[1] ==
'U')
9187 storage = string_printf (
"'[\"%02x\"]'", v);
9188 else if (
name[2] !=
'W')
9189 storage = string_printf (
"'[\"%04x\"]'", v);
9191 storage = string_printf (
"'[\"%06x\"]'", v);
9193 return storage.c_str ();
9197 tmp = strstr (
name,
"__");
9199 tmp = strstr (
name,
"$");
9202 storage = std::string (
name, tmp -
name);
9203 return storage.c_str ();
9213static struct value *
9230 struct type *raw_real_type =
9235 if ((
type == raw_real_type)
9253 LONGEST lo1, hi1, lo2, hi2;
9259 error (_(
"unable to determine array bounds"));
9269 return (hi1 - lo1 == hi2 - lo2);
9278static struct value *
9288 gdb_assert (
type->
code () == TYPE_CODE_ARRAY);
9296 error (_(
"unable to determine array bounds"));
9302 for (i = 0; i < hi - lo + 1; i++)
9305 int elt_len = elt_type->
length ();
9316static struct value *
9327 if (type2->
code () == TYPE_CODE_PTR
9328 &&
type->
code () == TYPE_CODE_ARRAY)
9334 if (type2->
code () == TYPE_CODE_ARRAY
9335 &&
type->
code () == TYPE_CODE_ARRAY)
9338 error (_(
"cannot assign arrays of different length"));
9350 error (_(
"Incompatible types in assignment"));
9356static struct value *
9360 struct type *type1, *type2;
9368 if (type1->
code () != TYPE_CODE_INT
9369 || type2->
code () != TYPE_CODE_INT)
9386 if (op == BINOP_MOD)
9388 else if (op == BINOP_DIV)
9392 gdb_assert (op == BINOP_REM);
9396 error (_(
"second operand of %s must not be zero."),
name);
9408 v += v > 0 ? -1 : 1;
9433 struct type *arg1_type, *arg2_type;
9446 if (arg1_type->
code () != TYPE_CODE_ARRAY
9447 || arg2_type->
code () != TYPE_CODE_ARRAY)
9448 error (_(
"Attempt to compare array with non-array"));
9455 arg1_type->
length ()) == 0);
9467 return comp->uses_objfile (
objfile);
9484 if (lhs_type->
code () == TYPE_CODE_ARRAY)
9499 if (ag_op !=
nullptr)
9503 arg->evaluate (
nullptr, exp,
9511 if (item->uses_objfile (
objfile))
9519 gdb_printf (stream, _(
"%*sAggregate\n"), depth,
"");
9521 item->dump (stream, depth + 1);
9527 std::vector<LONGEST> &indices,
9528 LONGEST low, LONGEST high)
9531 item->assign (container, lhs, exp, indices, low, high);
9541 struct type *lhs_type;
9542 LONGEST low_index, high_index;
9549 error (_(
"Left operand of assignment is not a modifiable lvalue."));
9559 else if (lhs_type->
code () == TYPE_CODE_STRUCT)
9565 error (_(
"Left-hand side must be array or record."));
9567 std::vector<LONGEST> indices (4);
9568 indices[0] = indices[1] = low_index - 1;
9569 indices[2] = indices[3] = high_index + 1;
9571 std::get<0> (
m_storage)->assign (container, lhs, exp, indices,
9572 low_index, high_index);
9586 gdb_printf (stream, _(
"%*sPositional, index = %d\n"),
9588 m_op->dump (stream, depth + 1);
9598 std::vector<LONGEST> &indices,
9599 LONGEST low, LONGEST high)
9603 if (ind - 1 == high)
9604 warning (_(
"Extra components in aggregate ignored."));
9621 gdb_printf (stream, _(
"%*sDiscrete range:\n"), depth,
"");
9622 m_low->dump (stream, depth + 1);
9623 m_high->dump (stream, depth + 1);
9630 std::vector<LONGEST> &indices,
9631 LONGEST low, LONGEST high,
9637 if (lower <= upper && (lower < low || upper > high))
9638 error (_(
"Index in component association out of bounds."));
9641 while (lower <= upper)
9657 gdb_printf (stream, _(
"%*sName:\n"), depth,
"");
9658 m_val->dump (stream, depth + 1);
9665 std::vector<LONGEST> &indices,
9666 LONGEST low, LONGEST high,
9680 if (strop !=
nullptr)
9687 error (_(
"Invalid record component association."));
9693 NULL, NULL, NULL, NULL, &index))
9694 error (_(
"Unknown component name: %s."),
name);
9707 if (item->uses_objfile (
objfile))
9715 gdb_printf (stream, _(
"%*sChoices:\n"), depth,
"");
9716 m_op->dump (stream, depth + 1);
9718 item->dump (stream, depth + 1);
9728 std::vector<LONGEST> &indices,
9729 LONGEST low, LONGEST high)
9732 item->assign (container, lhs, exp, indices, low, high,
m_op);
9744 gdb_printf (stream, _(
"%*sOthers:\n"), depth,
"");
9745 m_op->dump (stream, depth + 1);
9755 std::vector<LONGEST> &indices,
9756 LONGEST low, LONGEST high)
9758 int num_indices = indices.size ();
9759 for (
int i = 0; i < num_indices - 2; i += 2)
9761 for (LONGEST ind = indices[i + 1] + 1; ind < indices[i + 2]; ind += 1)
9775 if (ag_op !=
nullptr)
9809 std::vector<LONGEST> &indices)
9813 int size = indices.size ();
9814 for (i = 0; i <
size; i += 2) {
9815 if (high >= indices[i] && low <= indices[i + 1])
9819 for (kh = i + 2; kh <
size; kh += 2)
9820 if (high < indices[kh])
9822 if (low < indices[i])
9824 indices[i + 1] = indices[kh - 1];
9825 if (high > indices[i + 1])
9826 indices[i + 1] = high;
9827 memcpy (indices.data () + i + 2, indices.data () + kh,
size - kh);
9828 indices.resize (kh - i - 2);
9831 else if (high < indices[i])
9835 indices.resize (indices.size () + 2);
9836 for (j = indices.size () - 1; j >= i + 2; j -= 1)
9837 indices[j] = indices[j - 2];
9839 indices[i + 1] = high;
9845static struct value *
10132 struct value *arg1)
10146 struct value *arg2, *arg3;
10150 lim_warning (_(
"Membership test incompletely implemented; "
10151 "always returns true"));
10155 case TYPE_CODE_RANGE:
10178 struct value *arg1)
10192 struct value *arg1)
10199 if (
type->
code () == TYPE_CODE_REF)
10215 struct value *arg1)
10260 if (op == BINOP_NOTEQUAL)
10271 struct value *array,
struct value *low_bound_val,
10272 struct value *high_bound_val)
10275 LONGEST high_bound;
10278 high_bound_val =
coerce_ref (high_bound_val);
10290 error (_(
"cannot slice a packed array"));
10319 error (_(
"cannot take slice of non-array"));
10330 struct type *arr_type0 =
10340 else if (high_bound < low_bound)
10351 struct value *arg1,
struct value *arg2,
int n)
10381 struct value *arg1,
struct type *type_arg,
int tem)
10385 if (type_arg == NULL)
10396 error (_(
"unexpected attribute encountered"));
10402 case OP_ATR_LENGTH:
10410 else if (type_arg == NULL)
10418 if (op == OP_ATR_LENGTH)
10431 error (_(
"unexpected attribute encountered"));
10438 case OP_ATR_LENGTH:
10445 struct type *range_type;
10449 if (
name != NULL && type_arg->
code () != TYPE_CODE_ENUM)
10451 if (range_type == NULL)
10452 range_type = type_arg;
10456 error (_(
"unexpected attribute encountered"));
10463 case OP_ATR_LENGTH:
10464 error (_(
"the 'length attribute applies only to array types"));
10467 else if (type_arg->
code () == TYPE_CODE_FLT)
10468 error (_(
"unimplemented type attribute"));
10477 if (op == OP_ATR_LENGTH)
10489 error (_(
"unexpected attribute encountered"));
10496 case OP_ATR_LENGTH:
10552 bool deprocedure_p,
10553 bool parse_completion,
10555 struct type *context_type)
10557 if (
resolve (exp, deprocedure_p, parse_completion, tracker, context_type))
10558 return (make_operation<ada_funcall_operation>
10559 (std::move (owner),
10560 std::vector<operation_up> ()));
10561 return std::move (owner);
10578 if (
type->
code () != TYPE_CODE_ENUM)
10581 if ((val >=
'a' && val <=
'z') || (val >=
'0' && val <=
'9'))
10582 xsnprintf (
name,
sizeof (
name),
"Q%c", (
int) val);
10583 else if (val >= 0 && val < 256)
10584 xsnprintf (
name,
sizeof (
name),
"QU%02x", (
unsigned) val);
10585 else if (val >= 0 && val < 0x10000)
10586 xsnprintf (
name,
sizeof (
name),
"QW%04x", (
unsigned) val);
10588 xsnprintf (
name,
sizeof (
name),
"QWW%08lx", (
unsigned long) val);
10589 size_t len = strlen (
name);
10597 size_t elen = strlen (ename);
10599 if (elen >= len && strcmp (
name, ename + elen - len) == 0)
10611 if (expect_type !=
nullptr)
10621 bool deprocedure_p,
10622 bool parse_completion,
10624 struct type *context_type)
10628 if (context_type !=
nullptr && context_type->
code () == TYPE_CODE_ENUM)
10630 gdb_assert (result.get () ==
this);
10631 std::get<0> (
m_storage) = context_type;
10656 if ((
opcode () == OP_FLOAT ||
opcode () == OP_LONG) && expect_type != NULL)
10667 struct type *char_type;
10673 const std::string &str = std::get<0> (
m_storage);
10674 const char *encoding;
10675 switch (char_type->
length ())
10682 struct type *stringtype
10692 encoding =
"UTF-16BE";
10694 encoding =
"UTF-16LE";
10699 encoding =
"UTF-32BE";
10701 encoding =
"UTF-32LE";
10705 error (_(
"unexpected character type size %s"),
10706 pulongest (char_type->
length ()));
10709 auto_obstack converted;
10711 (
const gdb_byte *) str.c_str (),
10715 struct type *stringtype
10717 obstack_object_size (&converted)
10718 / char_type->
length ());
10721 obstack_base (&converted),
10722 obstack_object_size (&converted));
10739 rhs = rhs_expr->evaluate (
nullptr, exp,
noside);
10744 rhs = rhs_expr->evaluate (
nullptr, exp,
noside);
10746 struct type *elt_type =
nullptr;
10747 if (rhs_type->
code () == TYPE_CODE_ARRAY)
10749 lhs = lhs_expr->evaluate (elt_type, exp,
noside);
10753 lhs = lhs_expr->evaluate (
nullptr, exp,
noside);
10758 lhs = lhs_expr->evaluate (
nullptr, exp,
noside);
10760 struct type *elt_type =
nullptr;
10761 if (lhs_type->
code () == TYPE_CODE_ARRAY)
10763 rhs = rhs_expr->evaluate (elt_type, exp,
noside);
10799 auto do_op = [=] (LONGEST x, LONGEST y)
10801 if (std::get<0> (
m_storage) == BINOP_ADD)
10818 while (
type->
code () == TYPE_CODE_REF)
10826 if (
type->
code () == TYPE_CODE_RANGE)
10836 struct type *type_arg =
nullptr;
10837 value *val =
nullptr;
10849 val, type_arg, std::get<2> (
m_storage));
10909 error (_(
"Unexpected unresolved symbol, %s, during evaluation"),
10921 || (
type->
code () == TYPE_CODE_REF
10943 if (
type->
code () != TYPE_CODE_REF)
10945 struct type *actual_type;
10948 if (actual_type == NULL)
10954 actual_type =
type;
10964 return value_ref (arg1, TYPE_CODE_REF);
10976 if ((
type->
code () == TYPE_CODE_STRUCT
10978 || (
type->
code () == TYPE_CODE_UNION
10989 bool deprocedure_p,
10990 bool parse_completion,
10992 struct type *context_type)
10999 context_type, parse_completion,
11000 deprocedure_p, tracker);
11006 == TYPE_CODE_FUNC))
11036 if (arrType == NULL)
11037 error (_(
"Attempt to dereference null array pointer."));
11040 else if (
type->
code () == TYPE_CODE_PTR
11043 ||
type->
code () == TYPE_CODE_ARRAY)
11050 if ((
type->
code () == TYPE_CODE_REF
11051 ||
type->
code () == TYPE_CODE_PTR)
11054 arg1 = std::get<0> (
m_storage)->evaluate (
nullptr, exp,
11066 else if (
type->
code () == TYPE_CODE_INT)
11069 if (expect_type == NULL)
11080 error (_(
"Attempt to take contents of a non-pointer value."));
11085 if (
type->
code () == TYPE_CODE_INT)
11090 if (expect_type != NULL)
11111 const char *str = std::get<1> (
m_storage).c_str ();
11127 arg1 = std::get<0> (
m_storage)->evaluate (
nullptr, exp,
11152 const std::vector<operation_up> &args_up = std::get<1> (
m_storage);
11153 int nargs = args_up.size ();
11154 std::vector<value *> argvec (nargs);
11161 error (_(
"Unexpected unresolved symbol, %s, during evaluation"),
11164 value *callee = callee_op->evaluate (
nullptr, exp,
noside);
11165 for (
int i = 0; i < args_up.size (); ++i)
11194 if (
type->
code () == TYPE_CODE_TYPEDEF)
11197 if (
type->
code () == TYPE_CODE_PTR)
11201 case TYPE_CODE_FUNC:
11204 case TYPE_CODE_ARRAY:
11206 case TYPE_CODE_STRUCT:
11212 error (_(
"cannot subscript or call something of type `%s'"),
11220 case TYPE_CODE_FUNC:
11228 case TYPE_CODE_INTERNAL_FUNCTION:
11240 case TYPE_CODE_STRUCT:
11247 error (_(
"cannot subscript or call a record"));
11248 if (arity != nargs)
11249 error (_(
"wrong number of subscripts; expecting %d"), arity);
11254 (callee, nargs, argvec.data ()));
11256 case TYPE_CODE_ARRAY:
11261 error (_(
"element type of array unknown"));
11268 nargs, argvec.data ()));
11269 case TYPE_CODE_PTR:
11275 error (_(
"element type of array unknown"));
11284 error (_(
"Attempt to index or call something other than an "
11285 "array or function"));
11291 bool deprocedure_p,
11292 bool parse_completion,
11294 struct type *context_type)
11300 if (avv ==
nullptr)
11307 const std::vector<operation_up> &args_up = std::get<1> (
m_storage);
11308 int nargs = args_up.size ();
11309 std::vector<value *> argvec (nargs);
11311 for (
int i = 0; i < args_up.size (); ++i)
11317 context_type, parse_completion,
11318 nargs, argvec.data (),
11322 = make_operation<ada_var_value_operation> (resolved);
11328 bool deprocedure_p,
11329 bool parse_completion,
11331 struct type *context_type)
11335 value *v = std::get<0> (
m_storage)->evaluate (context_type, exp,
11338 error (_(
"cannot slice a packed array"));
11368 static std::string storage;
11369 const char *pstart, *pend, *bound;
11370 struct value *bound_val;
11372 if (dval == NULL || str == NULL || str[k] ==
'\0')
11376 pend = strstr (pstart,
"__");
11380 k += strlen (bound);
11384 int len = pend - pstart;
11387 storage = std::string (pstart, len);
11388 bound = storage.c_str ();
11393 if (bound_val == NULL)
11397 if (pnew_k != NULL)
11406static struct value *
11413 std::vector<struct block_symbol> syms
11418 if (syms.size () != 1)
11420 if (err_msg == NULL)
11423 error ((
"%s"), err_msg);
11455static struct type *
11459 struct type *base_type;
11460 const char *subtype_info;
11462 gdb_assert (raw_type != NULL);
11463 gdb_assert (raw_type->
name () != NULL);
11465 if (raw_type->
code () == TYPE_CODE_RANGE)
11468 base_type = raw_type;
11471 subtype_info = strstr (
name,
"___XD");
11472 if (subtype_info == NULL)
11477 if (L < INT_MIN || U >
INT_MAX)
11485 int prefix_len = subtype_info -
name;
11488 const char *bounds_str;
11492 bounds_str = strchr (subtype_info,
'_');
11495 if (*subtype_info ==
'L')
11500 if (bounds_str[n] ==
'_')
11502 else if (bounds_str[n] ==
'.')
11508 std::string name_buf = std::string (
name, prefix_len) +
"___L";
11511 lim_warning (_(
"Unknown lower bound, using 1."));
11516 if (*subtype_info ==
'U')
11524 std::string name_buf = std::string (
name, prefix_len) +
"___U";
11527 lim_warning (_(
"Unknown upper bound, using %ld."), (
long)
L);
11548 return (
name != NULL && strstr (
name,
"___XD"));
11561 return (subranged_type != NULL &&
type->
code () == TYPE_CODE_RANGE
11562 && subranged_type->
code () == TYPE_CODE_INT
11574 return (ULONGEST) high.
const_val () + 1;
11623 "constraint_error",
11668 "__gnat_debug_raise_exception",
11669 "__gnat_unhandled_exception",
11670 "__gnat_debug_raise_assert_failure",
11671 "__gnat_begin_handler_v1",
11681 "__gnat_debug_raise_exception",
11682 "__gnat_unhandled_exception",
11683 "__gnat_debug_raise_assert_failure",
11684 "__gnat_begin_handler",
11694 "__gnat_raise_nodefer_with_msg",
11695 "__gnat_unhandled_exception",
11696 "system__assertions__raise_assert_failure",
11697 "__gnat_begin_handler",
11738 error (_(
"Your Ada runtime appears to be missing some debugging "
11739 "information.\nCannot insert Ada exception catchpoint "
11740 "in this configuration."));
11749 error (_(
"Symbol \"%s\" is not a function (class = %d)"),
11761 error (_(
"Your Ada runtime appears to be missing some debugging "
11762 "information.\nCannot insert Ada exception catchpoint "
11763 "in this configuration."));
11772 error (_(
"Symbol \"%s\" is not a function (class = %d)"),
11792 if (data->exception_info != NULL)
11823 error (_(
"Unable to insert catchpoint. Is this an Ada main program?"));
11831 error (_(
"Unable to insert catchpoint. Try to start the program first."));
11840 error (_(
"Cannot insert Ada exception catchpoints in this configuration."));
11853 const char *fullname;
11869 if (access (fullname, R_OK) != 0)
11889 gdb::unique_xmalloc_ptr<char> func_name
11891 if (func_name == NULL)
11897 if (re_exec (func_name.get ()))
11950 for (frame_level = 0; frame_level < 3; frame_level += 1)
11958 gdb::unique_xmalloc_ptr<char> func_name
11960 if (func_name != NULL)
11962 if (strcmp (func_name.get (),
11963 data->exception_info->catch_exception_sym) == 0)
11996 return data->exception_info->unhandled_exception_name_addr ();
12009 internal_error (_(
"unexpected catchpoint type"));
12028static gdb::unique_xmalloc_ptr<char>
12031 struct value *e_msg_val;
12037 if (e_msg_val == NULL)
12041 gdb_assert (e_msg_val != NULL);
12046 if (e_msg_len <= 0)
12049 gdb::unique_xmalloc_ptr<char> e_msg ((
char *)
xmalloc (e_msg_len + 1));
12052 e_msg.get ()[e_msg_len] =
'\0';
12060static gdb::unique_xmalloc_ptr<char>
12063 gdb::unique_xmalloc_ptr<char> e_msg;
12069 catch (
const gdb_exception_error &e)
12071 e_msg.reset (
nullptr);
12085 CORE_ADDR result = 0;
12092 catch (
const gdb_exception_error &e)
12094 warning (_(
"failed to get exception name: %s"), e.what ());
12102 (
const char *excep_string,
12125 const char *addr_string_,
12136 gdb_assert (sal.
pspace !=
nullptr);
12165 void re_set ()
override;
12207 if (c->
loc == NULL)
12212 std::string cond_string
12223 if (!bl->shlib_disabled)
12227 s = cond_string.c_str ();
12234 catch (
const gdb_exception_error &e)
12236 warning (_(
"failed to reevaluate internal exception condition "
12237 "for catchpoint %d: %s"),
12292 expr = (
"GNAT_GCC_exception_Access(gcc_exception)"
12293 ".all.occurrence.id");
12300 catch (
const gdb_exception_error &ex)
12310 if (ada_loc->excep_cond_expr == NULL)
12323 catch (
const gdb_exception &ex)
12326 _(
"Error in testing exception condition:\n"));
12359 ?
"\nTemporary catchpoint " :
"\nCatchpoint ");
12361 uiout->
text (
", ");
12377 char exception_name[256];
12382 sizeof (exception_name) - 1);
12383 exception_name [
sizeof (exception_name) - 1] =
'\0';
12393 memcpy (exception_name,
"exception",
sizeof (
"exception"));
12401 uiout->
text (
"unhandled ");
12402 uiout->
field_string (
"exception-name", exception_name);
12411 uiout->
text (
"failed assertion");
12416 if (exception_message != NULL)
12418 uiout->
text (
" (");
12419 uiout->
field_string (
"exception-message", exception_message.get ());
12423 uiout->
text (
" at ");
12440 if (opts.addressprint)
12449 std::string msg = string_printf (_(
"`%s' Ada exception"),
12460 uiout->
field_string (
"what",
"unhandled Ada exceptions");
12467 _(
"`%s' Ada exception handlers"),
12471 uiout->
field_string (
"what",
"all Ada exceptions handlers");
12475 uiout->
field_string (
"what",
"failed Ada assertions");
12479 internal_error (_(
"unexpected catchpoint type"));
12495 : _(
"Catchpoint "));
12497 uiout->
text (
": ");
12504 std::string info = string_printf (_(
"`%s' Ada exception"),
12506 uiout->
text (info);
12509 uiout->
text (_(
"all Ada exceptions"));
12513 uiout->
text (_(
"unhandled Ada exceptions"));
12520 = string_printf (_(
"`%s' Ada exception handlers"),
12522 uiout->
text (info);
12525 uiout->
text (_(
"all Ada exceptions handlers"));
12529 uiout->
text (_(
"failed Ada assertions"));
12533 internal_error (_(
"unexpected catchpoint type"));
12553 gdb_printf (fp,
"catch exception unhandled");
12565 internal_error (_(
"unexpected catchpoint type"));
12590 bool is_catch_handlers_cmd,
12592 std::string *excep_string,
12593 std::string *cond_string)
12595 std::string exception_name;
12598 if (exception_name ==
"if")
12603 exception_name.clear ();
12609 args = skip_spaces (args);
12610 if (startswith (args,
"if")
12611 && (isspace (args[2]) || args[2] ==
'\0'))
12614 args = skip_spaces (args);
12616 if (args[0] ==
'\0')
12617 error (_(
"Condition missing after `if' keyword"));
12618 *cond_string = args;
12620 args += strlen (args);
12626 if (args[0] !=
'\0')
12627 error (_(
"Junk at end of expression"));
12629 if (is_catch_handlers_cmd)
12633 *excep_string = exception_name;
12635 else if (exception_name.empty ())
12639 excep_string->clear ();
12641 else if (exception_name ==
"unhandled")
12645 excep_string->clear ();
12651 *excep_string = exception_name;
12663 gdb_assert (data->exception_info != NULL);
12668 return (data->exception_info->catch_exception_sym);
12671 return (data->exception_info->catch_exception_unhandled_sym);
12674 return (data->exception_info->catch_assert_sym);
12677 return (data->exception_info->catch_handlers_sym);
12680 internal_error (_(
"unexpected catchpoint kind (%d)"), ex);
12694 bool is_standard_exc =
false;
12695 std::string result;
12701 result = (
"long_integer (GNAT_GCC_exception_Access"
12702 "(gcc_exception).all.occurrence.id)");
12705 result =
"long_integer (e)";
12728 if (strcmp (
name, excep_string) == 0)
12730 is_standard_exc =
true;
12737 if (is_standard_exc)
12738 string_appendf (result,
"long_integer (&standard.%s)", excep_string);
12740 string_appendf (result,
"long_integer (&%s)", excep_string);
12754 std::string *addr_string)
12756 const char *sym_name;
12768 error (_(
"Catchpoint symbol not found: %s"), sym_name);
12771 error (_(
"Unable to insert catchpoint. %s is not a function."), sym_name);
12774 *addr_string = sym_name;
12797 const std::string &excep_string,
12798 const std::string &cond_string,
12803 std::string addr_string;
12806 std::unique_ptr<ada_catchpoint> c
12808 tempflag, disabled, from_tty));
12809 c->excep_string = excep_string;
12811 if (!cond_string.empty ())
12822 const char *arg = arg_entry;
12826 std::string excep_string;
12827 std::string cond_string;
12836 excep_string, cond_string,
12847 const char *arg = arg_entry;
12851 std::string excep_string;
12852 std::string cond_string;
12861 excep_string, cond_string,
12870 const char *text,
const char *word)
12876 if (startswith (
info.name, word))
12892 args = skip_spaces (args);
12895 if (startswith (args,
"if")
12896 && (isspace (args[2]) || args[2] ==
'\0'))
12899 args = skip_spaces (args);
12900 if (args[0] ==
'\0')
12901 error (_(
"condition missing after `if' keyword"));
12902 cond_string.assign (args);
12907 else if (args[0] !=
'\0')
12908 error (_(
"Junk at end of arguments."));
12917 const char *arg = arg_entry;
12920 std::string cond_string;
12938 const char *type_name = sym->
type ()->
name ();
12944 && type_name != NULL && strcmp (type_name,
"exception") == 0);
12964 if (strcmp (sym->
linkage_name (),
"numeric_error") == 0)
12981 result = strcmp (
name, other.
name);
12984 if (result == 0 &&
addr < other.
addr)
13004 std::sort (exceptions->begin () + skip, exceptions->end ());
13005 exceptions->erase (std::unique (exceptions->begin () + skip, exceptions->end ()),
13006 exceptions->end ());
13021 std::vector<ada_exc_info> *exceptions)
13025 if (preg == NULL || preg->exec (
name, 0, NULL, 0) == 0)
13040 if (match_name (msymbol->linkage_name (), lookup_name,
13047 exceptions->push_back (
info);
13068 std::vector<ada_exc_info> *exceptions)
13091 exceptions->push_back (info);
13106 return (preg == NULL
13131 std::vector<ada_exc_info> *exceptions)
13138 [&] (
const char *search_name)
13140 std::string decoded =
ada_decode (search_name);
13153 const struct blockvector *bv = s->blockvector ();
13169 exceptions->push_back (info);
13182static std::vector<ada_exc_info>
13185 std::vector<ada_exc_info> result;
13199 prev_len = result.size ();
13202 if (result.size () > prev_len)
13208 prev_len = result.size ();
13210 if (result.size () > prev_len)
13230std::vector<ada_exc_info>
13233 if (regexp == NULL)
13236 compiled_regex reg (regexp, REG_NOSUB, _(
"invalid regular expression"));
13249 if (regexp != NULL)
13251 (_(
"All Ada exceptions matching regular expression \"%s\":\n"), regexp);
13253 gdb_printf (_(
"All defined Ada exceptions:\n"));
13285 if (startswith (symbol_search_name,
"_ada_")
13286 && !startswith (lname,
"_ada"))
13287 symbol_search_name += 5;
13289 if (startswith (symbol_search_name,
"___ghost_")
13290 && !startswith (lname,
"___ghost_"))
13291 symbol_search_name += 9;
13293 int uscore_count = 0;
13294 while (*lname !=
'\0')
13296 if (*symbol_search_name != *lname)
13298 if (*symbol_search_name ==
'B' && uscore_count == 2
13299 && symbol_search_name[1] ==
'_')
13301 symbol_search_name += 2;
13302 while (isdigit (*symbol_search_name))
13303 ++symbol_search_name;
13304 if (symbol_search_name[0] ==
'_'
13305 && symbol_search_name[1] ==
'_')
13307 symbol_search_name += 2;
13314 if (*symbol_search_name ==
'_')
13319 ++symbol_search_name;
13333 return strcmp (symbol_search_name,
ada_lookup_name (lookup_name)) == 0;
13340 gdb::string_view user_name =
lookup_name.name ();
13342 if (!user_name.empty () && user_name[0] ==
'<')
13344 if (user_name.back () ==
'>')
13346 = gdb::to_string (user_name.substr (1, user_name.size () - 2));
13349 = gdb::to_string (user_name.substr (1, user_name.size () - 1));
13359 m_encoded_p = user_name.find (
"__") != gdb::string_view::npos;
13388 = (
lookup_name.match_type () != symbol_name_match_type::FULL
13391 && user_name.find (
'.') == std::string::npos);
13403 return lookup_name.
ada ().
matches (symbol_search_name,
13416 gdb::string_view name_view = lookup_name.
name ();
13419 ? (strncmp (symbol_search_name, name_view.data (),
13420 name_view.size ()) == 0)
13421 : symbol_search_name == name_view)
13423 if (comp_match_res != NULL)
13424 comp_match_res->
set_match (symbol_search_name);
13476 static const std::vector<const char *> extensions
13477 = {
".adb",
".ads",
".a",
".ada",
".dg" };
13488 struct value *index_value =
val_atr (index_type, index);
13497 const struct block *var_block,
13502 if (frame !=
nullptr)
13527 auto add = [&] (
struct type *t)
13535 0,
"long_integer"));
13537 0,
"short_integer"));
13549 0,
"long_long_integer"));
13559 struct type *system_addr_ptr
13562 system_addr_ptr->
set_name (
"system__address");
13563 add (system_addr_ptr);
13568 unsigned int addr_length = system_addr_ptr->
length ();
13570 "storage_offset"));
13580 gdb::function_view<symbol_found_callback_ftype> callback)
const override
13582 std::vector<struct block_symbol> results
13586 if (!callback (&sym))
13595 (
const char *mangled,
13596 gdb::unique_xmalloc_ptr<char> *out)
const override
13598 std::string demangled =
ada_decode (mangled);
13602 if (demangled != mangled && demangled[0] !=
'<')
13635 int options)
const override
13637 return make_unique_xstrdup (
ada_decode (mangled).c_str ());
13643 struct ui_file *stream,
int show,
int level,
13661 const char *text,
const char *word,
13665 const struct block *b, *surrounding_static_block = 0;
13694 language symbol_language = msymbol->language ();
13713 msymbol->linkage_name (),
13714 lookup_name, text, word);
13724 surrounding_static_block = b;
13734 lookup_name, text, word);
13746 b = s->blockvector ()->global_block ();
13755 lookup_name, text, word);
13765 b = s->blockvector ()->static_block ();
13767 if (b == surrounding_static_block)
13777 lookup_name, text, word);
13786 (
struct type *
type, CORE_ADDR addr)
const override
13790 return xstrprintf (
"{%s} %s",
name.c_str (), core_addr_to_string (addr));
13804 (
struct value *val,
struct ui_file *stream,
int recurse,
13862 struct ui_file *stream,
int quoter)
const override
13870 struct ui_file *stream)
const override
13878 const gdb_byte *
string,
unsigned int length,
13879 const char *encoding,
int force_ellipses,
13882 ada_printstr (stream, elttype,
string, length, encoding,
13883 force_ellipses, options);
13889 struct ui_file *stream)
const override
13904 {
return "(...)"; }
13981 _(
"Prefix command for changing Ada-specific settings."),
13982 _(
"Generic command for showing Ada-specific settings."),
13988Enable or disable an optimization trusting PAD types over XVS types."), _(
"\
13989Show whether an optimization trusting PAD types over XVS types is activated."),
13991This is related to the encoding used by the GNAT compiler. The debugger\n\
13992should normally trust the contents of PAD types, but certain older versions\n\
13993of GNAT have a bug that sometimes causes the information in the PAD type\n\
13994to be incorrect. Turning this setting \"off\" allows the debugger to\n\
13995work around this bug. It is always safe to turn this option \"off\", but\n\
13996this incurs a slight performance penalty, so it is recommended to NOT change\n\
13997this option to \"off\" unless necessary."),
14002Enable or disable the output of formal and return types for functions in the \
14003overloads selection menu."), _(
"\
14004Show whether the output of formal and return types for functions in the \
14005overloads selection menu is activated."),
14012Set the Ada source character set."), _(
"\
14013Show the Ada source character set."), _(
"\
14014The character set used for Ada source files.\n\
14015This must correspond to the '-gnati' or '-gnatW' option passed to GNAT."),
14020Catch Ada exceptions, when raised.\n\
14021Usage: catch exception [ARG] [if CONDITION]\n\
14022Without any argument, stop when any Ada exception is raised.\n\
14023If ARG is \"unhandled\" (without the quotes), only stop when the exception\n\
14024being raised does not have a handler (and will therefore lead to the task's\n\
14026Otherwise, the catchpoint only stops when the name of the exception being\n\
14027raised is the same as ARG.\n\
14028CONDITION is a boolean expression that is evaluated to see whether the\n\
14029exception should cause a stop."),
14036Catch Ada exceptions, when handled.\n\
14037Usage: catch handlers [ARG] [if CONDITION]\n\
14038Without any argument, stop when any Ada exception is handled.\n\
14039With an argument, catch only exceptions with the given name.\n\
14040CONDITION is a boolean expression that is evaluated to see whether the\n\
14041exception should cause a stop."),
14047Catch failed Ada assertions, when raised.\n\
14048Usage: catch assert [if CONDITION]\n\
14049CONDITION is a boolean expression that is evaluated to see whether the\n\
14050exception should cause a stop."),
14058List all Ada exception names.\n\
14059Usage: info exceptions [REGEXP]\n\
14060If a regular expression is passed as an argument, only those matching\n\
14061the regular expression are listed."));
14064 _(
"Set Ada maintenance-related variables."),
14065 _(
"Show Ada maintenance-related variables."),
14072 _(
"Set whether descriptive types generated by GNAT should be ignored."),
14073 _(
"Show whether descriptive types generated by GNAT should be ignored."),
14075When enabled, the debugger will stop using the DW_AT_GNAT_descriptive_type\n\
#define bits(obj, st, fn)
int ada_parse(struct parser_state *par_state)
struct value * ada_val_atr(enum noside noside, struct type *type, struct value *arg)
std::string ada_decode(const char *encoded, bool wrap, bool operators)
static struct value * ensure_lval(struct value *val)
bool is_ada_exception_catchpoint(breakpoint *bp)
static struct type * to_fixed_array_type(struct type *, struct value *, int)
static struct type * template_to_static_fixed_type(struct type *type0)
static int remove_compiler_suffix(const char *encoded, int *len)
static value * ada_unop_atr(struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct type *type_arg, int tem)
static struct type * ada_typedef_target_type(struct type *type)
struct value * ada_pos_atr(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg)
struct value * ada_value_primitive_packed_val(struct value *obj, const gdb_byte *valaddr, long offset, int bit_offset, int bit_size, struct type *type)
static void ada_add_global_exceptions(compiled_regex *preg, std::vector< ada_exc_info > *exceptions)
value * ada_unop_in_range(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct type *type)
static struct value * ada_value_assign(struct value *toval, struct value *fromval)
static int lesseq_defined_than(struct symbol *, struct symbol *)
static int ada_is_gnat_encoded_packed_array_type(struct type *type)
static void ada_free_objfile_observer(struct objfile *objfile)
static const utf8_entry ada_case_fold[]
static std::string ada_exception_catchpoint_cond_string(const char *excep_string, enum ada_exception_catchpoint_kind ex)
static struct type * ada_lookup_struct_elt_type(struct type *, const char *, int, int)
static struct value * ada_coerce_ref(struct value *)
static value * eval_ternop_in_range(struct type *expect_type, struct expression *exp, enum noside noside, value *arg1, value *arg2, value *arg3)
struct type * ada_index_type(struct type *type, int n, const char *name)
const gdb_byte * ada_aligned_value_addr(struct type *type, const gdb_byte *valaddr)
struct type * ada_array_element_type(struct type *type, int nindices)
struct bound_minimal_symbol ada_lookup_simple_minsym(const char *name, struct objfile *objfile)
static bool trust_pad_over_xvs
static CORE_ADDR value_pointer(struct value *value, struct type *type)
static void ada_add_all_symbols(std::vector< struct block_symbol > &, const struct block *, const lookup_name_info &lookup_name, domain_enum, int, int *)
static const char *const attribute_names[]
static struct value * desc_bounds(struct value *)
static struct ada_pspace_data * get_ada_pspace_data(struct program_space *pspace)
static const char *const gnat_source_charsets[]
value * ada_atr_size(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1)
static struct type * desc_data_target_type(struct type *)
static int ada_same_array_size_p(struct type *t1, struct type *t2)
int ada_prefer_type(struct type *type0, struct type *type1)
static struct type * thin_descriptor_type(struct type *type)
struct value * ada_get_decoded_value(struct value *value)
struct value * ada_coerce_to_simple_array(struct value *arr)
static int ada_is_redundant_index_type_desc(struct type *array_type, struct type *desc_type)
static std::string ada_encode_1(const char *decoded, bool throw_errors)
block_symbol ada_resolve_funcall(struct symbol *sym, const struct block *block, struct type *context_type, bool parse_completion, int nargs, value *argvec[], innermost_block_tracker *tracker)
std::string ada_encode(const char *decoded, bool fold)
static int ada_is_direct_array_type(struct type *)
static int compare_names(const char *string1, const char *string2)
static int ada_is_non_standard_exception_sym(struct symbol *sym)
static int desc_bound_bitsize(struct type *, int, int)
static int is_thin_pntr(struct type *type)
static int discrete_type_p(struct type *)
void create_ada_exception_catchpoint(struct gdbarch *gdbarch, enum ada_exception_catchpoint_kind ex_kind, const std::string &excep_string, const std::string &cond_string, int tempflag, int disabled, int from_tty)
static struct type * desc_index_type(struct type *, int)
static symbol_name_match_type name_match_type_from_name(const char *lookup_name)
static int ada_in_variant(LONGEST val, struct type *type, int field_num)
static const char ada_completer_word_break_characters[]
static int ada_is_interface_tag(struct type *type)
static struct type * ada_find_any_type(const char *name)
static LONGEST recursively_update_array_bitsize(struct type *type)
char * ada_main_name(void)
static struct type * decode_constrained_packed_array_type(struct type *)
static void add_nonlocal_symbols(std::vector< struct block_symbol > &result, const lookup_name_info &lookup_name, domain_enum domain, int global)
static int return_match(struct type *func_type, struct type *context_type)
static struct type * find_parallel_type_by_descriptive_type(struct type *type, const char *name)
static const char * ada_lookup_name(const lookup_name_info &lookup_name)
static struct value * ada_read_renaming_var_value(struct symbol *renaming_sym, const struct block *block)
static void ada_remove_po_subprogram_suffix(const char *encoded, int *len)
static int scalar_type_p(struct type *)
static bool ada_ignore_descriptive_types_p
static struct symbol * ada_find_any_type_symbol(const char *name)
static std::string xget_renaming_scope(struct type *renaming_type)
ULONGEST ada_modulus(struct type *type)
static void append_hex_encoded(std::string &result, uint32_t one_char)
static struct value * ada_promote_array_of_integrals(struct type *type, struct value *val)
static const struct exception_support_info exception_support_info_v0
int ada_is_variant_part(struct type *type, int field_num)
static struct value * ada_value_slice(struct value *array, int low, int high)
static LONGEST ada_array_bound_from_type(struct type *arr_type, int n, int which)
static struct value * value_tag_from_contents_and_address(struct type *type, const gdb_byte *valaddr, CORE_ADDR address)
static struct value * coerce_unspec_val_to_type(struct value *, struct type *)
static bool ada_symbol_name_matches(const char *symbol_search_name, const lookup_name_info &lookup_name, completion_match_result *comp_match_res)
static void lim_warning(const char *format,...) ATTRIBUTE_PRINTF(1
value * ada_abs(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1)
static struct value * unwrap_value(struct value *)
int ada_is_modular_type(struct type *type)
struct value * ada_binop_exp(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
static struct value * ada_index_struct_field_1(int *, struct value *, int, struct type *)
block_symbol ada_find_operator_symbol(enum exp_opcode op, bool parse_completion, int nargs, value *argvec[])
static struct type * to_fixed_range_type(struct type *, struct value *)
static struct type * static_unwrap_type(struct type *type)
struct type * ada_coerce_to_simple_array_type(struct type *type)
bool get_int_var_value(const char *name, LONGEST &value)
static const char ada_utf8[]
value * ada_unop_neg(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1)
static struct type * ada_get_tsd_type(struct inferior *inf)
static struct value * make_array_descriptor(struct type *, struct value *)
static std::string add_angle_brackets(const char *str)
static const char * ada_source_charset
static gdb::unique_xmalloc_ptr< char > ada_exception_message_1(void)
static int ada_resolve_function(std::vector< struct block_symbol > &, struct value **, int, const char *, struct type *, bool)
static const char *const known_runtime_file_name_patterns[]
static int ada_is_redundant_range_encoding(struct type *range_type, struct type *encoding_type)
static int fat_pntr_bounds_bitsize(struct type *)
std::string copy_and_hex_encode(struct obstack *storage)
static void ada_clear_symbol_cache()
static const struct exception_support_info default_exception_support_info
static int ada_has_this_exception_support(const struct exception_support_info *einfo)
static const char *const known_auxiliary_function_name_patterns[]
static void catch_ada_assert_command_split(const char *args, std::string &cond_string)
bool ada_is_access_to_unconstrained_array(struct type *type)
static enum language ada_update_initial_language(enum language lang)
static int warnings_issued
static void catch_ada_exception_command_split(const char *args, bool is_catch_handlers_cmd, enum ada_exception_catchpoint_kind *ex, std::string *excep_string, std::string *cond_string)
static struct value * val_atr(struct type *, LONGEST)
int ada_which_variant_applies(struct type *var_type, struct value *outer)
static struct cmd_list_element * maint_set_ada_cmdlist
static struct cmd_list_element * maint_show_ada_cmdlist
static void ada_add_block_symbols(std::vector< struct block_symbol > &, const struct block *, const lookup_name_info &lookup_name, domain_enum, struct objfile *)
static int is_dynamic_field(struct type *, int)
static struct cache_entry ** find_entry(const char *name, domain_enum domain)
static int lookup_cached_symbol(const char *name, domain_enum domain, struct symbol **sym, const struct block **block)
#define TRUNCATION_TOWARDS_ZERO
static int symbols_are_identical_enums(const std::vector< struct block_symbol > &syms)
static void value_assign_to_component(struct value *container, struct value *component, struct value *val)
static struct value * desc_one_bound(struct value *, int, int)
static struct value * thin_data_pntr(struct value *val)
static LONGEST ada_array_bound(struct value *arr, int n, int which)
static long decode_packed_array_bitsize(struct type *)
static struct value * coerce_for_assign(struct type *type, struct value *val)
static struct cmd_list_element * set_ada_list
static const char * ada_unqualified_name(const char *decoded_name)
static const struct exception_support_info exception_support_info_fallback
static int numeric_type_p(struct type *)
static std::string type_as_string(struct type *type)
static bool ada_is_any_packed_array_type(struct type *type)
static struct value * ada_index_struct_field(int, struct value *, int, struct type *)
static struct type * desc_bounds_type(struct type *)
struct value * ada_value_subscript(struct value *arr, int arity, struct value **ind)
static struct type * type_from_tag(struct value *tag)
bool ada_is_string_type(struct type *type)
CORE_ADDR() ada_unhandled_exception_name_addr_ftype(void)
static void map_matching_symbols(struct objfile *objfile, const lookup_name_info &lookup_name, bool is_wild_match, domain_enum domain, int global, match_data &data)
value * ada_ternop_slice(struct expression *exp, enum noside noside, struct value *array, struct value *low_bound_val, struct value *high_bound_val)
static struct value * ada_value_tag(struct value *val)
static struct value * ada_value_cast(struct type *type, struct value *arg2)
static CORE_ADDR ada_exception_name_addr_1(enum ada_exception_catchpoint_kind ex)
static void catch_ada_exception_command(const char *arg_entry, int from_tty, struct cmd_list_element *command)
static struct type * ada_tag_type(struct value *val)
static void add_defn_to_vec(std::vector< struct block_symbol > &, struct symbol *, const struct block *)
static int ada_resolve_enum(std::vector< struct block_symbol > &syms, const char *name, struct type *context_type, bool parse_completion)
struct value * ada_coerce_to_simple_array_ptr(struct value *arr)
static int ada_identical_enum_types_p(struct type *type1, struct type *type2)
int ada_is_array_descriptor_type(struct type *type)
static int advance_wild_match(const char **, const char *, char)
static void ada_add_exceptions_from_frame(compiled_regex *preg, frame_info_ptr frame, std::vector< ada_exc_info > *exceptions)
static void ada_print_symbol_signature(struct ui_file *stream, struct symbol *sym, const struct type_print_options *flags)
static void catch_ada_completer(struct cmd_list_element *cmd, completion_tracker &tracker, const char *text, const char *word)
static int has_negatives(struct type *type)
static gdb::unique_xmalloc_ptr< char > ada_tag_name_from_tsd(struct value *tsd)
static CORE_ADDR ada_unhandled_exception_name_addr_from_raise(void)
static int fat_pntr_data_bitpos(struct type *)
static int is_unchecked_variant(struct type *var_type, struct type *outer_type)
static void ada_exception_support_info_sniffer(void)
static bool convert_from_hex_encoded(std::string &out, const char *str, int n)
static int ada_is_others_clause(struct type *type, int field_num)
static int is_thick_pntr(struct type *type)
static int integer_type_p(struct type *)
static std::vector< struct block_symbol > ada_lookup_symbol_list_worker(const lookup_name_info &lookup_name, const struct block *block, domain_enum domain, int full_search)
static void create_excep_cond_exprs(struct ada_catchpoint *c, enum ada_exception_catchpoint_kind ex)
static struct type * empty_record(struct type *templ)
static void remove_extra_symbols(std::vector< struct block_symbol > *syms)
static CORE_ADDR cond_offset_target(CORE_ADDR address, long offset)
static int is_valid_name_for_wild_match(const char *name0)
enum ada_renaming_category ada_parse_renaming(struct symbol *sym, const char **renamed_entity, int *len, const char **renaming_expr)
const char * ada_type_name(struct type *type)
static void catch_ada_handlers_command(const char *arg_entry, int from_tty, struct cmd_list_element *command)
static CORE_ADDR ada_unhandled_exception_name_addr(void)
void ada_lookup_encoded_symbol(const char *name, const struct block *block, domain_enum domain, struct block_symbol *info)
static void ada_unpack_from_contents(const gdb_byte *src, int bit_offset, int bit_size, gdb_byte *unpacked, int unpacked_len, int is_big_endian, int is_signed_type, int is_scalar)
static bool do_full_match(const char *symbol_search_name, const lookup_name_info &lookup_name, completion_match_result *comp_match_res)
void ada_find_printable_frame(frame_info_ptr fi)
static bool name_matches_regex(const char *name, compiled_regex *preg)
static int desc_bound_bitpos(struct type *, int, int)
static bool do_wild_match(const char *symbol_search_name, const lookup_name_info &lookup_name, completion_match_result *comp_match_res)
static int is_lower_alphanum(const char c)
static int ada_is_exception_sym(struct symbol *sym)
struct type * ada_find_parallel_type(struct type *type, const char *suffix)
static struct type * to_record_with_fixed_variant_part(struct type *type, const gdb_byte *valaddr, CORE_ADDR address, struct value *dval0)
static bool convert_hex(const char *str, int n, uint32_t *out)
struct type * ada_get_base_type(struct type *raw_type)
static struct value * desc_data(struct value *)
static symbol_name_matcher_ftype * ada_get_symbol_name_matcher(const lookup_name_info &lookup_name)
static void remove_irrelevant_renamings(std::vector< struct block_symbol > *syms, const struct block *current_block)
static const char * ada_decoded_op_name(enum exp_opcode)
value * ada_binop_in_bounds(struct expression *exp, enum noside noside, struct value *arg1, struct value *arg2, int n)
static struct type * to_fixed_record_type(struct type *type0, const gdb_byte *valaddr, CORE_ADDR address, struct value *dval)
value * ada_equal_binop(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
static int ada_is_dispatch_table_ptr_type(struct type *type)
std::vector< ada_exc_info > ada_exceptions_list(const char *regexp)
static struct value * decode_constrained_packed_array(struct value *)
static LONGEST ada_array_length(struct value *arr, int n)
static struct type * ada_find_parallel_type_with_name(struct type *, const char *)
static ada_language ada_language_defn
static struct value * ada_value_binop(struct value *arg1, struct value *arg2, enum exp_opcode op)
static struct type * dynamic_template_type(struct type *type)
static int get_selections(int *choices, int n_choices, int max_results, int is_all_choice, const char *annotation_suffix)
static struct type * ada_type_of_array(struct value *arr, int bounds)
static LONGEST max_of_size(int size)
static void add_component_interval(LONGEST, LONGEST, std::vector< LONGEST > &)
static void ada_new_objfile_observer(struct objfile *objfile)
bool ada_is_character_type(struct type *type)
static void sort_remove_dups_ada_exceptions_list(std::vector< ada_exc_info > *exceptions, int skip)
struct type * ada_parent_type(struct type *type)
int ada_is_simple_array_type(struct type *type)
static LONGEST min_of_size(int size)
int ada_is_system_address_type(struct type *type)
static struct type * to_static_fixed_type(struct type *)
LONGEST ada_discrete_type_high_bound(struct type *type)
static void ada_inferior_exit(struct inferior *inf)
int ada_is_parent_field(struct type *type, int field_num)
static LONGEST pos_atr(struct value *)
struct type * ada_get_decoded_type(struct type *type)
int ada_is_constrained_packed_array_type(struct type *type)
value * ada_mult_binop(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
static struct value * get_var_value(const char *name, const char *err_msg)
static int num_visible_fields(struct type *type)
int ada_name_prefix_len(const char *name)
static struct type * desc_base_type(struct type *)
static const char * ada_exception_sym_name(enum ada_exception_catchpoint_kind ex)
static int ada_is_unconstrained_packed_array_type(struct type *)
std::vector< struct block_symbol > ada_lookup_symbol_list(const char *name, const struct block *block, domain_enum domain)
struct type * ada_aligned_type(struct type *type)
struct value * ada_tag_value_at_base_address(struct value *obj)
static int ada_value_equal(struct value *arg1, struct value *arg2)
static bool ada_is_renaming_symbol(struct symbol *name_sym)
struct type * ada_check_typedef(struct type *type)
struct value * ada_convert_actual(struct value *actual, struct type *formal_type0)
static struct value * ada_value_slice_from_ptr(struct value *array_ptr, struct type *type, int low, int high)
static struct cmd_list_element * show_ada_list
int ada_is_range_type_name(const char *name)
block_symbol ada_resolve_variable(struct symbol *sym, const struct block *block, struct type *context_type, bool parse_completion, int deprocedure_p, innermost_block_tracker *tracker)
int ada_is_wrapper_field(struct type *type, int field_num)
static struct type * constrained_packed_array_type(struct type *, long *)
static void info_exceptions_command(const char *regexp, int from_tty)
static struct value * ada_get_tsd_from_tag(struct value *tag)
static struct ada_symbol_cache * ada_get_symbol_cache(struct program_space *pspace)
static unsigned int field_alignment(struct type *type, int f)
static const char * ada_attribute_name(enum exp_opcode n)
int ada_is_tagged_type(struct type *type, int refok)
static struct value * value_subscript_packed(struct value *, int, struct value **)
struct block_symbol ada_lookup_symbol(const char *name, const struct block *block0, domain_enum domain)
struct value * ada_val_atr(enum noside noside, struct type *type, struct value *arg)
static struct value * ada_value_ptr_subscript(struct value *arr, int arity, struct value **ind)
static int fat_pntr_data_bitsize(struct type *)
value * ada_atr_tag(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1)
static const char *const standard_exc[]
struct type * ada_to_fixed_type(struct type *type, const gdb_byte *valaddr, CORE_ADDR address, struct value *dval, int check_tag)
static struct htab * decoded_names_store
static struct ada_inferior_data * get_ada_inferior_data(struct inferior *inf)
static void ada_add_standard_exceptions(compiled_regex *preg, std::vector< ada_exc_info > *exceptions)
static int ada_type_match(struct type *ftype, struct type *atype)
struct type * ada_template_to_fixed_record_type_1(struct type *type, const gdb_byte *valaddr, CORE_ADDR address, struct value *dval0, int keep_dynamic_fields)
const char * ada_decode_symbol(const struct general_symbol_info *arg)
static int equiv_types(struct type *, struct type *)
int ada_is_tag_type(struct type *type)
static bool should_stop_exception(const struct bp_location *bl)
static int is_name_suffix(const char *)
static gdb::unique_xmalloc_ptr< char > ada_exception_message(void)
int ada_is_aligner_type(struct type *type)
static void catch_assert_command(const char *arg_entry, int from_tty, struct cmd_list_element *command)
static struct symtab_and_line ada_exception_sal(enum ada_exception_catchpoint_kind ex, std::string *addr_string)
static bool literal_symbol_name_matcher(const char *symbol_search_name, const lookup_name_info &lookup_name, completion_match_result *comp_match_res)
static ULONGEST umax_of_size(int size)
static struct type * ada_to_fixed_type_1(struct type *type, const gdb_byte *valaddr, CORE_ADDR address, struct value *dval, int check_tag)
int ada_scan_number(const char str[], int k, LONGEST *R, int *new_k)
static struct value * ada_value_struct_elt(struct value *arg, const char *name, int no_err)
static const utf8_entry * find_case_fold_entry(uint32_t c)
static struct value * ada_to_fixed_value_create(struct type *type0, CORE_ADDR address, struct value *val0)
int ada_get_field_index(const struct type *type, const char *field_name, int maybe_missing)
const struct ada_opname_map ada_opname_table[]
static int desc_arity(struct type *)
static struct type * template_to_fixed_record_type(struct type *type, const gdb_byte *valaddr, CORE_ADDR address, struct value *dval0)
struct value * ada_value_ind(struct value *val0)
LONGEST ada_discrete_type_low_bound(struct type *type)
const char * ada_enum_name(const char *name)
static int variant_field_index(struct type *type)
static int fat_pntr_bounds_bitpos(struct type *)
int ada_is_bogus_array_descriptor(struct type *type)
struct value * ada_value_primitive_field(struct value *arg1, int offset, int fieldno, struct type *arg_type)
static struct symbol * standard_lookup(const char *, const struct block *, domain_enum)
void ada_fixup_array_indexes_type(struct type *index_desc_type)
static void cache_symbol(const char *name, domain_enum domain, struct symbol *sym, const struct block *block)
int ada_is_ignored_field(struct type *type, int field_num)
static LONGEST max_of_type(struct type *t)
static int possible_user_operator_p(enum exp_opcode, struct value **)
static int is_known_support_routine(frame_info_ptr frame)
static const gdb_byte * cond_offset_host(const gdb_byte *valaddr, long offset)
static int user_select_syms(struct block_symbol *syms, int nsyms, int max_results)
static int ada_add_block_renamings(std::vector< struct block_symbol > &result, const struct block *block, const lookup_name_info &lookup_name, domain_enum domain)
static void ada_add_local_symbols(std::vector< struct block_symbol > &result, const lookup_name_info &lookup_name, const struct block *block, domain_enum domain)
static int find_struct_field(const char *, struct type *, int, struct type **, int *, int *, int *, int *)
static std::vector< ada_exc_info > ada_exceptions_list_1(compiled_regex *preg)
static int ada_args_match(struct symbol *, struct value **, int)
static struct value * ada_search_struct_field(const char *, struct value *, int, struct type *)
static bool wild_match(const char *name, const char *patn)
static int is_nondebugging_type(struct type *type)
static LONGEST min_of_type(struct type *t)
static void ada_remove_trailing_digits(const char *encoded, int *len)
int ada_array_arity(struct type *type)
static int compare_names_with_case(const char *string1, const char *string2, enum case_sensitivity casing)
gdb::unique_xmalloc_ptr< char > ada_tag_name(struct value *tag)
static int is_nonfunction(const std::vector< struct block_symbol > &)
static void sort_choices(struct block_symbol syms[], int nsyms)
struct type * ada_variant_discrim_type(struct type *var_type, struct type *outer_type)
static bool print_signatures
static struct type * get_base_type(struct type *type)
static int ada_is_array_type(struct type *type)
struct value * ada_binop_minmax(struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2)
static CORE_ADDR ada_exception_name_addr(enum ada_exception_catchpoint_kind ex)
const char * ada_variant_discrim_name(struct type *type0)
static const registry< program_space >::key< ada_pspace_data > ada_pspace_data_handle
static struct type * to_fixed_variant_branch_type(struct type *, const gdb_byte *, CORE_ADDR, struct value *)
static int old_renaming_is_invisible(const struct symbol *sym, const char *function_name)
static bool is_compiler_suffix(const char *str)
void _initialize_ada_language()
static const char * ada_fold_name(gdb::string_view name, bool throw_on_error=false)
static const char ADA_MAIN_PROGRAM_SYMBOL_NAME[]
struct value * ada_to_fixed_value(struct value *val)
static int is_suffix(const char *str, const char *suffix)
static int encoded_ordered_before(const char *N0, const char *N1)
static struct value * empty_array(struct type *arr_type, int low, int high)
static int field_name_match(const char *field_name, const char *target)
static int is_package_name(const char *name)
static int scan_discrim_bound(const char *str, int k, struct value *dval, LONGEST *px, int *pnew_k)
static bool do_exact_match(const char *symbol_search_name, const lookup_name_info &lookup_name, completion_match_result *comp_match_res)
static int is_ada95_tag(struct value *tag)
#define ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS
void ada_value_print(struct value *, struct ui_file *, const struct value_print_options *)
void ada_print_type(struct type *, const char *, struct ui_file *, int, int, const struct type_print_options *)
void ada_printchar(int, struct type *, struct ui_file *)
void ada_emit_char(int, struct type *, struct ui_file *, int, int)
void ada_print_typedef(struct type *type, struct symbol *new_symbol, struct ui_file *stream)
@ ADA_SUBPROGRAM_RENAMING
void ada_value_print_inner(struct value *, struct ui_file *, int, const struct value_print_options *)
void ada_printstr(struct ui_file *, struct type *, const gdb_byte *, unsigned int, const char *, int, const struct value_print_options *)
#define ADA_KNOWN_AUXILIARY_FUNCTION_NAME_PATTERNS
ada_exception_catchpoint_kind
@ ada_catch_exception_unhandled
const struct lang_varobj_ops ada_varobj_ops
void * xcalloc(size_t number, size_t size)
void annotate_field(int num)
void annotate_catchpoint(int num)
struct gdbarch * get_current_arch(void)
struct gdbarch * target_gdbarch(void)
struct symbol * block_iter_match_next(const lookup_name_info &name, struct block_iterator *iterator)
struct using_direct * block_using(const struct block *block)
struct gdbarch * block_gdbarch(const struct block *block)
const struct block * block_for_pc(CORE_ADDR pc)
const struct block * block_static_block(const struct block *block)
struct symbol * block_iter_match_first(const struct block *block, const lookup_name_info &name, struct block_iterator *iterator)
struct symbol * block_linkage_function(const struct block *bl)
#define ALL_BLOCK_SYMBOLS(block, iter, sym)
const struct block * get_frame_block(frame_info_ptr frame, CORE_ADDR *addr_in_block)
void add_catch_command(const char *name, const char *docstring, cmd_func_ftype *func, completer_ftype *completer, void *user_data_catch, void *user_data_tcatch)
const char * bpdisp_text(enum bpdisp disp)
void print_num_locno(const bpstat *bs, struct ui_out *uiout)
void set_breakpoint_condition(struct breakpoint *b, const char *exp, int from_tty, bool force)
struct gdbarch * get_sal_arch(struct symtab_and_line sal)
void install_breakpoint(int internal, std::unique_ptr< breakpoint > &&arg, int update_gll)
void describe_other_breakpoints(struct gdbarch *gdbarch, struct program_space *pspace, CORE_ADDR pc, struct obj_section *section, int thread)
@ bp_loc_software_breakpoint
const char * host_charset(void)
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)
expression_up excep_cond_expr
ada_catchpoint_location(ada_catchpoint *owner)
void printstr(struct ui_file *stream, struct type *elttype, const gdb_byte *string, unsigned int length, const char *encoding, int force_ellipses, const struct value_print_options *options) const override
void print_array_index(struct type *index_type, LONGEST index, struct ui_file *stream, const value_print_options *options) const override
bool c_style_arrays_p() const override
void emitchar(int ch, struct type *chtype, struct ui_file *stream, int quoter) const override
const char * struct_too_deep_ellipsis() const override
bool symbol_printing_suppressed(struct symbol *symbol) const override
const char * word_break_characters(void) const override
gdb::unique_xmalloc_ptr< char > demangle_symbol(const char *mangled, int options) const override
bool store_sym_names_in_linkage_form_p() const override
bool is_string_type_p(struct type *type) const override
struct value * read_var_value(struct symbol *var, const struct block *var_block, frame_info_ptr frame) const override
int parser(struct parser_state *ps) const override
symbol_name_matcher_ftype * get_symbol_name_matcher_inner(const lookup_name_info &lookup_name) const override
const char * name() const override
const std::vector< const char * > & filename_extensions() const override
void print_typedef(struct type *type, struct symbol *new_symbol, struct ui_file *stream) const override
void language_arch_info(struct gdbarch *gdbarch, struct language_arch_info *lai) const override
void value_print(struct value *val, struct ui_file *stream, const struct value_print_options *options) const override
void value_print_inner(struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options) const override
gdb::unique_xmalloc_ptr< char > watch_location_expression(struct type *type, CORE_ADDR addr) const override
bool iterate_over_symbols(const struct block *block, const lookup_name_info &name, domain_enum domain, gdb::function_view< symbol_found_callback_ftype > callback) const override
void printchar(int ch, struct type *chtype, struct ui_file *stream) const override
const struct lang_varobj_ops * varobj_ops() const override
bool sniff_from_mangled_name(const char *mangled, gdb::unique_xmalloc_ptr< char > *out) const override
void collect_symbol_completion_matches(completion_tracker &tracker, complete_symbol_mode mode, symbol_name_match_type name_match_type, const char *text, const char *word, enum type_code code) const override
const char * natural_name() const override
void print_type(struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags) const override
struct block_symbol lookup_symbol_nonlocal(const char *name, const struct block *block, const domain_enum domain) const override
bool matches(const char *symbol_search_name, symbol_name_match_type match_type, completion_match_result *comp_match_res) const
const std::string & lookup_name() const
bool wild_match_p() const
ada_lookup_name_info(const lookup_name_info &lookup_name)
std::string m_encoded_name
ui_file_style style() const
void add_completion(gdb::unique_xmalloc_ptr< char > name, completion_match_for_lcd *match_for_lcd=NULL, const char *text=NULL, const char *word=NULL)
std::vector< ada_component_up > m_components
bool uses_objfile(struct objfile *objfile) override
void assign(struct value *container, struct value *lhs, struct expression *exp, std::vector< LONGEST > &indices, LONGEST low, LONGEST high) override
void dump(ui_file *stream, int depth) override
value * assign_aggregate(struct value *container, struct value *lhs, struct expression *exp)
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
operation_up replace(operation_up &&owner, struct expression *exp, bool deprocedure_p, bool parse_completion, innermost_block_tracker *tracker, struct type *context_type) override
void dump(ui_file *stream, int depth) override
std::vector< ada_association_up > m_assocs
void assign(struct value *container, struct value *lhs, struct expression *exp, std::vector< LONGEST > &indices, LONGEST low, LONGEST high) override
bool uses_objfile(struct objfile *objfile) override
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
bool uses_objfile(struct objfile *objfile) override
void assign(struct value *container, struct value *lhs, struct expression *exp, std::vector< LONGEST > &indices, LONGEST low, LONGEST high, operation_up &op) override
void dump(ui_file *stream, int depth) override
bool resolve(struct expression *exp, bool deprocedure_p, bool parse_completion, innermost_block_tracker *tracker, struct type *context_type) override
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
void dump(ui_file *stream, int depth) override
void assign(struct value *container, struct value *lhs, struct expression *exp, std::vector< LONGEST > &indices, LONGEST low, LONGEST high, operation_up &op) override
bool uses_objfile(struct objfile *objfile) override
bool uses_objfile(struct objfile *objfile) override
void assign(struct value *container, struct value *lhs, struct expression *exp, std::vector< LONGEST > &indices, LONGEST low, LONGEST high) override
void dump(ui_file *stream, int depth) override
void assign(struct value *container, struct value *lhs, struct expression *exp, std::vector< LONGEST > &indices, LONGEST low, LONGEST high) override
bool uses_objfile(struct objfile *objfile) override
void dump(ui_file *stream, int depth) override
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
const char * get_name() const
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
bool resolve(struct expression *exp, bool deprocedure_p, bool parse_completion, innermost_block_tracker *tracker, struct type *context_type) override
enum exp_opcode opcode() const override
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
value * evaluate_for_cast(struct type *expect_type, struct expression *exp, enum noside noside) override
bool resolve(struct expression *exp, bool deprocedure_p, bool parse_completion, innermost_block_tracker *tracker, struct type *context_type) override
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
const block * get_block() const
value * evaluate_for_cast(struct type *expect_type, struct expression *exp, enum noside noside) override
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
enum exp_opcode opcode() const override
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
std::tuple< Arg... > m_storage
symbol * get_symbol() const
value * evaluate(struct type *expect_type, struct expression *exp, enum noside noside) override
void update(const struct block *b, innermost_block_tracker_types t)
static const lookup_name_info & match_any()
const ada_lookup_name_info & ada() const
symbol_name_match_type match_type() const
gdb::string_view name() const
bool completion_mode() const
void field_string(const char *fldname, const char *string, const ui_file_style &style=ui_file_style())
void field_fmt(const char *fldname, const char *format,...) ATTRIBUTE_PRINTF(3
void field_signed(const char *fldname, LONGEST value)
void field_skip(const char *fldname)
void text(const char *string)
bool is_mi_like_p() const
struct cmd_list_element * showlist
void error_no_arg(const char *why)
struct cmd_list_element * setlist
struct cmd_list_element * maintenance_show_cmdlist
struct cmd_list_element * maintenance_set_cmdlist
set_show_commands add_setshow_enum_cmd(const char *name, enum command_class theclass, const char *const *enumlist, const char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
set_show_commands add_setshow_prefix_cmd(const char *name, command_class theclass, const char *set_doc, const char *show_doc, cmd_list_element **set_subcommands_list, cmd_list_element **show_subcommands_list, cmd_list_element **set_list, cmd_list_element **show_list)
set_show_commands add_setshow_boolean_cmd(const char *name, enum command_class theclass, bool *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
struct cmd_list_element * add_info(const char *name, cmd_simple_func_ftype *fun, const char *doc)
cli_style_option file_name_style
cli_style_option metadata_style
std::string extract_arg(const char **arg)
void write_memory(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
void read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
void write_memory_with_notification(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
static struct symbol * new_symbol(struct ctf_context *cp, struct type *type, ctf_id_t tid)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
EXTERN_C char * re_comp(const char *)
int longest_to_int(LONGEST)
const char * command_line_input(std::string &cmd_line_buffer, const char *, const char *)
static ULONGEST extract_unsigned_integer(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order)
value * evaluate_var_value(enum noside noside, const block *blk, symbol *var)
value * evaluate_var_msym_value(enum noside noside, struct objfile *objfile, minimal_symbol *msymbol)
void binop_promote(const struct language_defn *language, struct gdbarch *gdbarch, struct value **arg1, struct value **arg2)
struct value * evaluate_expression(struct expression *exp, struct type *expect_type)
void unop_promote(const struct language_defn *language, struct gdbarch *gdbarch, struct value **arg1)
CORE_ADDR parse_and_eval_address(const char *exp)
struct value * parse_and_eval(const char *exp)
void exception_fprintf(struct ui_file *file, const struct gdb_exception &e, const char *prefix,...)
std::unique_ptr< expression > expression_up
expression_up parse_exp_1(const char **, CORE_ADDR pc, const struct block *, int, innermost_block_tracker *=nullptr)
@ EVAL_AVOID_SIDE_EFFECTS
void select_frame(frame_info_ptr fi)
frame_info_ptr get_selected_frame(const char *message)
frame_info_ptr get_current_frame(void)
frame_info_ptr get_prev_frame(frame_info_ptr this_frame)
symtab_and_line find_frame_sal(frame_info_ptr frame)
const struct block * get_selected_block(CORE_ADDR *addr_in_block)
static void ATTRIBUTE_PRINTF(1, 0)
void gdbarch_iterate_over_objfiles_in_search_order(struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb, struct objfile *current_objfile)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
int gdbarch_long_long_bit(struct gdbarch *gdbarch)
int gdbarch_short_bit(struct gdbarch *gdbarch)
int gdbarch_int_bit(struct gdbarch *gdbarch)
int gdbarch_float_bit(struct gdbarch *gdbarch)
const struct floatformat ** gdbarch_double_format(struct gdbarch *gdbarch)
void gdbarch_address_to_pointer(struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr)
int gdbarch_long_double_bit(struct gdbarch *gdbarch)
const struct floatformat ** gdbarch_float_format(struct gdbarch *gdbarch)
const struct floatformat ** gdbarch_long_double_format(struct gdbarch *gdbarch)
int gdbarch_long_bit(struct gdbarch *gdbarch)
int gdbarch_double_bit(struct gdbarch *gdbarch)
struct type * resolve_dynamic_type(struct type *type, gdb::array_view< const gdb_byte > valaddr, CORE_ADDR addr)
enum bfd_endian type_byte_order(const struct type *type)
struct type * lookup_pointer_type(struct type *type)
int is_integral_type(struct type *t)
struct type * lookup_struct_elt_type(struct type *type, const char *name, int noerr)
struct type * create_array_type_with_stride(struct type *result_type, struct type *element_type, struct type *range_type, struct dynamic_prop *byte_stride_prop, unsigned int bit_stride)
int is_scalar_type(struct type *type)
int is_dynamic_type(struct type *type)
struct type * lookup_array_range_type(struct type *element_type, LONGEST low_bound, LONGEST high_bound)
bool get_discrete_bounds(struct type *type, LONGEST *lowp, LONGEST *highp)
struct type * arch_type(struct gdbarch *gdbarch, enum type_code code, int bit, const char *name)
struct type * create_array_type(struct type *result_type, struct type *element_type, struct type *range_type)
struct type * arch_float_type(struct gdbarch *gdbarch, int bit, const char *name, const struct floatformat **floatformats)
struct type * arch_character_type(struct gdbarch *gdbarch, int bit, int unsigned_p, const char *name)
gdb::optional< LONGEST > discrete_position(struct type *type, LONGEST val)
bool get_array_bounds(struct type *type, LONGEST *low_bound, LONGEST *high_bound)
struct type * alloc_type_copy(const struct type *type)
struct type * create_static_range_type(struct type *result_type, struct type *index_type, LONGEST low_bound, LONGEST high_bound)
struct type * arch_integer_type(struct gdbarch *gdbarch, int bit, int unsigned_p, const char *name)
struct type * copy_type(const struct type *type)
struct type * check_typedef(struct type *type)
#define TYPE_ZALLOC(t, size)
#define TYPE_DESCRIPTIVE_TYPE(thistype)
#define INIT_NONE_SPECIFIC(type)
#define TYPE_MAIN_TYPE(thistype)
#define TYPE_FIELD_BITSIZE(thistype, n)
#define TYPE_ALLOC(t, size)
#define HAVE_GNAT_AUX_INFO(type)
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
void error_call_unknown_return_type(const char *func_name)
struct value * call_function_by_hand(struct value *function, type *default_return_type, gdb::array_view< value * > args)
struct inferior * current_inferior(void)
const struct language_defn * language_def(enum language lang)
struct type * language_lookup_primitive_type(const struct language_defn *la, struct gdbarch *gdbarch, const char *name)
struct type * language_bool_type(const struct language_defn *la, struct gdbarch *gdbarch)
struct type * language_string_char_type(const struct language_defn *la, struct gdbarch *gdbarch)
struct symbol * language_lookup_primitive_type_as_symbol(const struct language_defn *la, struct gdbarch *gdbarch, const char *name)
location_spec_up string_to_location_spec(const char **stringp, const struct language_defn *language, symbol_name_match_type match_type)
#define R(name, type, sim_num)
static struct type * new_type(char *)
const char * async_reason_lookup(enum async_reply_reason reason)
@ EXEC_ASYNC_BREAKPOINT_HIT
struct bound_minimal_symbol lookup_minimal_symbol(const char *name, const char *sfile, struct objfile *objf)
unsigned int msymbol_hash(const char *string)
static LONGEST convert_char_literal(struct type *type, LONGEST val)
static void assign_component(struct value *container, struct value *lhs, LONGEST index, struct expression *exp, operation_up &arg)
std::unique_ptr< operation > operation_up
bool check_objfile(const std::unique_ptr< ada_component > &comp, struct objfile *objfile)
observable< struct inferior * > inferior_exit
observable< struct objfile * > free_objfile
observable< struct objfile * > new_objfile
const char * objfile_name(const struct objfile *objfile)
struct program_space * current_program_space
static gdbpy_ref field_name(struct type *type, int field)
void(* func)(remote_target *remote, char *)
const char * symtab_to_fullname(struct symtab *s)
const char * symtab_to_filename_for_display(struct symtab *symtab)
gdb::unique_xmalloc_ptr< char > find_frame_funname(frame_info_ptr frame, enum language *funlang, struct symbol **funcp)
enum ada_exception_catchpoint_kind m_kind
void print_recreate(struct ui_file *fp) const override
struct bp_location * allocate_location() override
void print_mention() const override
void check_status(struct bpstat *bs) override
ada_catchpoint(struct gdbarch *gdbarch_, enum ada_exception_catchpoint_kind kind, struct symtab_and_line sal, const char *addr_string_, bool tempflag, bool enabled, bool from_tty)
enum print_stop_action print_it(const bpstat *bs) const override
bool print_one(bp_location **) const override
bool operator<(const ada_exc_info &) const
bool operator==(const ada_exc_info &) const
const struct exception_support_info * exception_info
std::unique_ptr< ada_symbol_cache > sym_cache
struct cache_entry * root[HASH_SIZE]
struct auto_obstack cache_space
const struct block * block
const block * superblock() const
symbol * function() const
struct block * block(size_t i)
struct block * static_block()
struct block * global_block()
CORE_ADDR value_address() const
struct minimal_symbol * minsym
bp_location_ref_ptr bp_location_at
bp_location_range locations() const
void print_recreate_thread(struct ui_file *fp) const
struct type * builtin_bool
struct type * builtin_int
struct type * builtin_void
struct cache_entry * next
const struct block * block
bp_location * add_location(const symtab_and_line &sal)
void set_match(const char *m, const char *m_for_lcd=NULL)
struct blockvector * blockvector()
struct objfile * objfile() const
LONGEST const_val() const
dynamic_prop_kind kind() const
ada_unhandled_exception_name_addr_ftype * unhandled_exception_name_addr
const char * catch_handlers_sym
const char * catch_assert_sym
const char * catch_exception_unhandled_sym
const char * catch_exception_sym
virtual operation_up replace(operation_up &&owner, struct expression *exp, bool deprocedure_p, bool parse_completion, innermost_block_tracker *tracker, struct type *context_type)
const struct language_defn * language_defn
void set_type(struct type *type)
void set_loc_bitpos(LONGEST bitpos)
LONGEST loc_bitpos() const
LONGEST loc_enumval() const
void set_name(const char *name)
const char * name() const
struct type * type() const
const char * natural_name() const
const char * demangled_name
union general_symbol_info::@178 language_specific
const char * print_name() const
enum language language() const
const struct block * block
const char * linkage_name() const
void set_string_char_type(struct type *type)
void add_primitive_type(struct type *type)
void set_bool_type(struct type *type, const char *name=nullptr)
virtual struct value * read_var_value(struct symbol *var, const struct block *var_block, frame_info_ptr frame) const
match_data(std::vector< struct block_symbol > *rp)
bool operator()(struct block_symbol *bsym)
DISABLE_COPY_AND_ASSIGN(match_data)
std::vector< struct block_symbol > * resultp
minimal_symbol_type type() const
struct gdbarch * arch() const
compunit_symtab_range compunits()
void expand_matching_symbols(const lookup_name_info &name, domain_enum domain, int global, symbol_compare_ftype *ordered_compare)
msymbols_range msymbols()
objfiles_range objfiles()
address_class aclass() const
struct type * type() const
domain_enum domain() const
LONGEST value_longest() const
bool is_objfile_owned() const
CORE_ADDR value_address() const
bool is_artificial() const
unsigned short line() const
struct obj_section * section
struct program_space * pspace
struct compunit_symtab * compunit() const
struct type * target_type() const
dynamic_prop * dyn_prop(dynamic_prop_node_kind kind) const
void set_code(type_code code)
bool is_fixed_instance() const
struct field & field(int idx) const
void set_target_type(struct type *target_type)
void set_is_stub(bool is_stub)
void set_num_fields(int num_fields)
void set_name(const char *name)
void set_length(ULONGEST length)
struct field * fields() const
range_bounds * bounds() const
void set_is_fixed_instance(bool is_fixed_instance)
const char * name() const
type * index_type() const
unsigned short bit_offset() const
void set_fields(struct field *fields)
unsigned short bit_size() const
const ui_file_style * ptr() const
struct using_direct * next
bool operator<(uint32_t val) const
bool expand_symtabs_matching(gdb::function_view< expand_symtabs_file_matcher_ftype > file_matcher, const lookup_name_info &lookup_name, gdb::function_view< expand_symtabs_symbol_matcher_ftype > symbol_matcher, gdb::function_view< expand_symtabs_exp_notify_ftype > expansion_notify, block_search_flags search_flags, enum search_domain kind)
const char multiple_symbols_all[]
const char multiple_symbols_cancel[]
bool iterate_over_symbols_terminated(const struct block *block, const lookup_name_info &name, const domain_enum domain, gdb::function_view< symbol_found_callback_ftype > callback)
symtab_and_line find_function_start_sal(CORE_ADDR func_addr, obj_section *section, bool funfirstline)
struct symbol * fixup_symbol_section(struct symbol *sym, struct objfile *objfile)
const char * multiple_symbols_select_mode(void)
bool completion_list_add_name(completion_tracker &tracker, language symbol_language, const char *symname, const lookup_name_info &lookup_name, const char *text, const char *word)
bool symbol_matches_domain(enum language symbol_language, domain_enum symbol_domain, domain_enum domain)
bool() symbol_name_matcher_ftype(const char *symbol_search_name, const lookup_name_info &lookup_name, completion_match_result *comp_match_res)
static bool completion_skip_symbol(complete_symbol_mode mode, Symbol *sym)
symtab_and_line find_function_start_sal(symbol *sym, bool funfirstline)
int target_read_string(CORE_ADDR addr, int len, int width, unsigned int fetchlimit, gdb::unique_xmalloc_ptr< gdb_byte > *buffer, int *bytes_read)
const struct type_print_options type_print_raw_options
std::string type_to_string(struct type *type)
void type_print(struct type *type, const char *varstring, struct ui_file *stream, int show)
static styled_string_s * styled_string(const ui_file_style &style, const char *str, styled_string_s &&tmp={})
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
int strcmp_iw_ordered(const char *string1, const char *string2)
void copy_bitwise(gdb_byte *dest, ULONGEST dest_offset, const gdb_byte *source, ULONGEST source_offset, ULONGEST nbits, int bits_big_endian)
void gdb_printf(struct ui_file *stream, const char *format,...)
void vwarning(const char *string, va_list args)
struct value * value_subscript(struct value *array, LONGEST index)
struct value * value_neg(struct value *arg1)
int value_equal(struct value *arg1, struct value *arg2)
int value_less(struct value *arg1, struct value *arg2)
struct value * value_concat(struct value *arg1, struct value *arg2)
struct value * value_ptradd(struct value *arg1, LONGEST arg2)
struct value * value_binop(struct value *arg1, struct value *arg2, enum exp_opcode op)
struct value * value_cast_pointers(struct type *type, struct value *arg2, int subclass_check)
struct value * value_at(struct type *type, CORE_ADDR addr)
struct value * value_slice(struct value *array, int lowbound, int length)
struct value * value_allocate_space_in_inferior(int len)
struct value * value_at_lazy(struct type *type, CORE_ADDR addr)
struct value * value_struct_elt(struct value **argp, gdb::optional< gdb::array_view< value * > > args, const char *name, int *static_memfuncp, const char *err)
struct value * value_of_variable(struct symbol *var, const struct block *b)
struct value * value_addr(struct value *arg1)
struct value * value_cast(struct type *type, struct value *arg2)
struct value * value_assign(struct value *toval, struct value *fromval)
struct value * value_ind(struct value *arg1)
struct value * value_ref(struct value *arg1, enum type_code refcode)
void get_user_print_options(struct value_print_options *opts)
struct value * call_internal_function(struct gdbarch *gdbarch, const struct language_defn *language, struct value *func, int argc, struct value **argv)
struct type * value_type(const struct value *value)
struct value * value_zero(struct type *type, enum lval_type lv)
struct value * allocate_value_lazy(struct type *type)
gdb::array_view< const gdb_byte > value_contents_all(struct value *value)
LONGEST value_bitsize(const struct value *value)
int value_lazy(const struct value *value)
void clear_internalvar(struct internalvar *var)
void value_contents_copy(struct value *dst, LONGEST dst_offset, struct value *src, LONGEST src_offset, LONGEST length)
struct value * allocate_value(struct type *type)
CORE_ADDR value_as_address(struct value *val)
void set_value_address(struct value *value, CORE_ADDR addr)
void set_value_component_location(struct value *component, const struct value *whole)
void value_fetch_lazy(struct value *val)
struct value * value_primitive_field(struct value *arg1, LONGEST offset, int fieldno, struct type *arg_type)
void set_value_offset(struct value *value, LONGEST offset)
struct value * allocate_optimized_out_value(struct type *type)
struct value * value_from_contents_and_address_unresolved(struct type *type, const gdb_byte *valaddr, CORE_ADDR address)
void set_value_parent(struct value *value, struct value *parent)
CORE_ADDR value_address(const struct value *value)
void set_value_bitsize(struct value *value, LONGEST bit)
struct value * value_from_longest(struct type *type, LONGEST num)
gdb::array_view< gdb_byte > value_contents_raw(struct value *value)
struct value * coerce_ref(struct value *arg)
struct value * value_from_contents(struct type *type, const gdb_byte *contents)
void set_internalvar(struct internalvar *var, struct value *val)
gdb::array_view< const gdb_byte > value_contents(struct value *value)
gdb::array_view< gdb_byte > value_contents_writeable(struct value *value)
struct internalvar * lookup_internalvar(const char *name)
LONGEST value_as_long(struct value *val)
void modify_field(struct type *type, gdb_byte *addr, LONGEST fieldval, LONGEST bitpos, LONGEST bitsize)
void set_value_bitpos(struct value *value, LONGEST bit)
struct value * value_copy(const value *arg)
int value_optimized_out(struct value *value)
gdb::array_view< const gdb_byte > value_contents_for_printing(struct value *value)
struct type * value_enclosing_type(const struct value *value)
int deprecated_value_modifiable(const struct value *value)
void deprecated_set_value_type(struct value *value, struct type *type)
struct value * value_from_contents_and_address(struct type *type, const gdb_byte *valaddr, CORE_ADDR address)
LONGEST value_bitpos(const struct value *value)
static bool value_true(struct value *val)