diff mbox

RFA 1/2 fix for bug with large structure offsets

Message ID 18839.1416329575@usendtaylorx2l
State New
Headers show

Commit Message

David Taylor Nov. 18, 2014, 4:52 p.m. UTC
Here is the non testsuite part of the patch.

Comments

Joel Brobecker Dec. 13, 2014, 1:22 p.m. UTC | #1
Hello David,

Have these two patches been reviewed, yet? If not, can you please
resubmit them with a proper description of the problem they fix and
a ChangeLog entry? Please Cc: me and I will review them next weekend.

Thank you,
David Taylor Dec. 15, 2014, 3:09 p.m. UTC | #2
Joel Brobecker <brobecker@adacore.com> wrote:

> Hello David,

Hello Joel,

> Have these two patches been reviewed, yet? If not, can you please

No, it has not been reviewed yet.

> resubmit them with a proper description of the problem they fix and
> a ChangeLog entry? Please Cc: me and I will review them next weekend.

Is the description and ChangeLog in part 0 insufficient?

There were three parts --

    0/2 -- description of the problem and ChangeLog entries
    1/2 -- changes to GDB proper
    2/2 -- testsuite changes (basically, a really simple test)

> Thank you,
> 
> -- 
> Joel

Thanks.

David
Joel Brobecker Dec. 15, 2014, 3:21 p.m. UTC | #3
> > resubmit them with a proper description of the problem they fix and
> > a ChangeLog entry? Please Cc: me and I will review them next weekend.
> 
> Is the description and ChangeLog in part 0 insufficient?
> 
> There were three parts --
> 
>     0/2 -- description of the problem and ChangeLog entries
>     1/2 -- changes to GDB proper
>     2/2 -- testsuite changes (basically, a really simple test)

The introduction email is good sometimes, but now try to include
all the necessary info to explain what the patch does in the
commit's revision log. There are two advantages to this:
  1. It makes archeology a lot easier, since the information
     is right there;
  2. It makes it easier for you to contribute the patch, since
     all you have to do is git-email it.

Introduction emails are useful sometimes when you want to provide
some general context that doesn't really belong in the revision
log of any of the patches. The idea is that we should be able to
have all necessary info for a given commit just by looking at
that commit.

Remember to Cc: me when you resubmit - it'll help me remember
I promised to review your patches this weekend.
diff mbox

Patch

diff --git a/gdb/c-lang.h b/gdb/c-lang.h
index 76bd426..1e7e9de 100644
--- a/gdb/c-lang.h
+++ b/gdb/c-lang.h
@@ -120,14 +120,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 *,
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index c61e18e..c732292 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -460,7 +460,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;
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index 7055acb..3b029c3 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -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)
 {
   volatile struct gdb_exception ex;
@@ -104,7 +104,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;
   volatile struct gdb_exception e;
diff --git a/gdb/cp-abi.h b/gdb/cp-abi.h
index 7d4b7f3..25115fe 100644
--- a/gdb/cp-abi.h
+++ b/gdb/cp-abi.h
@@ -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,
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 8f456bf..757e99a 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -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,
@@ -414,7 +414,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,
@@ -431,7 +431,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,
@@ -456,7 +457,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,
@@ -466,7 +467,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)
@@ -480,7 +481,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;
       struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
       const char *basename = TYPE_NAME (baseclass);
diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c
index 788b3d5..6cb8aed 100644
--- a/gdb/d-valprint.c
+++ b/gdb/d-valprint.c
@@ -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)
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 6e461bc..74f4eb6 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -2009,7 +2009,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;
 
