+2016-06-24 David Taylor <dtaylor@emc.com>
+
+ PR gdb/17520 Structure offset wrong when 1/4 GB or greater.
+ * c-lang.h: Change all parameters, variables, and struct or union
+ members used as struct or union fie3ld offsets from int to
+ LONGEST.
+ * c-valprint.c: Likewise.
+ * cp-abi.c: Likewise.
+ * cp-abi.h: Likewise.
+ * cp-valprint.c: Likewise.
+ * d-valprint.c: Likewise.
+ * dwarf2loc.c: Likewise.
+ * eval.c: Likewise.
+ * extension-priv.h: Likewise.
+ * extension.c: Likewise.
+ * extension.h: Likewise.
+ * findvar.c: Likewise.
+ * gdbtypes.h: Likewise.
+ * gnu-v2-abi.c: Likewise.
+ * gnu-v3-abi.c: Likewise.
+ * go-valprint.c: Likewise.
+ * guile/guile-internal.h: Likewise.
+ * guile/scm-pretty-print.c: Likewise.
+ * jv-valprint.c Likewise.
+ * opencl-lang.c: Likewise.
+ * p-lang.h: Likewise.
+ * python/py-prettyprint.c: Likewise.
+ * python/python-internal.h: Likewise.
+ * spu-tdep.c: Likewise.
+ * typeprint.c: Likewise.
+ * valarith.c: Likewise.
+ * valops.c: Likewise.
+ * valprint.c: Likewise.
+ * valprint.h: Likewise.
+ * value.c: Likewise.
+ * value.h: Likewise.
+ * p-valprint.c: Likewise.
+ * c-typeprint.c (c_type_print_base): When printing offset, use
+ plongest, not %d.
+ * gdbtypes.c (recursive_dump_type): Ditto.
+
2016-06-24 David Taylor <david.taylor@emc.com>
* MAINTAINERS (Write After Approval): Add David Taylor.
struct ui_file *, char *);
extern void cp_print_value_fields (struct type *, struct type *,
- const gdb_byte *, int, CORE_ADDR,
+ const gdb_byte *, LONGEST, CORE_ADDR,
struct ui_file *, int,
const struct value *,
const struct value_print_options *,
struct type **, int);
extern void cp_print_value_fields_rtti (struct type *,
- const gdb_byte *, int, CORE_ADDR,
+ const gdb_byte *, LONGEST, CORE_ADDR,
struct ui_file *, int,
const struct value *,
const struct value_print_options *,
TYPE_FIELD_NAME (type, i),
stream, show, level + 4,
&local_flags);
- fprintf_filtered (stream, " @%d",
- TYPE_FIELD_BITPOS (type, i));
+ fprintf_filtered (stream, " @%s",
+ plongest (TYPE_FIELD_BITPOS (type, i)));
if (TYPE_FIELD_BITSIZE (type, i) > 1)
{
- fprintf_filtered (stream, "-%d",
- TYPE_FIELD_BITPOS (type, i)
- + TYPE_FIELD_BITSIZE (type, i) - 1);
+ fprintf_filtered (stream, "-%s",
+ plongest (TYPE_FIELD_BITPOS (type, i)
+ + TYPE_FIELD_BITSIZE (type, i)
+ - 1));
}
fprintf_filtered (stream, ";\n");
}
const struct value_print_options *options)
{
struct type *type, *real_type, *val_type;
- int full, top, using_enc;
+ int full, using_enc;
+ LONGEST top;
struct value_print_options opts = *options;
opts.deref_ref = 1;
int
baseclass_offset (struct type *type, int index, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
+ LONGEST embedded_offset, CORE_ADDR address,
const struct value *val)
{
int res = 0;
struct type *
value_rtti_type (struct value *v, int *full,
- int *top, int *using_enc)
+ LONGEST *top, int *using_enc)
{
struct type *ret = NULL;
FULL, TOP, and USING_ENC can each be zero, in which case we don't
provide the corresponding piece of information. */
extern struct type *value_rtti_type (struct value *value,
- int *full, int *top,
+ int *full, LONGEST *top,
int *using_enc);
/* Compute the offset of the baseclass which is the INDEXth baseclass
extern int baseclass_offset (struct type *type,
int index, const gdb_byte *valaddr,
- int embedded_offset,
+ LONGEST embedded_offset,
CORE_ADDR address,
const struct value *val);
int j, struct type * type,
int offset);
struct type *(*rtti_type) (struct value *v, int *full,
- int *top, int *using_enc);
+ LONGEST *top, int *using_enc);
int (*baseclass_offset) (struct type *type, int index,
- const bfd_byte *valaddr, int embedded_offset,
+ const bfd_byte *valaddr, LONGEST embedded_offset,
CORE_ADDR address, const struct value *val);
void (*print_method_ptr) (const gdb_byte *contents,
struct type *type,
const struct value_print_options *);
static void cp_print_value (struct type *, struct type *,
- const gdb_byte *, int,
+ const gdb_byte *, LONGEST,
CORE_ADDR, struct ui_file *,
int, const struct value *,
const struct value_print_options *,
void
cp_print_value_fields (struct type *type, struct type *real_type,
- const gdb_byte *valaddr, int offset,
+ const gdb_byte *valaddr, LONGEST offset,
CORE_ADDR address, struct ui_file *stream,
int recurse, const struct value *val,
const struct value_print_options *options,
void
cp_print_value_fields_rtti (struct type *type,
- const gdb_byte *valaddr, int offset,
+ const gdb_byte *valaddr, LONGEST offset,
CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
TARGET_CHAR_BIT * TYPE_LENGTH (type)))
{
struct value *value;
- int full, top, using_enc;
+ int full, using_enc;
+ LONGEST top;
/* Ugh, we have to convert back to a value here. */
value = value_from_contents_and_address (type, valaddr + offset,
static void
cp_print_value (struct type *type, struct type *real_type,
- const gdb_byte *valaddr, int offset,
+ const gdb_byte *valaddr, LONGEST offset,
CORE_ADDR address, struct ui_file *stream,
int recurse, const struct value *val,
const struct value_print_options *options,
= (struct type **) obstack_next_free (&dont_print_vb_obstack);
struct obstack tmp_obstack = dont_print_vb_obstack;
int i, n_baseclasses = TYPE_N_BASECLASSES (type);
- int thisoffset;
+ LONGEST thisoffset;
struct type *thistype;
if (dont_print_vb == 0)
for (i = 0; i < n_baseclasses; i++)
{
- int boffset = 0;
+ LONGEST boffset = 0;
int skip = 0;
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
const char *basename = TYPE_NAME (baseclass);
static int
dynamic_array_type (struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
+ LONGEST embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
const struct value_print_options *options)
struct gdbarch *arch = get_frame_arch (frame);
int gdb_regnum = dwarf_reg_to_regnum_or_error (arch, p->v.regno);
int optim, unavail;
- int reg_offset = source_offset;
+ LONGEST reg_offset = source_offset;
if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
&& this_size < register_size (arch, gdb_regnum))
a synthetic pointer. */
static int
-check_pieced_synthetic_pointer (const struct value *value, int bit_offset,
+check_pieced_synthetic_pointer (const struct value *value, LONGEST bit_offset,
int bit_length)
{
struct piece_closure *c
struct type *type;
struct frame_info *frame;
struct dwarf2_locexpr_baton baton;
- int i, bit_offset, bit_length;
+ int i, bit_length;
+ LONGEST bit_offset;
struct dwarf_expr_piece *piece = NULL;
LONGEST byte_offset;
enum bfd_endian byte_order;
{
struct type *type = value_type (arg1);
struct type *real_type;
- int full, top, using_enc;
+ int full, using_enc;
+ LONGEST top;
struct value_print_options opts;
get_user_print_options (&opts);
enum ext_lang_rc (*apply_val_pretty_printer)
(const struct extension_language_defn *,
struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
+ LONGEST embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val, const struct value_print_options *options,
const struct language_defn *language);
int
apply_ext_lang_val_pretty_printer (struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
+ LONGEST embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
const struct value_print_options *options,
extern int apply_ext_lang_val_pretty_printer
(struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
+ LONGEST embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val, const struct value_print_options *options,
const struct language_defn *language);
read_frame_register_value (struct value *value, struct frame_info *frame)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
- int offset = 0;
- int reg_offset = value_offset (value);
+ LONGEST offset = 0;
+ LONGEST reg_offset = value_offset (value);
int regnum = VALUE_REGNUM (value);
int len = type_length_units (check_typedef (value_type (value)));
idx, plongest (TYPE_FIELD_ENUMVAL (type, idx)));
else
printfi_filtered (spaces + 2,
- "[%d] bitpos %d bitsize %d type ",
- idx, TYPE_FIELD_BITPOS (type, idx),
+ "[%d] bitpos %s bitsize %d type ",
+ idx, plongest (TYPE_FIELD_BITPOS (type, idx)),
TYPE_FIELD_BITSIZE (type, idx));
gdb_print_host_address (TYPE_FIELD_TYPE (type, idx), gdb_stdout);
printf_filtered (" name '%s' (",
gdbarch_bits_big_endian=0 targets, it is the bit offset to
the LSB. */
- int bitpos;
+ LONGEST bitpos;
/* * Enum value. */
LONGEST enumval;
static struct type *
-gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
+gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, int *using_enc)
{
struct type *known_type;
struct type *rtti_type;
static int
gnuv2_baseclass_offset (struct type *type, int index,
- const bfd_byte *valaddr, int embedded_offset,
+ const bfd_byte *valaddr, LONGEST embedded_offset,
CORE_ADDR address, const struct value *val)
{
struct type *basetype = TYPE_BASECLASS (type, index);
if (vb_match (type, i, basetype))
{
struct type *field_type;
- int field_offset;
+ LONGEST field_offset;
int field_length;
CORE_ADDR addr;
static struct type *
gnuv3_rtti_type (struct value *value,
- int *full_p, int *top_p, int *using_enc_p)
+ int *full_p, LONGEST *top_p, int *using_enc_p)
{
struct gdbarch *gdbarch;
struct type *values_type = check_typedef (value_type (value));
static int
gnuv3_baseclass_offset (struct type *type, int index,
- const bfd_byte *valaddr, int embedded_offset,
+ const bfd_byte *valaddr, LONGEST embedded_offset,
CORE_ADDR address, const struct value *val)
{
struct gdbarch *gdbarch;
static void
print_go_string (struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
+ LONGEST embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
const struct value_print_options *options)
extern enum ext_lang_rc gdbscm_apply_val_pretty_printer
(const struct extension_language_defn *,
struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
+ LONGEST embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
const struct value_print_options *options,
enum ext_lang_rc
gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
+ LONGEST embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
const struct value_print_options *options,
static void
java_print_value_fields (struct type *type, const gdb_byte *valaddr,
- int offset,
+ LONGEST offset,
CORE_ADDR address, struct ui_file *stream,
int recurse,
const struct value *val,
struct lval_closure *c = (struct lval_closure *) value_computed_closure (v);
struct type *type = check_typedef (value_type (v));
struct type *eltype = TYPE_TARGET_TYPE (check_typedef (value_type (c->val)));
- int offset = value_offset (v);
- int elsize = TYPE_LENGTH (eltype);
+ LONGEST offset = value_offset (v);
+ LONGEST elsize = TYPE_LENGTH (eltype);
int n, i, j = 0;
LONGEST lowb = 0;
LONGEST highb = 0;
struct lval_closure *c = (struct lval_closure *) value_computed_closure (v);
struct type *type = check_typedef (value_type (v));
struct type *eltype = TYPE_TARGET_TYPE (check_typedef (value_type (c->val)));
- int offset = value_offset (v);
- int elsize = TYPE_LENGTH (eltype);
+ LONGEST offset = value_offset (v);
+ LONGEST elsize = TYPE_LENGTH (eltype);
int n, i, j = 0;
LONGEST lowb = 0;
LONGEST highb = 0;
static int
lval_func_check_synthetic_pointer (const struct value *v,
- int offset, int length)
+ LONGEST offset, int length)
{
struct lval_closure *c = (struct lval_closure *) value_computed_closure (v);
/* Size of the target type in bits. */
const struct type_print_options *);
extern void pascal_object_print_value_fields (struct type *, const gdb_byte *,
- int,
+ LONGEST,
CORE_ADDR, struct ui_file *,
int,
const struct value *,
const struct value_print_options *);
static void pascal_object_print_value (struct type *, const gdb_byte *,
- int,
+ LONGEST,
CORE_ADDR, struct ui_file *, int,
const struct value *,
const struct value_print_options *,
void
pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
- int offset,
+ LONGEST offset,
CORE_ADDR address, struct ui_file *stream,
int recurse,
const struct value *val,
static void
pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
- int offset,
+ LONGEST offset,
CORE_ADDR address, struct ui_file *stream,
int recurse,
const struct value *val,
for (i = 0; i < n_baseclasses; i++)
{
- int boffset = 0;
+ LONGEST boffset = 0;
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
const char *basename = type_name_no_tag (baseclass);
const gdb_byte *base_valaddr = NULL;
- int thisoffset;
+ LONGEST thisoffset;
int skip = 0;
if (BASETYPE_VIA_VIRTUAL (type, i))
enum ext_lang_rc
gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
+ LONGEST embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
const struct value_print_options *options,
extern enum ext_lang_rc gdbpy_apply_val_pretty_printer
(const struct extension_language_defn *,
struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
+ LONGEST embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
const struct value_print_options *options,
{
struct value *value = default_value_from_register (gdbarch, type,
regnum, frame_id);
- int len = TYPE_LENGTH (type);
+ LONGEST len = TYPE_LENGTH (type);
if (regnum < SPU_NUM_GPRS && len < 16)
{
+2016-06-24 David Taylor <dtaylor@emc.com>
+
+ * gdb.base/offsets.exp: New file.
+ * gdb.base/offsets.c: New file.
+
2016-06-23 Tom Tromey <tom@tromey.com>
PR gdb/16483:
--- /dev/null
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2014 - 2016 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+struct big_struct
+{
+ char first[0x10000000 + 16];
+ long second;
+} big_struct;
+
+int
+main (int argc, char *argv[])
+{
+ return (0);
+}
--- /dev/null
+# Test big offsets
+
+# Copyright (c) 2014- 2016 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile offsets.c
+
+if { [prepare_for_testing "failed to prepare for testing large offsets" \
+ ${testfile} ${srcfile}] } {
+ untested offsets.exp
+ return -1
+}
+
+set test "print &big_struct test"
+gdb_test_multiple "print &big_struct" "$test" {
+ -re "\\$\[0-9\]* = .* (0x\[0-9a-fA-F\]*) .*\[\r\n\]*$gdb_prompt $" {
+ set addr1 $expect_out(1,string)
+ pass "$test ($addr1)"
+ }
+}
+
+set test "print &big_struct.second test"
+gdb_test_multiple "print &big_struct.second" "$test" {
+ -re "\\$\[0-9\]* = .* (0x\[0-9a-fA-F\]*) .*\[\r\n\]*$gdb_prompt $" {
+ set addr2 $expect_out(1,string)
+
+ if {[expr $addr2 - $addr1] == [expr 0x10000000 + 16]} {
+ pass "big offsets"
+ } else {
+ fail "big offsets"
+ }
+ }
+}
struct type *real_type = NULL;
struct type *type;
int full = 0;
- int top = -1;
+ LONGEST top = -1;
int using_enc = 0;
struct value_print_options opts;
struct type_print_options flags = default_ptype_flags;
{
struct type *array_type = check_typedef (value_type (array));
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
- unsigned int elt_size = type_length_units (elt_type);
- unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound);
+ ULONGEST elt_size = type_length_units (elt_type);
+ ULONGEST elt_offs = elt_size * (index - lowerbound);
struct value *v;
if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
static struct value *search_struct_method (const char *, struct value **,
struct value **,
- int, int *, struct type *);
+ LONGEST, int *, struct type *);
static int find_oload_champ_namespace (struct value **, int,
const char *, const char *,
static struct value *cast_into_complex (struct type *, struct value *);
static void find_method_list (struct value **, const char *,
- int, struct type *, struct fn_field **, int *,
+ LONGEST, struct type *, struct fn_field **, int *,
VEC (xmethod_worker_ptr) **,
- struct type **, int *);
+ struct type **, LONGEST *);
void _initialize_valops (void);
if (TYPE_NAME (t2) != NULL)
{
/* Try downcasting using the run-time type of the value. */
- int full, top, using_enc;
+ int full, using_enc;
+ LONGEST top;
struct type *real_type;
real_type = value_rtti_type (v2, &full, &top, &using_enc);
static int
dynamic_cast_check_1 (struct type *desired_type,
const gdb_byte *valaddr,
- int embedded_offset,
+ LONGEST embedded_offset,
CORE_ADDR address,
struct value *val,
struct type *search_type,
for (i = 0; i < TYPE_N_BASECLASSES (search_type) && result_count < 2; ++i)
{
- int offset = baseclass_offset (search_type, i, valaddr, embedded_offset,
- address, val);
+ LONGEST offset = baseclass_offset (search_type, i, valaddr,
+ embedded_offset,
+ address, val);
if (class_types_same_p (desired_type, TYPE_BASECLASS (search_type, i)))
{
static int
dynamic_cast_check_2 (struct type *desired_type,
const gdb_byte *valaddr,
- int embedded_offset,
+ LONGEST embedded_offset,
CORE_ADDR address,
struct value *val,
struct type *search_type,
for (i = 0; i < TYPE_N_BASECLASSES (search_type) && result_count < 2; ++i)
{
- int offset;
+ LONGEST offset;
if (! BASETYPE_VIA_PUBLIC (search_type, i))
continue;
struct value *
value_dynamic_cast (struct type *type, struct value *arg)
{
- int full, top, using_enc;
+ int full, using_enc;
+ LONGEST top;
struct type *resolved_type = check_typedef (type);
struct type *arg_type = check_typedef (value_type (arg));
struct type *class_type, *rtti_type;
}
void
-read_value_memory (struct value *val, int embedded_offset,
+read_value_memory (struct value *val, LONGEST embedded_offset,
int stack, CORE_ADDR memaddr,
gdb_byte *buffer, size_t length)
{
case lval_internalvar_component:
{
- int offset = value_offset (toval);
+ LONGEST offset = value_offset (toval);
/* Are we dealing with a bitfield?
if (value_bitsize (toval))
{
struct value *parent = value_parent (toval);
- int offset = value_offset (parent) + value_offset (toval);
+ LONGEST offset = value_offset (parent) + value_offset (toval);
int changed_len;
gdb_byte buffer[sizeof (LONGEST)];
int optim, unavail;
{
int nelem;
int idx;
- unsigned int typelength;
+ ULONGEST typelength;
struct value *val;
struct type *arraytype;
static void
update_search_result (struct value **result_ptr, struct value *v,
- int *last_boffset, int boffset,
+ LONGEST *last_boffset, LONGEST boffset,
const char *name, struct type *type)
{
if (v != NULL)
lookup is ambiguous. */
static void
-do_search_struct_field (const char *name, struct value *arg1, int offset,
+do_search_struct_field (const char *name, struct value *arg1, LONGEST offset,
struct type *type, int looking_for_baseclass,
struct value **result_ptr,
- int *last_boffset,
+ LONGEST *last_boffset,
struct type *outermost_type)
{
int i;
<variant field>. */
struct value *v = NULL;
- int new_offset = offset;
+ LONGEST new_offset = offset;
/* This is pretty gross. In G++, the offset in an
anonymous union is relative to the beginning of the
&& (strcmp_iw (name,
TYPE_BASECLASS_NAME (type,
i)) == 0));
- int boffset = value_embedded_offset (arg1) + offset;
+ LONGEST boffset = value_embedded_offset (arg1) + offset;
if (BASETYPE_VIA_VIRTUAL (type, i))
{
struct type *type, int looking_for_baseclass)
{
struct value *result = NULL;
- int boffset = 0;
+ LONGEST boffset = 0;
do_search_struct_field (name, arg1, 0, type, looking_for_baseclass,
&result, &boffset, type);
static struct value *
search_struct_method (const char *name, struct value **arg1p,
- struct value **args, int offset,
+ struct value **args, LONGEST offset,
int *static_memfuncp, struct type *type)
{
int i;
for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--)
{
- int base_offset;
- int this_offset;
+ LONGEST base_offset;
+ LONGEST this_offset;
if (BASETYPE_VIA_VIRTUAL (type, i))
{
static void
find_method_list (struct value **argp, const char *method,
- int offset, struct type *type,
+ LONGEST offset, struct type *type,
struct fn_field **fn_list, int *num_fns,
VEC (xmethod_worker_ptr) **xm_worker_vec,
- struct type **basetype, int *boffset)
+ struct type **basetype, LONGEST *boffset)
{
int i;
struct fn_field *f = NULL;
extension methods. */
for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--)
{
- int base_offset;
+ LONGEST base_offset;
if (BASETYPE_VIA_VIRTUAL (type, i))
{
static void
value_find_oload_method_list (struct value **argp, const char *method,
- int offset, struct fn_field **fn_list,
+ LONGEST offset, struct fn_field **fn_list,
int *num_fns,
VEC (xmethod_worker_ptr) **xm_worker_vec,
- struct type **basetype, int *boffset)
+ struct type **basetype, LONGEST *boffset)
{
struct type *t;
/* Number of overloaded instances being considered. */
int num_fns = 0;
struct type *basetype = NULL;
- int boffset;
+ LONGEST boffset;
struct cleanup *all_cleanups = make_cleanup (null_cleanup, NULL);
struct type *
value_rtti_indirect_type (struct value *v, int *full,
- int *top, int *using_enc)
+ LONGEST *top, int *using_enc)
{
struct value *target = NULL;
struct type *type, *real_type, *target_type;
{
struct type *real_type;
int full = 0;
- int top = -1;
+ LONGEST top = -1;
int using_enc = 0;
struct value *new_val;
int
valprint_check_validity (struct ui_file *stream,
struct type *type,
- int embedded_offset,
+ LONGEST embedded_offset,
const struct value *val)
{
type = check_typedef (type);
RECURSE. */
void
-val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
+val_print (struct type *type, const gdb_byte *valaddr, LONGEST embedded_offset,
CORE_ADDR address, struct ui_file *stream, int recurse,
const struct value *val,
const struct value_print_options *options,
void
val_print_scalar_formatted (struct type *type,
- const gdb_byte *valaddr, int embedded_offset,
+ const gdb_byte *valaddr, LONGEST embedded_offset,
const struct value *val,
const struct value_print_options *options,
int size,
void
val_print_array_elements (struct type *type,
- const gdb_byte *valaddr, int embedded_offset,
+ const gdb_byte *valaddr, LONGEST embedded_offset,
CORE_ADDR address, struct ui_file *stream,
int recurse,
const struct value *val,
struct ui_file *stream,
const struct value_print_options *);
-extern void val_print_array_elements (struct type *, const gdb_byte *, int,
+extern void val_print_array_elements (struct type *, const gdb_byte *, LONGEST,
CORE_ADDR, struct ui_file *, int,
const struct value *,
const struct value_print_options *,
struct ui_file *);
extern void val_print_scalar_formatted (struct type *,
- const gdb_byte *, int,
+ const gdb_byte *, LONGEST,
const struct value *,
const struct value_print_options *,
int,
struct range
{
/* Lowest offset in the range. */
- int offset;
+ LONGEST offset;
/* Length of the range. */
- int length;
+ LONGEST length;
};
typedef struct range range_s;
[offset2, offset2+len2) overlap. */
static int
-ranges_overlap (int offset1, int len1,
- int offset2, int len2)
+ranges_overlap (LONGEST offset1, LONGEST len1,
+ LONGEST offset2, LONGEST len2)
{
ULONGEST h, l;
OFFSET+LENGTH). */
static int
-ranges_contain (VEC(range_s) *ranges, int offset, int length)
+ranges_contain (VEC(range_s) *ranges, LONGEST offset, LONGEST length)
{
range_s what;
- int i;
+ LONGEST i;
what.offset = offset;
what.length = length;
the address. If lval == lval_register, this is a further offset from
location.address within the registers structure. Note also the member
embedded_offset below. */
- int offset;
+ LONGEST offset;
/* Only used for bitfields; number of bits contained in them. */
- int bitsize;
+ LONGEST bitsize;
/* Only used for bitfields; position of start of field. For
gdbarch_bits_big_endian=0 targets, it is the position of the LSB. For
gdbarch_bits_big_endian=1 targets, it is the position of the MSB. */
- int bitpos;
+ LONGEST bitpos;
/* The number of references to this value. When a value is created,
the value chain holds a reference, so REFERENCE_COUNT is 1. If
`type', and `embedded_offset' is zero, so everything works
normally. */
struct type *enclosing_type;
- int embedded_offset;
- int pointed_to_offset;
+ LONGEST embedded_offset;
+ LONGEST pointed_to_offset;
/* Values are stored in a chain, so that they can be deleted easily
over calls to the inferior. Values assigned to internal
}
int
-value_bits_available (const struct value *value, int offset, int length)
+value_bits_available (const struct value *value, LONGEST offset, LONGEST length)
{
gdb_assert (!value->lazy);
}
int
-value_bytes_available (const struct value *value, int offset, int length)
+value_bytes_available (const struct value *value,
+ LONGEST offset, LONGEST length)
{
return value_bits_available (value,
offset * TARGET_CHAR_BIT,
OFFSET bits, and extending for the next LENGTH bits. */
static void
-insert_into_bit_range_vector (VEC(range_s) **vectorp, int offset, int length)
+insert_into_bit_range_vector (VEC(range_s) **vectorp,
+ LONGEST offset, LONGEST length)
{
range_s newr;
int i;
}
void
-mark_value_bits_unavailable (struct value *value, int offset, int length)
+mark_value_bits_unavailable (struct value *value,
+ LONGEST offset, LONGEST length)
{
insert_into_bit_range_vector (&value->unavailable, offset, length);
}
void
-mark_value_bytes_unavailable (struct value *value, int offset, int length)
+mark_value_bytes_unavailable (struct value *value,
+ LONGEST offset, LONGEST length)
{
mark_value_bits_unavailable (value,
offset * TARGET_CHAR_BIT,
static int
find_first_range_overlap (VEC(range_s) *ranges, int pos,
- int offset, int length)
+ LONGEST offset, LONGEST length)
{
range_s *r;
int i;
static int
find_first_range_overlap_and_match (struct ranges_and_idx *rp1,
struct ranges_and_idx *rp2,
- int offset1, int offset2,
- int length, ULONGEST *l, ULONGEST *h)
+ LONGEST offset1, LONGEST offset2,
+ LONGEST length, ULONGEST *l, ULONGEST *h)
{
rp1->idx = find_first_range_overlap (rp1->ranges, rp1->idx,
offset1, length);
}
int
-value_contents_eq (const struct value *val1, int offset1,
- const struct value *val2, int offset2,
- int length)
+value_contents_eq (const struct value *val1, LONGEST offset1,
+ const struct value *val2, LONGEST offset2,
+ LONGEST length)
{
return value_contents_bits_eq (val1, offset1 * TARGET_CHAR_BIT,
val2, offset2 * TARGET_CHAR_BIT,
value->type = type;
}
-int
+LONGEST
value_offset (const struct value *value)
{
return value->offset;
}
void
-set_value_offset (struct value *value, int offset)
+set_value_offset (struct value *value, LONGEST offset)
{
value->offset = offset;
}
-int
+LONGEST
value_bitpos (const struct value *value)
{
return value->bitpos;
}
void
-set_value_bitpos (struct value *value, int bit)
+set_value_bitpos (struct value *value, LONGEST bit)
{
value->bitpos = bit;
}
-int
+LONGEST
value_bitsize (const struct value *value)
{
return value->bitsize;
}
void
-set_value_bitsize (struct value *value, int bit)
+set_value_bitsize (struct value *value, LONGEST bit)
{
value->bitsize = bit;
}
DST_OFFSET+LENGTH) range are wholly available. */
void
-value_contents_copy_raw (struct value *dst, int dst_offset,
- struct value *src, int src_offset, int length)
+value_contents_copy_raw (struct value *dst, LONGEST dst_offset,
+ struct value *src, LONGEST src_offset, LONGEST length)
{
- int src_bit_offset, dst_bit_offset, bit_length;
+ LONGEST src_bit_offset, dst_bit_offset, bit_length;
struct gdbarch *arch = get_value_arch (src);
int unit_size = gdbarch_addressable_memory_unit_size (arch);
DST_OFFSET+LENGTH) range are wholly available. */
void
-value_contents_copy (struct value *dst, int dst_offset,
- struct value *src, int src_offset, int length)
+value_contents_copy (struct value *dst, LONGEST dst_offset,
+ struct value *src, LONGEST src_offset, LONGEST length)
{
if (src->lazy)
value_fetch_lazy (src);
/* See value.h. */
void
-mark_value_bits_optimized_out (struct value *value, int offset, int length)
+mark_value_bits_optimized_out (struct value *value,
+ LONGEST offset, LONGEST length)
{
insert_into_bit_range_vector (&value->optimized_out, offset, length);
}
int
value_bits_synthetic_pointer (const struct value *value,
- int offset, int length)
+ LONGEST offset, LONGEST length)
{
if (value->lval != lval_computed
|| !value->location.computed.funcs->check_synthetic_pointer)
length);
}
-int
+LONGEST
value_embedded_offset (const struct value *value)
{
return value->embedded_offset;
}
void
-set_value_embedded_offset (struct value *value, int val)
+set_value_embedded_offset (struct value *value, LONGEST val)
{
value->embedded_offset = val;
}
-int
+LONGEST
value_pointed_to_offset (const struct value *value)
{
return value->pointed_to_offset;
}
void
-set_value_pointed_to_offset (struct value *value, int val)
+set_value_pointed_to_offset (struct value *value, LONGEST val)
{
value->pointed_to_offset = val;
}
}
void
-set_internalvar_component (struct internalvar *var, int offset, int bitpos,
- int bitsize, struct value *newval)
+set_internalvar_component (struct internalvar *var,
+ LONGEST offset, LONGEST bitpos,
+ LONGEST bitsize, struct value *newval)
{
gdb_byte *addr;
struct gdbarch *arch;
FIELDNO says which field. */
struct value *
-value_primitive_field (struct value *arg1, int offset,
+value_primitive_field (struct value *arg1, LONGEST offset,
int fieldno, struct type *arg_type)
{
struct value *v;
bit. Assume that the address, offset, and embedded offset
are sufficiently aligned. */
- int bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno);
- int container_bitsize = TYPE_LENGTH (type) * 8;
+ LONGEST bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno);
+ LONGEST container_bitsize = TYPE_LENGTH (type) * 8;
v = allocate_value_lazy (type);
v->bitsize = TYPE_FIELD_BITSIZE (arg_type, fieldno);
/* This field is actually a base subobject, so preserve the
entire object's contents for later references to virtual
bases, etc. */
- int boffset;
+ LONGEST boffset;
/* Lazy register values with offsets are not supported. */
if (VALUE_LVAL (arg1) == lval_register && value_lazy (arg1))
struct value *
value_fn_field (struct value **arg1p, struct fn_field *f,
int j, struct type *type,
- int offset)
+ LONGEST offset)
{
struct value *v;
struct type *ftype = TYPE_FN_FIELD_TYPE (f, j);
static LONGEST
unpack_bits_as_long (struct type *field_type, const gdb_byte *valaddr,
- int bitpos, int bitsize)
+ LONGEST bitpos, LONGEST bitsize)
{
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (field_type));
ULONGEST val;
ULONGEST valmask;
int lsbcount;
- int bytes_read;
- int read_offset;
+ LONGEST bytes_read;
+ LONGEST read_offset;
/* Read the minimum number of bytes required; there may not be
enough bytes to read an entire ULONGEST. */
int
unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr,
- int embedded_offset, int fieldno,
+ LONGEST embedded_offset, int fieldno,
const struct value *val, LONGEST *result)
{
int bitpos = TYPE_FIELD_BITPOS (type, fieldno);
void
unpack_value_bitfield (struct value *dest_val,
- int bitpos, int bitsize,
- const gdb_byte *valaddr, int embedded_offset,
+ LONGEST bitpos, LONGEST bitsize,
+ const gdb_byte *valaddr, LONGEST embedded_offset,
const struct value *val)
{
enum bfd_endian byte_order;
struct value *
value_field_bitfield (struct type *type, int fieldno,
const gdb_byte *valaddr,
- int embedded_offset, const struct value *val)
+ LONGEST embedded_offset, const struct value *val)
{
int bitpos = TYPE_FIELD_BITPOS (type, fieldno);
int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
void
modify_field (struct type *type, gdb_byte *addr,
- LONGEST fieldval, int bitpos, int bitsize)
+ LONGEST fieldval, LONGEST bitpos, LONGEST bitsize)
{
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
ULONGEST oword;
ULONGEST mask = (ULONGEST) -1 >> (8 * sizeof (ULONGEST) - bitsize);
- int bytesize;
+ LONGEST bytesize;
/* Normalize BITPOS. */
addr += bitpos / 8;
{
/* FIXME: would like to include fieldval in the message, but
we don't have a sprintf_longest. */
- warning (_("Value does not fit in %d bits."), bitsize);
+ warning (_("Value does not fit in %s bits."), plongest (bitsize));
/* Truncate it, otherwise adjoining fields may be corrupted. */
fieldval &= mask;
pack_long (gdb_byte *buf, struct type *type, LONGEST num)
{
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
- int len;
+ LONGEST len;
type = check_typedef (type);
len = TYPE_LENGTH (type);
static void
pack_unsigned_long (gdb_byte *buf, struct type *type, ULONGEST num)
{
- int len;
+ LONGEST len;
enum bfd_endian byte_order;
type = check_typedef (type);
/* Only used for bitfields; number of bits contained in them. */
-extern int value_bitsize (const struct value *);
-extern void set_value_bitsize (struct value *, int bit);
+extern LONGEST value_bitsize (const struct value *);
+extern void set_value_bitsize (struct value *, LONGEST bit);
/* Only used for bitfields; position of start of field. For
gdbarch_bits_big_endian=0 targets, it is the position of the LSB. For
gdbarch_bits_big_endian=1 targets, it is the position of the MSB. */
-extern int value_bitpos (const struct value *);
-extern void set_value_bitpos (struct value *, int bit);
+extern LONGEST value_bitpos (const struct value *);
+extern void set_value_bitpos (struct value *, LONGEST bit);
/* Only used for bitfields; the containing value. This allows a
single read from the target when displaying multiple
within the registers structure. Note also the member
embedded_offset below. */
-extern int value_offset (const struct value *);
-extern void set_value_offset (struct value *, int offset);
+extern LONGEST value_offset (const struct value *);
+extern void set_value_offset (struct value *, LONGEST offset);
/* The comment from "struct value" reads: ``Is it modifiable? Only
relevant if lval != not_lval.''. Shouldn't the value instead be
int resolve_simple_types,
int *real_type_found);
-extern int value_pointed_to_offset (const struct value *value);
-extern void set_value_pointed_to_offset (struct value *value, int val);
-extern int value_embedded_offset (const struct value *value);
-extern void set_value_embedded_offset (struct value *value, int val);
+extern LONGEST value_pointed_to_offset (const struct value *value);
+extern void set_value_pointed_to_offset (struct value *value, LONGEST val);
+extern LONGEST value_embedded_offset (const struct value *value);
+extern void set_value_embedded_offset (struct value *value, LONGEST val);
/* For lval_computed values, this structure holds functions used to
retrieve and set the value (or portions of the value).
/* If non-NULL, this is used to determine whether the indicated bits
of VALUE are a synthetic pointer. */
int (*check_synthetic_pointer) (const struct value *value,
- int offset, int length);
+ LONGEST offset, int length);
/* Return a duplicate of VALUE's closure, for use in a new value.
This may simply return the same closure, if VALUE's is
Otherwise, return 1. */
extern int valprint_check_validity (struct ui_file *stream, struct type *type,
- int embedded_offset,
+ LONGEST embedded_offset,
const struct value *val);
extern struct value *allocate_optimized_out_value (struct type *type);
LENGTH bits as optimized out. */
extern void mark_value_bits_optimized_out (struct value *value,
- int offset, int length);
+ LONGEST offset, LONGEST length);
/* Set or return field indicating whether a variable is initialized or
not, based on debugging information supplied by the compiler.
extending for LENGTH bits are a synthetic pointer. */
extern int value_bits_synthetic_pointer (const struct value *value,
- int offset, int length);
+ LONGEST offset, LONGEST length);
/* Given a value, determine whether the contents bytes starting at
OFFSET and extending for LENGTH bytes are available. This returns
byte is unavailable. */
extern int value_bytes_available (const struct value *value,
- int offset, int length);
+ LONGEST offset, LONGEST length);
/* Given a value, determine whether the contents bits starting at
OFFSET and extending for LENGTH bits are available. This returns
bit is unavailable. */
extern int value_bits_available (const struct value *value,
- int offset, int length);
+ LONGEST offset, LONGEST length);
/* Like value_bytes_available, but return false if any byte in the
whole object is unavailable. */
LENGTH bytes as unavailable. */
extern void mark_value_bytes_unavailable (struct value *value,
- int offset, int length);
+ LONGEST offset, LONGEST length);
/* Mark VALUE's content bits starting at OFFSET and extending for
LENGTH bits as unavailable. */
extern void mark_value_bits_unavailable (struct value *value,
- int offset, int length);
+ LONGEST offset, LONGEST length);
/* Compare LENGTH bytes of VAL1's contents starting at OFFSET1 with
LENGTH bytes of VAL2's contents starting at OFFSET2.
after the inferior is gone, it works with const values. Therefore,
this routine must not be called with lazy values. */
-extern int value_contents_eq (const struct value *val1, int offset1,
- const struct value *val2, int offset2,
- int length);
+extern int value_contents_eq (const struct value *val1, LONGEST offset1,
+ const struct value *val2, LONGEST offset2,
+ LONGEST length);
/* Read LENGTH addressable memory units starting at MEMADDR into BUFFER,
which is (or will be copied to) VAL's contents buffer offset by
memory is likewise unavailable. STACK indicates whether the memory
is known to be stack memory. */
-extern void read_value_memory (struct value *val, int embedded_offset,
+extern void read_value_memory (struct value *val, LONGEST embedded_offset,
int stack, CORE_ADDR memaddr,
gdb_byte *buffer, size_t length);
const gdb_byte *valaddr,
int fieldno);
extern int unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr,
- int embedded_offset, int fieldno,
+ LONGEST embedded_offset, int fieldno,
const struct value *val, LONGEST *result);
extern void unpack_value_bitfield (struct value *dest_val,
- int bitpos, int bitsize,
- const gdb_byte *valaddr, int embedded_offset,
+ LONGEST bitpos, LONGEST bitsize,
+ const gdb_byte *valaddr,
+ LONGEST embedded_offset,
const struct value *val);
extern struct value *value_field_bitfield (struct type *type, int fieldno,
const gdb_byte *valaddr,
- int embedded_offset,
+ LONGEST embedded_offset,
const struct value *val);
extern void pack_long (gdb_byte *buf, struct type *type, LONGEST num);
extern struct value *allocate_value (struct type *type);
extern struct value *allocate_value_lazy (struct type *type);
-extern void value_contents_copy (struct value *dst, int dst_offset,
- struct value *src, int src_offset,
- int length);
-extern void value_contents_copy_raw (struct value *dst, int dst_offset,
- struct value *src, int src_offset,
- int length);
+extern void value_contents_copy (struct value *dst, LONGEST dst_offset,
+ struct value *src, LONGEST src_offset,
+ LONGEST length);
+extern void value_contents_copy_raw (struct value *dst, LONGEST dst_offset,
+ struct value *src, LONGEST src_offset,
+ LONGEST length);
extern struct value *allocate_repeat_value (struct type *type, int count);
extern struct value *value_field (struct value *arg1, int fieldno);
-extern struct value *value_primitive_field (struct value *arg1, int offset,
+extern struct value *value_primitive_field (struct value *arg1, LONGEST offset,
int fieldno,
struct type *arg_type);
-extern struct type *value_rtti_indirect_type (struct value *, int *, int *,
+extern struct type *value_rtti_indirect_type (struct value *, int *, LONGEST *,
int *);
extern struct value *value_full_object (struct value *, struct type *, int,
extern void clear_internalvar (struct internalvar *var);
extern void set_internalvar_component (struct internalvar *var,
- int offset,
- int bitpos, int bitsize,
+ LONGEST offset,
+ LONGEST bitpos, LONGEST bitsize,
struct value *newvalue);
extern struct internalvar *lookup_only_internalvar (const char *name);
enum noside noside);
extern struct value *value_fn_field (struct value **arg1p, struct fn_field *f,
- int j, struct type *type, int offset);
+ int j, struct type *type, LONGEST offset);
extern int binop_types_user_defined_p (enum exp_opcode op,
struct type *type1,
extern int record_latest_value (struct value *val);
extern void modify_field (struct type *type, gdb_byte *addr,
- LONGEST fieldval, int bitpos, int bitsize);
+ LONGEST fieldval, LONGEST bitpos, LONGEST bitsize);
extern void type_print (struct type *type, const char *varstring,
struct ui_file *stream, int show);
extern struct value *value_release_to_mark (const struct value *mark);
extern void val_print (struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
+ LONGEST embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
const struct value_print_options *options,