]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Support structure offsets that are 512K or larger.
authorDavid Taylor <dtaylor@emc.com>
Tue, 12 Apr 2016 19:02:57 +0000 (15:02 -0400)
committerDavid Taylor <david.taylor@emc.com>
Sat, 25 Jun 2016 01:02:36 +0000 (21:02 -0400)
GDB computes structure byte offsets using a 32 bit integer.  And,
first it computes the offset in bits and then converts to bytes.  The
result is that any offset that if 512K bytes or larger overflows.
This patch changes GDB to use LONGEST for such calculations.

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.

38 files changed:
gdb/ChangeLog
gdb/c-lang.h
gdb/c-typeprint.c
gdb/c-valprint.c
gdb/cp-abi.c
gdb/cp-abi.h
gdb/cp-valprint.c
gdb/d-valprint.c
gdb/dwarf2loc.c
gdb/eval.c
gdb/extension-priv.h
gdb/extension.c
gdb/extension.h
gdb/findvar.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/gnu-v2-abi.c
gdb/gnu-v3-abi.c
gdb/go-valprint.c
gdb/guile/guile-internal.h
gdb/guile/scm-pretty-print.c
gdb/jv-valprint.c
gdb/opencl-lang.c
gdb/p-lang.h
gdb/p-valprint.c
gdb/python/py-prettyprint.c
gdb/python/python-internal.h
gdb/spu-tdep.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/offsets.c [new file with mode: 0644]
gdb/testsuite/gdb.base/offsets.exp [new file with mode: 0644]
gdb/typeprint.c
gdb/valarith.c
gdb/valops.c
gdb/valprint.c
gdb/valprint.h
gdb/value.c
gdb/value.h