diff --git a/gdb/eval.c b/gdb/eval.c
index 655ea22..6b59826 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1865,7 +1865,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);
diff --git a/gdb/extension-priv.h b/gdb/extension-priv.h
index 9237273..dbf620f 100644
--- a/gdb/extension-priv.h
+++ b/gdb/extension-priv.h
@@ -175,7 +175,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);
diff --git a/gdb/extension.c b/gdb/extension.c
index 93359c5..64b2c40 100644
--- a/gdb/extension.c
+++ b/gdb/extension.c
@@ -480,7 +480,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,
diff --git a/gdb/extension.h b/gdb/extension.h
index c08d98d..108234b 100644
--- a/gdb/extension.h
+++ b/gdb/extension.h
@@ -217,7 +217,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);
diff --git a/gdb/findvar.c b/gdb/findvar.c
index cb98b86..b1a66e5 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -659,8 +659,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 (check_typedef (value_type (value)));
 
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 8e44b7c..cd27794 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3904,8 +3904,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 %lld bitsize %d type ",
+			  idx, (long long int)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' (",
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 14a1f08..24d2d34 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -597,7 +597,7 @@  struct main_type
 	   gdbarch_bits_big_endian=0 targets, it is the bit offset to
 	   the LSB.  */
 
-	int bitpos;
+	LONGEST bitpos;
 
 	/* * Enum value.  */
 	LONGEST enumval;
diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c
index 5b73c92..6b96915 100644
--- a/gdb/gnu-v2-abi.c
+++ b/gdb/gnu-v2-abi.c
@@ -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;
 
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index d673e77..9aba18e 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -275,7 +275,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));
@@ -432,7 +432,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;
diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c
index d7026a4..4446b74 100644
--- a/gdb/go-valprint.c
+++ b/gdb/go-valprint.c
@@ -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)
diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index 5c94c78..5b93535 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -955,7 +955,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,
diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c
index 91b45e2..0f5be63 100644
--- a/gdb/jv-valprint.c
+++ b/gdb/jv-valprint.c
@@ -265,7 +265,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,
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index 2006cd8..a10d779 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -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;
diff --git a/gdb/p-lang.h b/gdb/p-lang.h
index ea2d37c..7827bd6 100644
--- a/gdb/p-lang.h
+++ b/gdb/p-lang.h
@@ -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 *,
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 63f6222..4b2f378 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -467,7 +467,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 *,
@@ -526,7 +526,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,
@@ -697,7 +697,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,
@@ -720,11 +720,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;
       volatile struct gdb_exception ex;
       int skip = 0;
 
diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c
index 35579fb..4fd35a9 100644
--- a/gdb/python/py-prettyprint.c
+++ b/gdb/python/py-prettyprint.c
@@ -686,7 +686,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,
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 54eebeb..3532088 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -313,7 +313,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,
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 30e569f..859244b 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -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)
     {
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 0650177..859aca8 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -402,7 +402,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;
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 154629b..f987178 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -193,7 +193,7 @@  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 (elt_type);
-  unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound);
+  ULONGEST elt_offs = elt_size * longest_to_int (index - lowerbound);
   struct value *v;
 
   if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
diff --git a/gdb/valops.c b/gdb/valops.c
index 2a1db90..3b80ed6 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -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,8 @@  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 +683,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 +693,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 +724,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 +956,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)
 {
@@ -1028,7 +1030,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?
 
@@ -1115,7 +1117,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;
@@ -1595,7 +1597,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;
 
@@ -1770,7 +1772,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)
@@ -1794,10 +1796,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;
@@ -1846,7 +1848,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
@@ -1885,7 +1887,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))
 	{
@@ -1962,7 +1964,7 @@  search_struct_field (const char *name, struct value *arg1, int offset,
 		     struct type *type, int looking_for_baseclass)
 {
   struct value *result = NULL;
-  int boffset = 0;
+  LONGEST boffset = 0;
 
   do_search_struct_field (name, arg1, offset, type, looking_for_baseclass,
 			  &result, &boffset, type);
@@ -1979,7 +1981,7 @@  search_struct_field (const char *name, struct value *arg1, int offset,
 
 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;
@@ -2043,8 +2045,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))
 	{
@@ -2279,10 +2281,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;
@@ -2339,7 +2341,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))
 	{
@@ -2379,10 +2381,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 +2495,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);
 
