48#include "gdbsupport/selftest.h"
49#include "gdbsupport/array-view.h"
75 LONGEST offset2, ULONGEST len2)
79 l = std::max (
offset1, offset2);
80 h = std::min (
offset1 + len1, offset2 + len2);
128 auto i = std::lower_bound (ranges.begin (), ranges.end (), what);
130 if (i > ranges.begin ())
132 const struct range &bef = *(i - 1);
138 if (i < ranges.end ())
140 const struct range &r = *i;
182 && (offset < 0 || offset + length > val_len))
189 ULONGEST sign = (1ULL << (
sizeof (ULONGEST) * 8 - 1)) / TARGET_CHAR_BIT;
190 ULONGEST mask = (sign << 1) - 1;
193 || length != ((length & mask) ^ sign) - sign
194 || (length > 0 && (~
offset & (
offset + length - 1) & sign) != 0))
195 error (_(
"Integer overflow in data location calculation"));
231 if (ranges.size () == 1)
233 const struct range &t = ranges[0];
338 auto i = std::lower_bound (vectorp->begin (), vectorp->end (), newr);
339 if (i > vectorp->begin ())
341 struct range &bef = *(i - 1);
362 i = vectorp->insert (i, newr);
368 i = vectorp->insert (i, newr);
373 if (i != vectorp->end () && i + 1 < vectorp->end ())
379 struct range &t = *i;
383 for (; i < vectorp->end (); i++)
385 struct range &r = *i;
408 vectorp->erase (next, next + removed);
422 length * TARGET_CHAR_BIT);
436 for (i = pos; i < ranges->size (); i++)
438 const range &r = (*ranges)[i];
460 const gdb_byte *ptr2,
size_t offset2_bits,
463 gdb_assert (offset1_bits % TARGET_CHAR_BIT
464 == offset2_bits % TARGET_CHAR_BIT);
466 if (offset1_bits % TARGET_CHAR_BIT != 0)
469 gdb_byte mask, b1, b2;
475 bits = TARGET_CHAR_BIT - offset1_bits % TARGET_CHAR_BIT;
476 gdb_assert (
bits <
sizeof (mask) * TARGET_CHAR_BIT);
477 mask = (1 <<
bits) - 1;
479 if (length_bits <
bits)
481 mask &= ~(gdb_byte) ((1 << (
bits - length_bits)) - 1);
486 b1 = *(ptr1 + offset1_bits / TARGET_CHAR_BIT) & mask;
487 b2 = *(ptr2 + offset2_bits / TARGET_CHAR_BIT) & mask;
495 offset1_bits +=
bits;
496 offset2_bits +=
bits;
499 if (length_bits % TARGET_CHAR_BIT != 0)
503 gdb_byte mask, b1, b2;
510 bits = length_bits % TARGET_CHAR_BIT;
511 o1 = offset1_bits + length_bits -
bits;
512 o2 = offset2_bits + length_bits -
bits;
514 gdb_assert (
bits <
sizeof (mask) * TARGET_CHAR_BIT);
515 mask = ((1 <<
bits) - 1) << (TARGET_CHAR_BIT -
bits);
517 gdb_assert (o1 % TARGET_CHAR_BIT == 0);
518 gdb_assert (o2 % TARGET_CHAR_BIT == 0);
520 b1 = *(ptr1 + o1 / TARGET_CHAR_BIT) & mask;
521 b2 = *(ptr2 + o2 / TARGET_CHAR_BIT) & mask;
534 gdb_assert (offset1_bits % TARGET_CHAR_BIT == 0);
535 gdb_assert (offset2_bits % TARGET_CHAR_BIT == 0);
536 gdb_assert (length_bits % TARGET_CHAR_BIT == 0);
538 return memcmp (ptr1 + offset1_bits / TARGET_CHAR_BIT,
539 ptr2 + offset2_bits / TARGET_CHAR_BIT,
540 length_bits / TARGET_CHAR_BIT);
570 LONGEST
offset1, LONGEST offset2,
571 ULONGEST length, ULONGEST *l, ULONGEST *h)
578 if (rp1->
idx == -1 && rp2->
idx == -1)
584 else if (rp1->
idx == -1 || rp2->
idx == -1)
588 const range *r1, *r2;
601 l2 = std::max (offset2, r2->
offset);
602 h2 = std::min (offset2 + length, offset2 + r2->
length);
613 if (l1 != l2 || h1 != h2)
643 gdb_assert (offset2 + length
646 memset (&rp1, 0,
sizeof (rp1));
647 memset (&rp2, 0,
sizeof (rp2));
655 ULONGEST l = 0, h = 0;
658 for (i = 0; i < 2; i++)
660 ULONGEST l_tmp, h_tmp;
670 if (i == 0 || l_tmp < l)
694 const struct value *val2, LONGEST offset2,
695 LONGEST length)
const
698 val2, offset2 * TARGET_CHAR_BIT,
699 length * TARGET_CHAR_BIT);
741 val =
new struct value (type);
764#define MIN_VALUE_FOR_MAX_VALUE_SIZE 16
778 error (_(
"max-value-size set too low, increasing to %d bytes"),
790 gdb_printf (file, _(
"Maximum value size is unlimited.\n"));
792 gdb_printf (file, _(
"Maximum value size is %d bytes.\n"),
810 error (_(
"value of type `%s' requires %s bytes, which is more "
811 "than max-value-size"),
type->
name (), pulongest (length));
813 error (_(
"value requires %s bytes, which is more than "
814 "max-value-size"), pulongest (length));
850 gdb_assert (array_type->
code () == TYPE_CODE_ARRAY);
853 while (array_type->
code () == TYPE_CODE_ARRAY)
881 gdb_assert (array_type->
code () == TYPE_CODE_ARRAY);
884 ULONGEST len = (elm_type->
length ()
885 * (*array_length_limiting_element_count));
886 len = std::min (len, array_type->
length ());
902 if (limit != 0 && len > limit)
919 ULONGEST len = enc_type->
length ();
928 if (
type () == enc_type
929 &&
type ()->
code () == TYPE_CODE_ARRAY
937 m_contents.reset ((gdb_byte *) xzalloc (len));
974 struct type *array_type
1008gdb::array_view<gdb_byte>
1016 return gdb::make_array_view
1020gdb::array_view<gdb_byte>
1026 return gdb::make_array_view (
m_contents.get (), length);
1033 int *real_type_found)
1036 struct type *result;
1040 if (real_type_found)
1041 *real_type_found = 0;
1043 if (opts.objectprint)
1049 == TYPE_CODE_STRUCT)
1052 struct type *real_type;
1057 if (real_type_found)
1058 *real_type_found = 1;
1062 else if (resolve_simple_types)
1064 if (real_type_found)
1065 *real_type_found = 1;
1076 throw_error (OPTIMIZED_OUT_ERROR, _(
"value has been optimized out"));
1085 throw_error (OPTIMIZED_OUT_ERROR,
1086 _(
"register has not been saved in frame"));
1096 throw_error (NOT_AVAILABLE_ERROR, _(
"value is not available"));
1099gdb::array_view<const gdb_byte>
1106 return gdb::make_array_view (
m_contents.get (), length);
1109gdb::array_view<const gdb_byte>
1115 return gdb::make_array_view (
m_contents.get (), length);
1118gdb::array_view<const gdb_byte>
1132 const std::vector<range> &src_range,
int src_bit_offset,
1133 unsigned int bit_length)
1135 for (
const range &r : src_range)
1139 l = std::max (r.
offset, (LONGEST) src_bit_offset);
1141 (LONGEST) src_bit_offset + bit_length);
1145 dst_bit_offset + (l - src_bit_offset),
1154 int src_bit_offset,
int bit_length)
const
1168 LONGEST src_offset, LONGEST length)
1170 LONGEST src_bit_offset, dst_bit_offset, bit_length;
1179 ULONGEST copy_length = length;
1181 if (limit > 0 && src_offset + length > limit)
1182 copy_length = src_offset > limit ? 0 : limit - src_offset;
1189 TARGET_CHAR_BIT * length));
1192 gdb::array_view<gdb_byte> dst_contents
1194 copy_length * unit_size);
1195 gdb::array_view<const gdb_byte> src_contents
1197 copy_length * unit_size);
1198 gdb::copy (src_contents, dst_contents);
1201 src_bit_offset = src_offset * unit_size * HOST_CHAR_BIT;
1202 dst_bit_offset = dst_offset * unit_size * HOST_CHAR_BIT;
1203 bit_length = length * unit_size * HOST_CHAR_BIT;
1206 src_bit_offset, bit_length);
1213 LONGEST src_bit_offset,
1222 ULONGEST copy_bit_length = bit_length;
1224 if (bit_limit > 0 && src_bit_offset + bit_length > bit_limit)
1225 copy_bit_length = (src_bit_offset > bit_limit ? 0
1226 : bit_limit - src_bit_offset);
1231 LONGEST dst_offset = dst_bit_offset / TARGET_CHAR_BIT;
1232 LONGEST length = bit_length / TARGET_CHAR_BIT;
1241 src_contents.data (), src_bit_offset,
1253 LONGEST src_offset, LONGEST length)
1261gdb::array_view<const gdb_byte>
1270gdb::array_view<gdb_byte>
1300 catch (
const gdb_exception_error &ex)
1305 case OPTIMIZED_OUT_ERROR:
1306 case NOT_AVAILABLE_ERROR:
1327 length * TARGET_CHAR_BIT);
1342 || !
m_location.computed.funcs->check_synthetic_pointer)
1455 std::vector<value_ref_ptr>::reverse_iterator iter;
1469 return value_ref_ptr::new_reference (val);
1474std::vector<value_ref_ptr>
1477 std::vector<value_ref_ptr> result;
1484 std::move (iter + 1,
all_values.end (), std::back_inserter (result));
1487 std::reverse (result.begin (), result.end ());
1528 const auto &arg_view
1529 = gdb::make_array_view (
m_contents.get (), length);
1532 gdb::array_view<gdb_byte> val_contents
1535 gdb::copy (arg_view, val_contents);
1557 struct type *val_type = v->
type ();
1651 gdb_assert (
lazy ());
1719 error (_(
"The history is empty."));
1721 error (_(
"There is only one value in the history."));
1723 error (_(
"History does not go back to $$%d."), -num);
1726 error (_(
"History has not yet reached $%d."), absnum);
1752 if (num_exp[0] !=
'+' || num_exp[1] !=
'\0')
1764 for (i = num; i < num + 10 && i <=
value_history.size (); i++)
1781 if (from_tty && num_exp)
1885 if (
expr->first_opcode () != BINOP_ASSIGN)
1886 error (_(
"Init-if-undefined requires an assignment expression."));
1891 if (assign !=
nullptr)
1896 if (ivarop !=
nullptr)
1900 if (intvar ==
nullptr)
1901 error (_(
"The first parameter to init-if-undefined "
1902 "should be a GDB variable."));
1933 int len = strlen (
name);
1939 if (var.
name.compare (0, len,
name) == 0)
1953 gdb_assert (pair.second);
1955 return &pair.first->second;
1973 var->
u.make_value.functions =
funcs;
1974 var->
u.make_value.data = data;
1986 || var->
u.make_value.functions->compile_to_ax == NULL)
1989 var->
u.make_value.functions->compile_to_ax (var,
expr,
value,
1990 var->
u.make_value.data);
2047 if (!var->
u.integer.type)
2049 var->
u.integer.val);
2057 strlen (var->
u.string));
2061 val = var->
u.value->copy ();
2067 val = (*var->
u.make_value.functions->make_value) (
gdbarch, var,
2068 var->
u.make_value.data);
2072 internal_error (_(
"bad kind"));
2107 *result = var->
u.integer.val;
2115 if (
type->
code () == TYPE_CODE_INT)
2132 *result = var->
u.fn.function;
2152 addr = var->
u.value->contents_writeable ().data ();
2166 internal_error (_(
"set_internalvar_component"));
2177 error (_(
"Cannot overwrite convenience function %s"), var->
name.c_str ());
2182 case TYPE_CODE_VOID:
2186 case TYPE_CODE_INTERNAL_FUNCTION:
2203 copy->fetch_lazy ();
2226 var->
kind = new_kind;
2238 var->
u.integer.type = NULL;
2239 var->
u.integer.val = l;
2249 var->
u.string = xstrdup (
string);
2259 var->
u.fn.function =
f;
2260 var->
u.fn.canonical = 1;
2271 var->
u.value->decref ();
2289 return var->
name.c_str ();
2312 gdb_assert (result);
2327 gdb_assert (result);
2370 gdb::unique_xmalloc_ptr<char> &&doc,
2378 (void) doc.release ();
2380 (void)
name.release ();
2398 htab_t copied_types)
2403 if (var->
u.integer.type
2404 && var->
u.integer.type->objfile_owner () ==
objfile)
2410 var->
u.value->preserve (
objfile, copied_types);
2421 htab_t copied_types)
2448 item->preserve (
objfile, copied_types.get ());
2457 copied_types.get ());
2488 catch (
const gdb_exception_error &ex)
2491 _(
"<error: %s>"), ex.what ());
2502 gdb_printf (_(
"No debugger convenience variables now defined.\n"
2503 "Convenience variables have "
2504 "names starting with \"$\";\n"
2505 "use \"set\" as in \"set "
2506 "$foo = 5\" to define them.\n"));
2531 gdb_assert (
type ()->
code () == TYPE_CODE_XMETHOD
2534 return m_location.xm_worker->get_result_type (argv[0], argv.slice (1));
2542 gdb_assert (
type ()->
code () == TYPE_CODE_XMETHOD
2545 return m_location.xm_worker->invoke (argv[0], argv.slice (1));
2573 case TYPE_CODE_ENUM:
2574 case TYPE_CODE_BOOL:
2576 case TYPE_CODE_CHAR:
2577 case TYPE_CODE_RANGE:
2586 gdb::array_view<const gdb_byte> valbytes = val->
contents ();
2591 unsigned bit_off = 0, bit_size = 0;
2603 unsigned n_bytes = ((bit_off % 8) + bit_size + 7) / 8;
2604 valbytes = valbytes.slice (bit_off / 8, n_bytes);
2606 if (byte_order == BFD_ENDIAN_BIG)
2607 bit_off = (n_bytes * 8 - bit_off % 8 - bit_size);
2620 result.
mask (bit_size);
2686 if (val->
type ()->
code () == TYPE_CODE_FUNC
2687 || val->
type ()->
code () == TYPE_CODE_METHOD)
2765 case TYPE_CODE_TYPEDEF:
2767 case TYPE_CODE_ENUM:
2768 case TYPE_CODE_FLAGS:
2769 case TYPE_CODE_BOOL:
2771 case TYPE_CODE_CHAR:
2772 case TYPE_CODE_RANGE:
2773 case TYPE_CODE_MEMBERPTR:
2797 if (
code == TYPE_CODE_RANGE)
2803 case TYPE_CODE_DECFLOAT:
2806 case TYPE_CODE_FIXED_POINT:
2819 case TYPE_CODE_RVALUE_REF:
2825 error (_(
"Value can't be converted to integer."));
2858 error (_(
"Invalid floating value found in program."));
2872 struct value *retval;
2904 gdb_assert_not_reached (
"unexpected field location kind");
2923 new_encl_type->
length ()));
2961 LONGEST container_bitsize =
type->
length () * 8;
2965 if ((
bitpos % container_bitsize) + v->
bitsize () <= container_bitsize
2966 &&
type->
length () <= (
int) sizeof (LONGEST))
3015 gdb_assert (0 ==
offset);
3026 / (HOST_CHAR_BIT * unit_size));
3103 if (
type != (*arg1p)->type ())
3136 bytes_read = field_type->
length ();
3143 bytes_read, byte_order);
3147 if (byte_order == BFD_ENDIAN_BIG)
3156 if (
bitsize < 8 * (
int)
sizeof (val))
3158 valmask = (((ULONGEST) 1) <<
bitsize) - 1;
3162 if (val & (valmask ^ (valmask >> 1)))
3180 const struct value *val, LONGEST *result)
3187 gdb_assert (val != NULL);
3220 enum bfd_endian byte_order;
3223 struct type *field_type = dest_val->
type ();
3232 if (valaddr != NULL)
3239 field_type->
length (), byte_order, num);
3245 if (byte_order == BFD_ENDIAN_BIG)
3246 dst_bit_offset = field_type->
length () * TARGET_CHAR_BIT -
bitsize;
3260 const gdb_byte *valaddr,
3285 ULONGEST mask = (ULONGEST) -1 >> (8 *
sizeof (ULONGEST) -
bitsize);
3294 if ((~fieldval & ~(mask >> 1)) == 0)
3298 if (0 != (fieldval & ~mask))
3302 warning (_(
"Value does not fit in %s bits."), plongest (
bitsize));
3315 if (byte_order == BFD_ENDIAN_BIG)
3318 oword &= ~(mask <<
bitpos);
3319 oword |= fieldval <<
bitpos;
3337 case TYPE_CODE_RANGE:
3341 case TYPE_CODE_CHAR:
3342 case TYPE_CODE_ENUM:
3343 case TYPE_CODE_FLAGS:
3344 case TYPE_CODE_BOOL:
3345 case TYPE_CODE_MEMBERPTR:
3350 num &= ((ULONGEST) 1 << bit_size) - 1;
3357 case TYPE_CODE_RVALUE_REF:
3363 case TYPE_CODE_DECFLOAT:
3368 error (_(
"Unexpected type (%d) encountered for integer constant."),
3380 enum bfd_endian byte_order;
3389 case TYPE_CODE_CHAR:
3390 case TYPE_CODE_ENUM:
3391 case TYPE_CODE_FLAGS:
3392 case TYPE_CODE_BOOL:
3393 case TYPE_CODE_RANGE:
3394 case TYPE_CODE_MEMBERPTR:
3399 num &= ((ULONGEST) 1 << bit_size) - 1;
3406 case TYPE_CODE_RVALUE_REF:
3412 case TYPE_CODE_DECFLOAT:
3417 error (_(
"Unexpected type (%d) encountered "
3418 "for unsigned integer constant."),
3480 if (val != &storage)
3486 storage.
mask (bit_size);
3487 storage <<= bit_off;
3517 gdb_assert (
type->
code () == TYPE_CODE_FLT);
3532 const gdb_byte *valaddr,
3537 if (valaddr == NULL)
3553 const gdb_byte *valaddr,
3557 gdb::array_view<const gdb_byte> view;
3558 if (valaddr !=
nullptr)
3559 view = gdb::make_array_view (valaddr,
type->
length ());
3565 if (valaddr == NULL)
3583 struct value *result;
3608 for (; isdigit (h[len]); len++)
3612 if (h[len] ==
'_' || isalpha (h[len]))
3629 index = -strtol (&h[2], &local_end, 10);
3645 index = strtol (&h[1], &local_end, 10);
3680 LONGEST bit_offset, LONGEST bit_length)
3682 gdb_assert (!
lazy ());
3687 if ((bit_offset % TARGET_CHAR_BIT) == 0
3688 && (bit_length % TARGET_CHAR_BIT) == 0
3689 && bit_length == TARGET_CHAR_BIT *
type->
length ())
3696 dst_offset += TARGET_CHAR_BIT *
type->
length () - bit_length;
3728 const struct type *original_type,
3729 struct value *original_value,
3730 CORE_ADDR original_value_address)
3735 gdb::array_view<const gdb_byte> view;
3736 struct type *resolved_original_target_type
3738 original_value_address);
3755 struct value *retval;
3756 struct type *enc_type;
3770 enc_type = retval->
type ();
3785 case TYPE_CODE_ARRAY:
3789 case TYPE_CODE_FUNC:
3802 struct value *function,
struct type *value_type)
3806 if (
code == TYPE_CODE_ERROR)
3807 error (_(
"Function return type unknown."));
3820 struct value *function,
struct type *value_type)
3822 if (value_type->
code () == TYPE_CODE_VOID)
3845 if (parent->
lazy ())
3869 gdb_assert (this->type ()->
code () == TYPE_CODE_ARRAY);
3875 gdb_assert (len >= 0);
3890 struct value *new_val =
this;
3896 gdb_assert (
offset () == 0);
3905 gdb_assert (next_frame != NULL);
3936 internal_error (_(
"infinite loop while fetching a register"));
3941 if (new_val->
lazy ())
3962 "(frame=%d, regnum=%d(%s), ...) ",
3975 gdb::array_view<const gdb_byte> buf = new_val->
contents ();
4003 gdb_assert (
lazy ());
4024 internal_error (_(
"Unexpected lazy value type."));
4031static struct value *
4034 void *cookie,
int argc,
struct value **argv)
4039 error (_(
"You must provide one argument for $_isvoid."));
4041 ret = argv[0]->type ()->code () == TYPE_CODE_VOID;
4049static struct value *
4052 void *cookie,
int argc,
struct value **argv)
4055 error (_(
"You must provide one argument for $_creal."));
4057 value *cval = argv[0];
4059 if (ctype->
code () != TYPE_CODE_COMPLEX)
4060 error (_(
"expected a complex number"));
4067static struct value *
4070 void *cookie,
int argc,
4071 struct value **argv)
4074 error (_(
"You must provide one argument for $_cimag."));
4076 value *cval = argv[0];
4078 if (ctype->
code () != TYPE_CODE_COMPLEX)
4079 error (_(
"expected a complex number"));
4090test_ranges_contain ()
4092 std::vector<range> ranges;
4098 ranges.push_back (r);
4103 ranges.push_back (r);
4134check_ranges_vector (gdb::array_view<const range> ranges,
4135 gdb::array_view<const range> expected)
4137 return ranges == expected;
4143test_insert_into_bit_range_vector ()
4145 std::vector<range> ranges;
4150 static const range expected[] = {
4153 SELF_CHECK (check_ranges_vector (ranges, expected));
4159 static const range expected = {10, 5};
4160 SELF_CHECK (check_ranges_vector (ranges, expected));
4166 static const range expected[] = {
4170 SELF_CHECK (check_ranges_vector (ranges, expected));
4176 static const range expected[] = {
4180 SELF_CHECK (check_ranges_vector (ranges, expected));
4186 static const range expected[] = {
4191 SELF_CHECK (check_ranges_vector (ranges, expected));
4197 static const range expected[] = {
4201 SELF_CHECK (check_ranges_vector (ranges, expected));
4207 static const range expected[] = {
4211 SELF_CHECK (check_ranges_vector (ranges, expected));
4217 static const range expected = {2, 32};
4218 SELF_CHECK (check_ranges_vector (ranges, expected));
4232 SELF_CHECK (val->entirely_optimized_out ());
4233 SELF_CHECK (copy->entirely_optimized_out ());
4245Debugger convenience (\"$foo\") variables and functions.\n\
4246Convenience variables are created when you assign them values;\n\
4247thus, \"set $foo=1\" gives \"$foo\" the value 1. Values may be any type.\n\
4249A few convenience variables are given values automatically:\n\
4250\"$_\"holds the last address examined with \"x\" or \"info lines\",\n\
4251\"$__\" holds the contents of the last address examined with \"x\"."
4254Convenience functions are defined via the Python API."
4260Elements of value history around item number IDX (or last ten)."),
4264Initialize a convenience variable if necessary.\n\
4265init-if-undefined VARIABLE = EXPRESSION\n\
4266Set an internal VARIABLE to the result of the EXPRESSION if it does not\n\
4267exist or does not contain a value. The EXPRESSION is not evaluated if the\n\
4268VARIABLE is already initialized."));
4271Placeholder command for showing help on convenience functions."),
4275Check whether an expression is void.\n\
4276Usage: $_isvoid (expression)\n\
4277Return 1 if the expression is void, zero otherwise."),
4281Extract the real part of a complex number.\n\
4282Usage: $_creal (expression)\n\
4283Return the real part of a complex number, the type depends on the\n\
4284type of a complex number."),
4288Extract the imaginary part of a complex number.\n\
4289Usage: $_cimag (expression)\n\
4290Return the imaginary part of a complex number, the type depends on the\n\
4291type of a complex number."),
4296Set maximum sized value gdb will load from the inferior."), _(
"\
4297Show maximum sized value gdb will load from the inferior."), _(
"\
4298Use this to control the maximum size, in bytes, of a value that gdb\n\
4299will load from the inferior. Setting this value to 'unlimited'\n\
4300disables checking.\n\
4301Setting this does not invalidate already allocated values, it only\n\
4302prevents future values, larger than this size, from being allocated."),
4309Set the maximum number of bytes allowed in a variable-size object."), _(
"\
4310Show the maximum number of bytes allowed in a variable-size object."), _(
"\
4311Attempts to access an object whose size is not a compile-time constant\n\
4312and exceeds this limit will cause an error."),
4317 selftests::register_test (
"ranges_contain", selftests::test_ranges_contain);
4318 selftests::register_test (
"insert_into_bit_range_vector",
4319 selftests::test_insert_into_bit_range_vector);
4320 selftests::register_test (
"value_copy", selftests::test_value_copy);
#define bits(obj, st, fn)
gdb_static_assert(sizeof(splay_tree_key) >=sizeof(CORE_ADDR *))
void * xrealloc(void *ptr, size_t size)
struct gdbarch * get_current_arch(void)
struct gdbarch * target_gdbarch(void)
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)
operation * get_lhs() const
internalvar * get_internalvar() const
const char * c_str() const
struct cmd_list_element * showlist
struct cmd_list_element * cmdlist
struct cmd_list_element * setlist
struct cmd_list_element * add_alias_cmd(const char *name, cmd_list_element *target, enum command_class theclass, int abbrev_flag, struct cmd_list_element **list)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_simple_func_ftype *fun, const char *doc)
set_show_commands add_setshow_zuinteger_unlimited_cmd(const char *name, enum command_class theclass, int *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 * deprecate_cmd(struct cmd_list_element *cmd, const char *replacement)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_simple_func_ftype *fun, const char *doc, struct cmd_list_element **subcommands, int allow_unknown, struct cmd_list_element **list)
cli_style_option metadata_style
void set_repeat_arguments(const char *args)
void write_memory(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
int baseclass_offset(struct type *type, int index, const gdb_byte *valaddr, LONGEST embedded_offset, CORE_ADDR address, const struct value *val)
static void store_signed_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, LONGEST val)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
void store_typed_address(gdb_byte *buf, struct type *type, CORE_ADDR addr)
CORE_ADDR extract_typed_address(const gdb_byte *buf, struct type *type)
@ lval_internalvar_component
static LONGEST extract_signed_integer(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order)
static ULONGEST extract_unsigned_integer(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order)
@ RETURN_VALUE_REGISTER_CONVENTION
ssize_t read(int fd, void *buf, size_t count)
std::unique_ptr< expression > expression_up
expression_up parse_expression(const char *, innermost_block_tracker *=nullptr, parser_flags flags=0)
void preserve_ext_lang_values(struct objfile *objfile, htab_t copied_types)
std::unique_ptr< xmethod_worker > xmethod_worker_up
int frame_relative_level(frame_info_ptr fi)
frame_info_ptr get_prev_frame_always(frame_info_ptr this_frame)
struct gdbarch * get_frame_arch(frame_info_ptr this_frame)
struct value * frame_unwind_register_value(frame_info_ptr next_frame, int regnum)
frame_info_ptr frame_find_by_id(struct frame_id id)
#define frame_debug_printf(fmt,...)
enum return_value_convention gdbarch_return_value_as_value(struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, struct value **read_value, const gdb_byte *writebuf)
CORE_ADDR gdbarch_integer_to_address(struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf)
bool gdbarch_integer_to_address_p(struct gdbarch *gdbarch)
int gdbarch_addressable_memory_unit_size(struct gdbarch *gdbarch)
int gdbarch_convert_register_p(struct gdbarch *gdbarch, int regnum, struct type *type)
CORE_ADDR gdbarch_addr_bits_remove(struct gdbarch *gdbarch, CORE_ADDR addr)
CORE_ADDR gdbarch_convert_from_func_ptr_addr(struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ)
struct type * copy_type_recursive(struct type *type, htab_t copied_types)
enum bfd_endian type_byte_order(const struct type *type)
struct type * lookup_pointer_type(struct type *type)
int is_floating_type(struct type *t)
htab_up create_copied_types_hash()
int is_scalar_type(struct type *type)
struct type * lookup_array_range_type(struct type *element_type, LONGEST low_bound, LONGEST high_bound)
struct type * make_cv_type(int cnst, int voltl, struct type *type, struct type **typeptr)
struct type * resolve_dynamic_type(struct type *type, gdb::array_view< const gdb_byte > valaddr, CORE_ADDR addr, const frame_info_ptr *in_frame)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
unsigned int type_length_units(struct type *type)
bool is_fixed_point_type(struct type *type)
struct type * check_typedef(struct type *type)
#define TYPE_FN_FIELD_PHYSNAME(thisfn, n)
#define TYPE_DATA_LOCATION(thistype)
#define TYPE_IS_REFERENCE(t)
@ FIELD_LOC_KIND_PHYSNAME
@ FIELD_LOC_KIND_PHYSADDR
#define TYPE_DATA_LOCATION_ADDR(thistype)
#define TYPE_FN_FIELD_TYPE(thisfn, n)
#define BASETYPE_VIA_VIRTUAL(thistype, index)
#define TYPE_N_BASECLASSES(thistype)
struct inferior * current_inferior(void)
initialize_file_ftype _initialize_values
const struct language_defn * current_language
LONGEST read_offset(bfd *abfd, const gdb_byte *buf, unsigned int offset_size)
struct bound_minimal_symbol lookup_minimal_symbol(const char *name, const char *sfile, struct objfile *objf)
struct bound_minimal_symbol lookup_bound_minimal_symbol(const char *name)
int register_size(struct gdbarch *gdbarch, int regnum)
void(* func)(remote_target *remote, char *)
const struct block * block
CORE_ADDR entry_pc() const
CORE_ADDR value_address() const
struct minimal_symbol * minsym
struct type * builtin_int
unsigned int doc_allocated
unsigned int name_allocated
CORE_ADDR loc_physaddr() const
LONGEST loc_bitpos() const
const char * loc_physname() const
field_loc_kind loc_kind() const
unsigned int bitsize() const
struct type * type() const
void read_fixed_point(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order, bool unsigned_p, const gdb_mpq &scaling_factor)
gdb_mpz as_integer() const
void read(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order, bool unsigned_p)
void truncate(gdb::array_view< gdb_byte > buf, enum bfd_endian byte_order, bool unsigned_p) const
internal_function_fn handler
internalvar(std::string name)
enum internalvar_kind kind
enum language la_language
virtual struct value * value_string(struct gdbarch *gdbarch, const char *ptr, ssize_t len) const
virtual char string_lower_bound() const
virtual bool c_style_arrays_p() const
void(* read)(struct value *v)
bool(* is_optimized_out)(struct value *v)
void *(* copy_closure)(const struct value *v)
void(* free_closure)(struct value *v)
struct value *(* coerce_ref)(const struct value *value)
struct gdbarch * arch() const
const std::vector< range > * ranges
scoped_array_length_limiting(int elements)
~scoped_array_length_limiting()
const block * value_block() const
struct type * target_type() const
void remove_dyn_prop(dynamic_prop_node_kind kind)
struct field & field(int idx) const
struct objfile * objfile_owner() const
bool bit_size_differs_p() const
const gdb_mpq & fixed_point_scaling_factor()
bool is_pointer_or_reference() const
range_bounds * bounds() const
const char * name() const
struct type * fixed_point_type_base_type()
unsigned short bit_offset() const
bool is_objfile_owned() const
unsigned short bit_size() const
static struct value * from_xmethod(xmethod_worker_up &&worker)
void unpack_bitfield(struct value *dest_val, LONGEST bitpos, LONGEST bitsize, const gdb_byte *valaddr, LONGEST embedded_offset) const
std::vector< range > m_optimized_out
static struct value * zero(struct type *type, enum lval_type lv)
void set_parent(struct value *parent)
struct value * primitive_field(LONGEST offset, int fieldno, struct type *arg_type)
static struct value * allocate_optimized_out(struct type *type)
gdb::array_view< const gdb_byte > contents_all()
const struct lval_funcs * funcs
std::vector< range > m_unavailable
void contents_copy(struct value *dst, LONGEST dst_offset, LONGEST src_offset, LONGEST length)
bool bits_any_optimized_out(int bit_offset, int bit_length) const
void set_bitpos(LONGEST bit)
struct frame_id next_frame_id
void preserve(struct objfile *objfile, htab_t copied_types)
void set_modifiable(bool val)
void force_lval(CORE_ADDR)
struct value * non_lval()
void mark_bits_optimized_out(LONGEST offset, LONGEST length)
gdb::unique_xmalloc_ptr< gdb_byte > m_contents
LONGEST m_pointed_to_offset
struct value * copy() const
struct value::@203::@205 computed
static struct value * allocate_computed(struct type *type, const struct lval_funcs *funcs, void *closure)
void contents_copy_raw(struct value *dst, LONGEST dst_offset, LONGEST src_offset, LONGEST length)
void ranges_copy_adjusted(struct value *dst, int dst_bit_offset, int src_bit_offset, int bit_length) const
struct gdbarch * arch() const
ULONGEST m_limited_length
void mark_bytes_optimized_out(int offset, int length)
gdb::array_view< gdb_byte > contents_writeable()
void contents_copy_raw_bitwise(struct value *dst, LONGEST dst_bit_offset, LONGEST src_bit_offset, LONGEST bit_length)
static struct value * allocate(struct type *type)
bool bytes_available(LONGEST offset, ULONGEST length) const
struct frame_id * deprecated_next_frame_id_hack()
LONGEST m_embedded_offset
void set_enclosing_type(struct type *new_type)
void set_embedded_offset(LONGEST val)
struct value * from_component_bitsize(struct type *type, LONGEST bit_offset, LONGEST bit_length)
struct xmethod_worker * xm_worker
struct type * enclosing_type() const
void set_lval(lval_type val)
bool entirely_unavailable()
void set_bitsize(LONGEST bit)
const struct lval_funcs * computed_funcs() const
void mark_bytes_unavailable(LONGEST offset, ULONGEST length)
LONGEST embedded_offset() const
gdb::array_view< const gdb_byte > contents()
LONGEST pointed_to_offset() const
void require_available() const
void set_address(CORE_ADDR)
void allocate_contents(bool check_size)
void set_component_location(const struct value *whole)
bool entirely_available()
bool contents_bits_eq(int offset1, const struct value *val2, int offset2, int length) const
struct type * result_type_of_xmethod(gdb::array_view< value * > argv)
gdb::array_view< gdb_byte > contents_raw()
struct type * type() const
struct value * call_xmethod(gdb::array_view< value * > argv)
void set_offset(LONGEST offset)
bool bits_available(LONGEST offset, ULONGEST length) const
CORE_ADDR raw_address() const
bool entirely_optimized_out()
bool contents_eq(LONGEST offset1, const struct value *val2, LONGEST offset2, LONGEST length) const
void set_pointed_to_offset(LONGEST val)
void fetch_lazy_register()
void require_not_optimized_out() const
void fetch_lazy_bitfield()
union value::@203 m_location
void * computed_closure() const
int * deprecated_regnum_hack()
bool set_limited_array_length()
void mark_bits_unavailable(LONGEST offset, ULONGEST length)
bool entirely_covered_by_range_vector(const std::vector< range > &ranges)
enum lval_type lval() const
struct type * m_enclosing_type
gdb::array_view< gdb_byte > contents_all_raw()
void deprecated_set_type(struct type *type)
static struct value * allocate_lazy(struct type *type)
bool bits_synthetic_pointer(LONGEST offset, LONGEST length) const
gdb::array_view< const gdb_byte > contents_for_printing()
struct block_symbol lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
LONGEST target_float_to_longest(const gdb_byte *addr, const struct type *type)
bool target_float_is_valid(const gdb_byte *addr, const struct type *type)
void target_float_from_longest(gdb_byte *addr, const struct type *type, LONGEST val)
void target_float_from_host_double(gdb_byte *addr, const struct type *type, double val)
void target_float_from_ulongest(gdb_byte *addr, const struct type *type, ULONGEST val)
bool target_get_trace_state_variable_value(int tsv, LONGEST *val)
struct trace_state_variable * find_trace_state_variable(const char *name)
struct internalvar_data::@201 fn
const struct internalvar_funcs * functions
struct internal_function * function
const char * user_reg_map_regnum_to_name(struct gdbarch *gdbarch, int regnum)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
void copy_bitwise(gdb_byte *dest, ULONGEST dest_offset, const gdb_byte *source, ULONGEST source_offset, ULONGEST nbits, int bits_big_endian)
void fprintf_styled(struct ui_file *stream, const ui_file_style &style, const char *format,...)
void gdb_printf(struct ui_file *stream, const char *format,...)
void val_print_optimized_out(const struct value *val, struct ui_file *stream)
void get_user_print_options(struct value_print_options *opts)
static struct value * isvoid_internal_fn(struct gdbarch *gdbarch, const struct language_defn *language, void *cookie, int argc, struct value **argv)
static std::map< std::string, internalvar > internalvars
static void set_internalvar_function(struct internalvar *var, struct internal_function *f)
static int max_value_size
static struct internal_function * create_internal_function(const char *name, internal_function_fn handler, void *cookie)
static int find_first_range_overlap(const std::vector< range > *ranges, int pos, LONGEST offset, LONGEST length)
static struct value * creal_internal_fn(struct gdbarch *gdbarch, const struct language_defn *language, void *cookie, int argc, struct value **argv)
static void init_if_undefined_command(const char *args, int from_tty)
static std::vector< value_ref_ptr > value_history
static bool ranges_overlap(LONGEST offset1, ULONGEST len1, LONGEST offset2, ULONGEST len2)
static struct cmd_list_element * functionlist
static void pack_unsigned_long(gdb_byte *buf, struct type *type, ULONGEST num)
static struct type * find_array_element_type(struct type *array_type)
static void preserve_one_internalvar(struct internalvar *var, struct objfile *objfile, htab_t copied_types)
static struct cmd_list_element * do_add_internal_function(const char *name, const char *doc, internal_function_fn handler, void *cookie)
static gdb::optional< int > array_length_limiting_element_count
static int get_internalvar_function(struct internalvar *var, struct internal_function **result)
static int find_first_range_overlap_and_match(struct ranges_and_idx *rp1, struct ranges_and_idx *rp2, LONGEST offset1, LONGEST offset2, ULONGEST length, ULONGEST *l, ULONGEST *h)
static void show_max_value_size(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static ULONGEST calculate_limited_array_length(struct type *array_type)
static struct value * cimag_internal_fn(struct gdbarch *gdbarch, const struct language_defn *language, void *cookie, int argc, struct value **argv)
static void preserve_one_varobj(struct varobj *varobj, struct objfile *objfile, htab_t copied_types)
static void show_convenience(const char *ignore, int from_tty)
static void insert_into_bit_range_vector(std::vector< range > *vectorp, LONGEST offset, ULONGEST length)
#define MIN_VALUE_FOR_MAX_VALUE_SIZE
static std::vector< value_ref_ptr > all_values
static void check_type_length_before_alloc(const struct type *type)
static void show_values(const char *num_exp, int from_tty)
value_ref_ptr release_value(struct value *val)
static bool ranges_contain(const std::vector< range > &ranges, LONGEST offset, ULONGEST length)
static void function_command(const char *command, int from_tty)
static void set_max_value_size(const char *args, int from_tty, struct cmd_list_element *c)
static int memcmp_with_bit_offsets(const gdb_byte *ptr1, size_t offset1_bits, const gdb_byte *ptr2, size_t offset2_bits, size_t length_bits)
enum return_value_convention struct_return_convention(struct gdbarch *gdbarch, struct value *function, struct type *value_type)
void read_value_memory(struct value *val, LONGEST bit_offset, bool stack, CORE_ADDR memaddr, gdb_byte *buffer, size_t length)
void set_internalvar_string(struct internalvar *var, const char *string)
struct value * value_from_contents(struct type *, const gdb_byte *)
struct value * value_of_internalvar(struct gdbarch *gdbarch, struct internalvar *var)
struct value * readjust_indirect_value_type(struct value *value, struct type *enc_type, const struct type *original_type, struct value *original_val, CORE_ADDR original_value_address)
bool is_floating_value(struct value *val)
void value_print(struct value *val, struct ui_file *stream, const struct value_print_options *options)
#define VALUE_NEXT_FRAME_ID(val)
struct value * coerce_ref_if_computed(const struct value *arg)
void clear_internalvar(struct internalvar *var)
struct value * value_field(struct value *arg1, int fieldno)
CORE_ADDR unpack_pointer(struct type *type, const gdb_byte *valaddr)
CORE_ADDR value_as_address(struct value *val)
int compile_internalvar_to_ax(struct internalvar *var, struct agent_expr *expr, struct axs_value *value)
struct value * value_from_contents_and_address_unresolved(struct type *, const gdb_byte *, CORE_ADDR)
const char * internalvar_name(const struct internalvar *var)
struct internalvar * create_internalvar(const char *name)
struct value * value_from_ulongest(struct type *type, ULONGEST num)
const char * value_internal_function_name(struct value *)
void error_value_optimized_out(void)
int get_internalvar_integer(struct internalvar *var, LONGEST *l)
struct value * value_static_field(struct type *type, int fieldno)
struct internalvar * create_internalvar_type_lazy(const char *name, const struct internalvar_funcs *funcs, void *data)
struct value * value_full_object(struct value *, struct type *, int, int, int)
struct internalvar * lookup_only_internalvar(const char *name)
ULONGEST value_history_count()
int unpack_value_field_as_long(struct type *type, const gdb_byte *valaddr, LONGEST embedded_offset, int fieldno, const struct value *val, LONGEST *result)
struct value * value_from_longest(struct type *type, LONGEST num)
struct value * value_from_history_ref(const char *, const char **)
struct value * make_cv_value(int, int, struct value *)
struct value * value_coerce_array(struct value *arg1)
LONGEST parse_and_eval_long(const char *exp)
#define VALUE_REGNUM(val)
void add_internal_function(const char *name, const char *doc, internal_function_fn handler, void *cookie)
void set_internalvar(struct internalvar *var, struct value *val)
void complete_internalvar(completion_tracker &tracker, const char *name)
void preserve_values(struct objfile *)
struct value * value_of_variable(struct symbol *var, const struct block *b)
struct value * value_addr(struct value *arg1)
struct value * value_at_lazy(struct type *type, CORE_ADDR addr, frame_info_ptr frame=nullptr)
#define VALUE_INTERNALVAR(val)
struct internalvar * lookup_internalvar(const char *name)
struct value * value_fn_field(struct value **arg1p, struct fn_field *f, int j, struct type *type, LONGEST offset)
LONGEST value_as_long(struct value *val)
struct value * value_cast(struct type *type, struct value *arg2)
void modify_field(struct type *type, gdb_byte *addr, LONGEST fieldval, LONGEST bitpos, LONGEST bitsize)
struct value * coerce_ref(struct value *value)
gdb_mpz value_as_mpz(struct value *val)
struct value * value_from_mpz(struct type *type, const gdb_mpz &v)
void pack_long(gdb_byte *buf, struct type *type, LONGEST num)
void set_internalvar_integer(struct internalvar *var, LONGEST l)
struct type * value_rtti_indirect_type(struct value *, int *, LONGEST *, int *)
struct value * value_real_part(struct value *value)
bool exceeds_max_value_size(ULONGEST length)
struct value * call_internal_function(struct gdbarch *gdbarch, const struct language_defn *language, struct value *function, int argc, struct value **argv)
struct value * value_from_host_double(struct type *type, double d)
struct value * value_field_bitfield(struct type *type, int fieldno, const gdb_byte *valaddr, LONGEST embedded_offset, const struct value *val)
struct value * value_coerce_function(struct value *arg1)
std::vector< value_ref_ptr > value_release_to_mark(const struct value *mark)
struct value * value_from_pointer(struct type *type, CORE_ADDR addr)
struct type * value_actual_type(struct value *value, int resolve_simple_types, int *real_type_found)
struct value * value_ind(struct value *arg1)
struct value * value_mark(void)
struct value * value_from_contents_and_address(struct type *, const gdb_byte *, CORE_ADDR, frame_info_ptr frame=nullptr)
struct value * access_value_history(int num)
void value_free_to_mark(const struct value *mark)
LONGEST unpack_bits_as_long(struct type *field_type, const gdb_byte *valaddr, LONGEST bitpos, LONGEST bitsize)
value_ref_ptr release_value(struct value *val)
struct value * value_from_component(struct value *, struct type *, LONGEST)
struct value *(* internal_function_fn)(struct gdbarch *gdbarch, const struct language_defn *language, void *cookie, int argc, struct value **argv)
struct value * coerce_array(struct value *value)
int using_struct_return(struct gdbarch *gdbarch, struct value *function, struct type *value_type)
struct value * allocate_repeat_value(struct type *type, int count)
gdb::ref_ptr< struct value, value_ref_policy > value_ref_ptr
void set_internalvar_component(struct internalvar *var, LONGEST offset, LONGEST bitpos, LONGEST bitsize, struct value *newvalue)
struct value * value_imaginary_part(struct value *value)
LONGEST unpack_field_as_long(struct type *type, const gdb_byte *valaddr, int fieldno)
LONGEST unpack_long(struct type *type, const gdb_byte *valaddr)
void all_root_varobjs(gdb::function_view< void(struct varobj *var)> func)