index 1ad9aa5f925fc80766f2fb99bd8bac5a56f5cae6..3e6a2ccc639dcdfccc744dcc7c2203a68c6b3fbc 100644 (file)
@@ -1,3 +1,44 @@
+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.
index bf50afc151afc361b298163aae29e5240d1ec13a..12be8bf0b223c4bdadbc854b221da71166c6cc83 100644 (file)
@@ -123,14 +123,14 @@ extern void cp_print_class_member (const gdb_byte *, struct type *,
                                   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 *,
index ed16fc3b8d2e68bdac415ab8517f42a2c8b78160..2564ebcf00e00cd6eac2055523b3664e237f7d0c 100644 (file)
@@ -1437,13 +1437,14 @@ c_type_print_base (struct type *type, struct ui_file *stream,
                              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");
              }
index 61302a36da9c43d639436c86faf351b0d86336de..2cb418d4310ef3dbbf8c89476e60e170413d8525 100644 (file)
@@ -567,7 +567,8 @@ c_value_print (struct value *val, struct ui_file *stream,
               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;
index 96533b15e9a00f83b66e071a918ee67942832c5c..afc4d4a79af69ddcfbf13be4e5604b39bf0288b0 100644 (file)
@@ -66,7 +66,7 @@ is_operator_name (const char *name)
 
 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;
@@ -106,7 +106,7 @@ value_virtual_fn_field (struct value **arg1p,
 
 struct type *
 value_rtti_type (struct value *v, int *full,
-                int *top, int *using_enc)
+                LONGEST *top, int *using_enc)
 {
   struct type *ret = NULL;
 
index 6d038f328f89b2595f673e52697441c06c866aec..4349a4a3a46755ba96e97922f33de424fd8a90e0 100644 (file)
@@ -135,7 +135,7 @@ extern struct value *value_virtual_fn_field (struct value **valuep,
    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
@@ -146,7 +146,7 @@ extern struct type *value_rtti_type (struct value *value,
 
 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);
 
@@ -229,9 +229,9 @@ struct cp_abi_ops
                                     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,
index effce30cf85d96c1eae0dc2b33dcb9231eedaad6..7b0c19a3bb798d4843c459b0e45e1ed2f45a4e1f 100644 (file)
@@ -80,7 +80,7 @@ static void cp_print_static_field (struct type *, struct value *,
                                   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 *,
@@ -154,7 +154,7 @@ cp_is_vtbl_member (struct type *type)
 
 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,
@@ -417,7 +417,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
 
 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,
@@ -434,7 +434,8 @@ cp_print_value_fields_rtti (struct type *type,
                                     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,
@@ -459,7 +460,7 @@ cp_print_value_fields_rtti (struct type *type,
 
 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,
@@ -469,7 +470,7 @@ cp_print_value (struct type *type, struct type *real_type,
     = (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)
@@ -483,7 +484,7 @@ cp_print_value (struct type *type, struct type *real_type,
 
   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);
index 8527424f87a16a28fe7c3445b7edda9a7f534021..620688bd4a818c678bede0cc26e0172017b36e46 100644 (file)
@@ -29,7 +29,7 @@
 
 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)
index adb0ac2245471471fcb4473833e9683f7e22916a..548e4683a61d20c9e52c44e89b84d80566cf2015 100644 (file)
@@ -1765,7 +1765,7 @@ read_pieced_value (struct value *v)
            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))
@@ -2016,7 +2016,7 @@ write_pieced_value (struct value *to, struct value *from)
    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
@@ -2132,7 +2132,8 @@ indirect_pieced_value (struct value *value)
   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;
index de1c6632e042a70f3c0a6eb834020d33464103ce..00a107c270c84af7d83cfbe9aa6fff23a7bb9d28 100644 (file)
@@ -1900,7 +1900,8 @@ evaluate_subexp_standard (struct type *expect_type,
       {
         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);
index d7bc57240030d72ac5a280084281121d57a6a0e1..26bd21ff36c8a23d1c3ba94fa1fb605a99ca2f32 100644 (file)
@@ -181,7 +181,7 @@ struct extension_language_ops
   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);
index ae24518924d0b1e3d1c9ec93a9382c3e4e9e74d3..c9f5664806ba0b7bfbb20dff2662795b8e0b875d 100644 (file)
@@ -497,7 +497,7 @@ free_ext_lang_type_printers (struct ext_lang_type_printers *printers)
 
 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,
index e9980a7c89724a6152f179a7416be57405f9804a..fa11f25f49d2fda7333398497dc07c9e7d5c7d5e 100644 (file)
@@ -226,7 +226,7 @@ extern void free_ext_lang_type_printers (struct ext_lang_type_printers *);
 
 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);
index cfb3e382258749d82af2c8b8dcb28d6884bbf10a..c64ec06b555aa6178540841717b47ba9675b3a44 100644 (file)
@@ -835,8 +835,8 @@ void
 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)));
 
index 0421cc5066a4ba7dc5ce452924b7855752cf9481..ec5c17a879ef385e4392f1b7ec2a292e07ee3d2c 100644 (file)
@@ -4297,8 +4297,8 @@ recursive_dump_type (struct type *type, int spaces)
                          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' (",
index 91e3eb9e22792478e58c7013d91e293370dfed7f..2dda074d737b9dbff9a45038edd3a561764b6f65 100644 (file)
@@ -511,7 +511,7 @@ union field_location
      gdbarch_bits_big_endian=0 targets, it is the bit offset to
      the LSB.  */
 
-  int bitpos;
+  LONGEST bitpos;
 
   /* * Enum value.  */
   LONGEST enumval;
index 7618d482d177b02ce77c0b596f6923d1dbd9308d..d2a0e35efae442ac9cfa0c534dac687692686833 100644 (file)
@@ -183,7 +183,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
 
 
 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;
@@ -340,7 +340,7 @@ vb_match (struct type *type, int index, struct type *basetype)
 
 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);