@@ -3600,7 +3602,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;
   struct type *type, *real_type, *target_type;
@@ -3655,7 +3657,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;
 
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 52f028e..2bd1aa9 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -298,7 +298,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)
 {
   CHECK_TYPEDEF (type);
@@ -734,7 +734,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,
@@ -956,7 +956,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,
@@ -1615,7 +1615,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,
diff --git a/gdb/valprint.h b/gdb/valprint.h
index 6698247..c2a4391 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -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 *,
@@ -129,7 +129,7 @@  extern void val_print_type_code_flags (struct type *type,
 				       struct ui_file *stream);
 
 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,
diff --git a/gdb/value.c b/gdb/value.c
index ecfb154..5bac306 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -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
      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
@@ -341,7 +341,7 @@  struct 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);
 
@@ -349,7 +349,7 @@  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,
@@ -584,13 +584,13 @@  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,
@@ -604,7 +604,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;
@@ -1028,35 +1028,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;
 }
@@ -1245,12 +1245,12 @@  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)
 {
   range_s *r;
   int i;
-  int src_bit_offset, dst_bit_offset, bit_length;
+  LONGEST src_bit_offset, dst_bit_offset, bit_length;
 
   /* A lazy DST would make that this copy operation useless, since as
      soon as DST's contents were un-lazied (by a later value_contents
@@ -1292,8 +1292,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);
@@ -1374,7 +1374,7 @@  mark_value_bits_optimized_out (struct value *value, int offset, int 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)
@@ -1384,26 +1384,26 @@  value_bits_synthetic_pointer (const struct value *value,
 								  length);
 }
 
-int
+LONGEST
 value_embedded_offset (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 (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;
 }
@@ -2231,8 +2231,8 @@  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;
 
@@ -2936,7 +2936,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;
@@ -2964,8 +2964,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);
@@ -2986,7 +2986,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))
@@ -3063,7 +3063,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);
@@ -3139,8 +3139,8 @@  unpack_bits_as_long (struct type *field_type, const gdb_byte *valaddr,
   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.  */
@@ -3189,7 +3189,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);
@@ -3233,7 +3233,7 @@  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,
+		       const gdb_byte *valaddr, LONGEST embedded_offset,
 		       const struct value *val)
 {
   enum bfd_endian byte_order;
@@ -3271,7 +3271,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);
@@ -3292,12 +3292,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;
@@ -3313,7 +3313,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 %lld bits."), (long long int)bitsize);
 
       /* Truncate it, otherwise adjoining fields may be corrupted.  */
       fieldval &= mask;
@@ -3341,7 +3341,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);
@@ -3375,7 +3375,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);
diff --git a/gdb/value.h b/gdb/value.h
index e3603c3..80d616d 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -108,15 +108,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
@@ -131,8 +131,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
@@ -201,10 +201,10 @@  extern struct type *value_actual_type (struct value *value,
 				       int resolve_simple_types,
 				       int *real_type_found);
 
-extern int value_pointed_to_offset (struct value *value);
-extern void set_value_pointed_to_offset (struct value *value, int val);
-extern int value_embedded_offset (struct value *value);
-extern void set_value_embedded_offset (struct value *value, int val);
+extern LONGEST value_pointed_to_offset (struct value *value);
+extern void set_value_pointed_to_offset (struct value *value, LONGEST val);
+extern LONGEST value_embedded_offset (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).
@@ -279,7 +279,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);
@@ -472,7 +472,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
@@ -480,7 +480,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
@@ -488,7 +488,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.  */
@@ -502,13 +502,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.
@@ -574,7 +574,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);
 
@@ -610,17 +610,17 @@  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,
+				   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);
@@ -677,12 +677,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);
 
@@ -760,12 +760,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,
@@ -864,8 +864,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);
@@ -945,7 +945,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,
@@ -973,7 +973,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);
@@ -1003,7 +1003,7 @@  extern void value_print_array_elements (struct value *val,
 extern struct value *value_release_to_mark (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,