@@ -358,7 +358,7 @@ gnuv2_baseclass_offset (struct type *type, int index,
          if (vb_match (type, i, basetype))
            {
              struct type *field_type;
-             int field_offset;
+             LONGEST field_offset;
              int field_length;
              CORE_ADDR addr;
 
index ae84b361222605459201a2d7ba2c861a8afd1fb4..5bf36a276dc6636fb0273819bf9b42ebb327ad5b 100644 (file)
@@ -286,7 +286,7 @@ gnuv3_get_vtable (struct gdbarch *gdbarch,
 
 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));
@@ -443,7 +443,7 @@ gnuv3_virtual_fn_field (struct value **value_p,
 
 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;
index 7bb7b55c5edb9cfaa38380cf301fa20af9f99636..34ed8e09074e58453e40c5146ab540b41c49d743 100644 (file)
@@ -37,7 +37,7 @@
 
 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)
index b7f104d029ef9986ae42fc36cd4e4197ce41716a..0aa4a0a8f2877aacf4a66119a296cdfde7ddabea 100644 (file)
@@ -606,7 +606,7 @@ extern void gdbscm_preserve_values
 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,
index b1cbbdd0f633c98b6af9bdeb2892ab73bc573bbc..afdd0c71e0a48af36e24812b45ef4fcb858bcb92 100644 (file)
@@ -958,7 +958,7 @@ ppscm_print_children (SCM printer, enum display_hint hint,
 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,
index 6f7ef4b3bf1f4b7190a2a3e56a1bc76c135878c2..29887376eb1f028e4543f211ca70825f7b08ba6a 100644 (file)
@@ -266,7 +266,7 @@ java_value_print (struct value *val, struct ui_file *stream,
 
 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,
index 2a46d86f4302583cf985f4eac1130773320ebcb3..6fb8abe95a2a2735cf50f024159a9aa457bfa94b 100644 (file)
@@ -172,8 +172,8 @@ lval_func_read (struct value *v)
   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;
@@ -201,8 +201,8 @@ lval_func_write (struct value *v, struct value *fromval)
   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;
@@ -243,7 +243,7 @@ lval_func_write (struct value *v, struct value *fromval)
 
 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.  */
index d862b4938097a3ea676ce035135b13e37709eba0..287c0f421cadca10a89a1ac3d068b8d5f6af7231 100644 (file)
@@ -72,7 +72,7 @@ extern void
                                    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 *,
index 3e840d867eed36a3ccc0ad4f368dd0d9f9ff9576..f639e29b6258668f8c8d56e856bd421037e54e95 100644 (file)
@@ -469,7 +469,7 @@ static void pascal_object_print_static_field (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 *,
@@ -528,7 +528,7 @@ pascal_object_is_vtbl_member (struct type *type)
 
 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,
@@ -700,7 +700,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
 
 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,
@@ -723,11 +723,11 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
 
   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))
index e97769b4d151dfe233d657242a0ac0fe6c6add4c..883434435831ca5ef33d0d8f4ad939bc6ac272c7 100644 (file)
@@ -703,7 +703,7 @@ print_children (PyObject *printer, const char *hint,
 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,
index 7eb9aa40113b4046388c3f6b351cb9cf826679ff..8545c7bae0cca08c02628a6f0b6d2b583c6e97bf 100644 (file)
@@ -316,7 +316,7 @@ extern int gdbpy_auto_load_enabled (const struct extension_language_defn *);
 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,
index ea3229c27ccef09b0168d15f7a4894618b986f18..f62e8e76b6c5b84f910a16cc9c0b01a7a56a1fb4 100644 (file)
@@ -363,7 +363,7 @@ spu_value_from_register (struct gdbarch *gdbarch, struct type *type,
 {
   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)
     {
index 8b5274d1f236899a22a6156b58a1cb35d247333e..86799654eea586e7f05db23eadbbdc64a3d85886 100644 (file)
@@ -1,3 +1,8 @@
+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:
diff --git a/gdb/testsuite/gdb.base/offsets.c b/gdb/testsuite/gdb.base/offsets.c
new file mode 100644 (file)
index 0000000..2a1edeb
--- /dev/null
@@ -0,0 +1,28 @@
+/* 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);
+}
diff --git a/gdb/testsuite/gdb.base/offsets.exp b/gdb/testsuite/gdb.base/offsets.exp
new file mode 100644 (file)
index 0000000..b65fac7
--- /dev/null
@@ -0,0 +1,45 @@
+# 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"
+       }
+    }
+}
index 48a809b0f9c79e70af71c5a7abb774e7df968132..e77513e1c4ad85b7ab17cb8667048483c6c03b32 100644 (file)
@@ -406,7 +406,7 @@ whatis_exp (char *exp, int show)
   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;
index 254d99838a9e03fd57041a50571507147fb882a0..de6fcfd79abb2f3b6a1b341c36736ac949826cf3 100644 (file)
@@ -192,8 +192,8 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound)
 {
   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)
index 7f9cb93e1fad89c3fe850ff03c359d0d1b5b926a..40392e8889da60620023c1a9ab7c4d5335c9dd3b 100644 (file)
@@ -51,7 +51,7 @@ static struct value *search_struct_field (const char *, struct value *,
 
 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 *,
@@ -96,9 +96,9 @@ static CORE_ADDR allocate_space_in_inferior (int);
 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);
 
@@ -256,7 +256,8 @@ value_cast_structs (struct type *type, struct value *v2)
   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);
@@ -635,7 +636,7 @@ value_reinterpret_cast (struct type *type, struct value *arg)
 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,
@@ -647,8 +648,9 @@ dynamic_cast_check_1 (struct type *desired_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)))
        {
@@ -682,7 +684,7 @@ dynamic_cast_check_1 (struct type *desired_type,
 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,
@@ -692,7 +694,7 @@ dynamic_cast_check_2 (struct type *desired_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;
@@ -723,7 +725,8 @@ dynamic_cast_check_2 (struct type *desired_type,
 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;
@@ -954,7 +957,7 @@ value_at_lazy (struct type *type, CORE_ADDR addr)
 }
 
 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)
 {
@@ -1034,7 +1037,7 @@ value_assign (struct value *toval, struct value *fromval)
 
     case lval_internalvar_component:
       {
-       int offset = value_offset (toval);
+       LONGEST offset = value_offset (toval);
 
        /* Are we dealing with a bitfield?
 
@@ -1121,7 +1124,7 @@ value_assign (struct value *toval, struct value *fromval)
        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;
@@ -1600,7 +1603,7 @@ value_array (int lowbound, int highbound, struct value **elemvec)
 {
   int nelem;
   int idx;
-  unsigned int typelength;
+  ULONGEST typelength;
   struct value *val;
   struct type *arraytype;
 
@@ -1776,7 +1779,7 @@ typecmp (int staticp, int varargs, int nargs,
 
 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)
@@ -1800,10 +1803,10 @@ update_search_result (struct value **result_ptr, struct value *v,
    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;
@@ -1850,7 +1853,7 @@ do_search_struct_field (const char *name, struct value *arg1, int offset,
                   <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
@@ -1889,7 +1892,7 @@ do_search_struct_field (const char *name, struct value *arg1, int offset,
                             && (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))
        {
@@ -1965,7 +1968,7 @@ search_struct_field (const char *name, struct value *arg1,
                     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);
@@ -1982,7 +1985,7 @@ search_struct_field (const char *name, struct value *arg1,
 
 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;
@@ -2046,8 +2049,8 @@ search_struct_method (const char *name, struct value **arg1p,
 
   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))
        {
@@ -2280,10 +2283,10 @@ value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype,
 
 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;
@@ -2340,7 +2343,7 @@ find_method_list (struct value **argp, const char *method,
      extension methods.  */
   for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--)
     {
-      int base_offset;
+      LONGEST base_offset;
 
       if (BASETYPE_VIA_VIRTUAL (type, i))
        {
@@ -2380,10 +2383,10 @@ find_method_list (struct value **argp, const char *method,
 
 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;
 
@@ -2493,7 +2496,7 @@ find_overload_match (struct value **args, int nargs,
   /* 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);
 
@@ -3588,7 +3591,7 @@ value_maybe_namespace_elt (const struct type *curtype,
 
 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;
@@ -3661,7 +3664,7 @@ value_full_object (struct value *argp,
 {
   struct type *real_type;
   int full = 0;
-  int top = -1;
+  LONGEST top = -1;
   int using_enc = 0;
   struct value *new_val;
 
index 64407e87df58b71a60bc8ec93dff4c7f5816c2ad..6896da2b624d17f679ef89f2a7de6a2a21659089 100644 (file)
@@ -303,7 +303,7 @@ val_print_scalar_type_p (struct type *type)
 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);
@@ -1042,7 +1042,7 @@ generic_val_print (struct type *type, const gdb_byte *valaddr,
    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,
@@ -1303,7 +1303,7 @@ val_print_type_code_flags (struct type *type, const gdb_byte *valaddr,
 
 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,
@@ -1965,7 +1965,7 @@ maybe_print_array_index (struct type *index_type, LONGEST index,
 
 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,
index 451b5fe0ac8c4dacb2659b28f1f9060e04432300..23a4c12c40d0bc6354e9a2f6d832ba8c93b14d80 100644 (file)
@@ -115,7 +115,7 @@ extern void maybe_print_array_index (struct type *index_type, LONGEST index,
                                      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 *,
@@ -125,7 +125,7 @@ extern void val_print_type_code_int (struct type *, const gdb_byte *,
                                     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,
index 35fb50351a6e9aa725227cbf715c7038c9946b62..cd59f43f01f3eeb5c5fb8eb4455a6a3e921ed3ef 100644 (file)
@@ -65,10 +65,10 @@ struct internal_function
 struct range
 {
   /* Lowest offset in the range.  */
-  int offset;
+  LONGEST offset;
 
   /* Length of the range.  */
-  int length;
+  LONGEST length;
 };
 
 typedef struct range range_s;
@@ -79,8 +79,8 @@ DEF_VEC_O(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;
 
@@ -104,10 +104,10 @@ range_lessthan (const range_s *r1, const range_s *r2)
    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;
@@ -239,15 +239,15 @@ struct value
      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
@@ -309,8 +309,8 @@ struct value
      `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
@@ -349,7 +349,7 @@ get_value_arch (const struct value *value)
 }
 
 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);
 
@@ -357,7 +357,8 @@ value_bits_available (const struct value *value, int offset, int length)
 }
 
 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,
@@ -427,7 +428,8 @@ value_entirely_optimized_out (struct value *value)
    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;
@@ -592,13 +594,15 @@ insert_into_bit_range_vector (VEC(range_s) **vectorp, int offset, int length)
 }
 
 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,
@@ -612,7 +616,7 @@ mark_value_bytes_unavailable (struct value *value, int offset, int length)
 
 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;
@@ -748,8 +752,8 @@ struct ranges_and_idx
 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);
@@ -870,9 +874,9 @@ value_contents_bits_eq (const struct value *val1, int offset1,
 }
 
 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,
@@ -1109,35 +1113,35 @@ deprecated_set_value_type (struct value *value, struct type *type)
   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;
 }
@@ -1330,10 +1334,10 @@ value_ranges_copy_adjusted (struct value *dst, int dst_bit_offset,
    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);
 
@@ -1377,8 +1381,8 @@ value_contents_copy_raw (struct value *dst, int dst_offset,
    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);
@@ -1462,14 +1466,15 @@ mark_value_bytes_optimized_out (struct value *value, int offset, int length)
 /* 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)
@@ -1479,26 +1484,26 @@ value_bits_synthetic_pointer (const struct value *value,
                                                                  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;
 }
@@ -2371,8 +2376,9 @@ get_internalvar_function (struct internalvar *var,
 }
 
 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;
@@ -3107,7 +3113,7 @@ set_value_enclosing_type (struct value *val, struct type *new_encl_type)
    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;
@@ -3137,8 +3143,8 @@ value_primitive_field (struct value *arg1, int offset,
         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);
@@ -3159,7 +3165,7 @@ value_primitive_field (struct value *arg1, int offset,
       /* 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))
@@ -3248,7 +3254,7 @@ value_field (struct value *arg1, int fieldno)
 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);
@@ -3318,14 +3324,14 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
 
 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.  */
@@ -3374,7 +3380,7 @@ unpack_bits_as_long (struct type *field_type, const gdb_byte *valaddr,
 
 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);
@@ -3417,8 +3423,8 @@ unpack_field_as_long (struct type *type, const gdb_byte *valaddr, int 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;
@@ -3456,7 +3462,7 @@ unpack_value_bitfield (struct value *dest_val,
 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);
@@ -3477,12 +3483,12 @@ value_field_bitfield (struct type *type, int 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;
@@ -3498,7 +3504,7 @@ modify_field (struct type *type, gdb_byte *addr,
     {
       /* 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;
@@ -3526,7 +3532,7 @@ void
 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);
@@ -3560,7 +3566,7 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num)
 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);
index f8ec854572b20086a9e2b5856f4bb1a5c610142f..0b417b4ea5b814ead4ccd9ad04f52f5f849baad8 100644 (file)
@@ -112,15 +112,15 @@ extern void deprecated_set_value_type (struct value *value,
 
 /* 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
@@ -135,8 +135,8 @@ extern void set_value_parent (struct value *value, struct value *parent);
    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
@@ -205,10 +205,10 @@ extern struct type *value_actual_type (struct value *value,
                                       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).
@@ -246,7 +246,7 @@ struct lval_funcs
   /* 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
@@ -283,7 +283,7 @@ extern struct value *allocate_computed_value (struct type *type,
    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);
@@ -393,7 +393,7 @@ extern void mark_value_bytes_optimized_out (struct value *value,
    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.
@@ -476,7 +476,7 @@ extern struct value *coerce_array (struct value *value);
    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
@@ -484,7 +484,7 @@ extern int value_bits_synthetic_pointer (const struct value *value,
    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
@@ -492,7 +492,7 @@ extern int value_bytes_available (const struct value *value,
    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.  */
@@ -506,13 +506,13 @@ extern int value_entirely_unavailable (struct value *value);
    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.
@@ -567,9 +567,9 @@ extern void mark_value_bits_unavailable (struct value *value,
    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
@@ -578,7 +578,7 @@ extern int value_contents_eq (const struct value *val1, int offset1,
    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);
 
@@ -614,17 +614,18 @@ extern LONGEST unpack_field_as_long (struct type *type,
                                     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);
@@ -683,12 +684,12 @@ extern struct value *default_read_var_value (struct symbol *var,
 
 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);
 
@@ -766,12 +767,12 @@ extern int find_overload_match (struct value **args, int nargs,
 
 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,
@@ -870,8 +871,8 @@ extern void set_internalvar_string (struct internalvar *var,
 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);
@@ -951,7 +952,7 @@ extern struct value *value_x_unop (struct value *arg1, enum exp_opcode op,
                                   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,
@@ -979,7 +980,7 @@ extern void release_value_or_incref (struct value *val);
 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);
@@ -1009,7 +1010,7 @@ extern void value_print_array_elements (struct value *val,
 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,