Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Expand bitpos to LONGEST to allow access to large offsets within a struct
Date: Mon, 20 Feb 2012 14:53:00 -0000	[thread overview]
Message-ID: <20120220132724.GB4753@spoyarek.pnq.redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4269 bytes --]

Hi,

If a struct member is at an offset greater than or equal to
0x10000000, the resulting bit position within the struct overflows and
causes an invalid access. The following program demonstrates this
problem:

-----------------------------------------------
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
 #define BSIZE (0x10000000)
 
 struct s {
 	char buf1[BSIZE];
 	char buf2[8];
 	char buf3[8];
 	char buf4[8];
 };
 
 int main()
 {
	struct s *p = malloc(sizeof(struct s));
 	memset(p,0,sizeof(struct s));
 	printf("%p %x\n", &p->buf2[0], p->buf2[0]);
 	return(0);
 }

-----------------------------------------------

Compile and run the program under gdb:

(gdb) b 18
Breakpoint 1 at 0x400554: file test.c, line 18.
(gdb) run
Starting program: /root/gdb/a.out
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x2aaaaaac7000

Breakpoint 1, main () at test.c:18
18              printf("%p %x\n", &p->buf2[0], p->buf2[0]);
(gdb) p p->buf2
Cannot access memory at address 0x2aaa9b022010

-----------------------------------------------

This happens because the bitpos in field_location within the struct
main_type.field is declared as an int, limiting it to just 4 bytes. I
have attached a patch that expands this to LONGEST and adjusted this
change in the code. The testsuite does not report any regressions due
to this patch and it fixes the problem.

Regards,
Siddhesh


gdb/ChangeLog:

2012-02-20  Siddhesh Poyarekar  <siddhesh@redhat.com>

	* gdbtypes.h (struct main_type.field.field_location): Expand
	bitpos to LONGEST.
	* value.h (modify_field): Adjust to accept LONGEST as bitpos.
	(value_primitive_field, val_print): Adjust to accept LONGEST as
	offset.
	* value.c (modify_field, value_primitive_field, val_print): Ditto.
	(value_bits_synthetic_pointer, value_bits_valid): Ditto.
	(unpack_value_bits_as_long_1): Ditto.
	* valprint.c (val_print_scalar_formatted, val_print): Ditto.
	* valprint.h (val_print_scalar_formatted): Ditto.
	* valops.c (search_struct_field, search_struct_method): Ditto.
	(value_struct_elt_for_reference, find_method_list): Ditto.
	* regcache.h (regcache_cooked_read_part): Ditto.
	(regcache_cooked_write_part): Ditto.
	* regcache.c (regcache_cooked_read_part): Ditto.
	(regcache_cooked_write_part, regcache_xfer_part): Ditto.
	* ax-gdb.c (gen_offset, gen_bitfield_ref):Ditto.
	(gen_primitive_ref, gen_struct_ref_recursive): Ditto.
	* ada-lang.c (ada_value_primitive_packed_val): Ditto.
	(ada_value_primitive_field, find_struct_field): Ditto.
	(ada_search_struct_field, ada_template_to_fixed_record_type_1):
	Ditto.
	* p-lang.c (is_pascal_string_type): Ditto.
	* mips-tdep.c (mips_xfer_register): Adjust to accept LONGEST as
	offset. Adjust format specifier for bitpos.
	(mips_n32n64_fp_arg_chunk_p): Adjust to accept LONGEST as offset.
	(mips_n32n64_return_value): Store bitpos in LONGEST.
	* sparc64-tdep.c (sparc64_store_floating_fields): Adjust to accept
	LONGEST as bitpos.
	(sparc64_extract_floating_fields): Ditto.
	* gdbtypes.c (recursive_dump_type): Adjust format specifier to
	print bitpos.
	* ada-typeprint.c (print_enum_type): Ditto.
	* c-typeprint.c (c_type_print_base): Ditto.
	* m2-typeprint.c (m2_enum): Ditto.
	* p-typeprint.c (pascal_type_print_base): Ditto.
	* language.h (struct language_defn): Adjust la_val_print to accept
	LONGEST as embedded_offset.
	* language.c (unk_lang_val_print): Adjust for change in
	la_val_print.
	* ada-lang.h (ada_val_print): Ditto.
	* ada-valprint.c (ada_val_print, ada_val_print_1): Ditto.
	(print_variant_part, print_field_values): Ditto.
	* c-lang.h (c_val_print): Ditto.
	* c-valprint.c (c_val_print): Ditto.
	* d-lang.h (d_val_print): Ditto.
	* d-valprint.c (d_val_print): Ditto.
	* f-lang.h (f_val_print): Ditto.
	* f-valprint.c (f_val_print): Ditto.
	* jv-lang.h (java_val_print): Ditto.
	* jv-valprint.c (java_val_print, java_print_value_fields): Ditto.
	* m2-lang.h (m2_val_print): Ditto.
	* m2-valprint.c (m2_print_array_contents, m2_val_print):Ditto.
	(m2_print_unbounded_array, m2_print_array_contents): Ditto.
	(m2_print_long_set): Ditto.
	* p-lang.h (pascal_val_print, is_pascal_string_type): Ditto.
	* p-valprint.c (pascal_val_print): Ditto.
	* eval.c (evaluate_struct_tuple): Expand bitsize and bitpos to
	LONGEST.

[-- Attachment #2: gdb-longest-bitpos.patch --]
[-- Type: text/plain, Size: 41016 bytes --]

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 107df93..c032a7e 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -2218,7 +2218,7 @@ has_negatives (struct type *type)
 
 struct value *
 ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
-				long offset, int bit_offset, int bit_size,
+				LONGEST offset, int bit_offset, int bit_size,
                                 struct type *type)
 {
   struct value *v;
@@ -6340,7 +6340,7 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno,
 
   if (TYPE_FIELD_BITSIZE (arg_type, fieldno) != 0)
     {
-      int bit_pos = TYPE_FIELD_BITPOS (arg_type, fieldno);
+      LONGEST bit_pos = TYPE_FIELD_BITPOS (arg_type, fieldno);
       int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno);
 
       return ada_value_primitive_packed_val (arg1, value_contents (arg1),
@@ -6387,7 +6387,7 @@ find_struct_field (const char *name, struct type *type, int offset,
 
   for (i = 0; i < TYPE_NFIELDS (type); i += 1)
     {
-      int bit_pos = TYPE_FIELD_BITPOS (type, i);
+      LONGEST bit_pos = TYPE_FIELD_BITPOS (type, i);
       int fld_offset = offset + bit_pos / 8;
       const char *t_field_name = TYPE_FIELD_NAME (type, i);
 
@@ -6491,7 +6491,7 @@ ada_search_struct_field (char *name, struct value *arg, int offset,
           int j;
           struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type,
 									i));
-          int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
+          LONGEST var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
 
           for (j = 0; j < TYPE_NFIELDS (field_type); j += 1)
             {
@@ -7305,7 +7305,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
   struct type *rtype;
   int nfields, bit_len;
   int variant_field;
-  long off;
+  LONGEST off;
   int fld_bit_len;
   int f;
 
@@ -7377,7 +7377,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
 	     that follow this one.  */
 	  if (ada_is_aligner_type (field_type))
 	    {
-	      long field_offset = TYPE_FIELD_BITPOS (field_type, f);
+	      LONGEST field_offset = TYPE_FIELD_BITPOS (field_type, f);
 
 	      field_valaddr = cond_offset_host (field_valaddr, field_offset);
 	      field_address = cond_offset_target (field_address, field_offset);
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 2a6cd57..1e62a50 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -164,7 +164,7 @@ extern void ada_print_type (struct type *, const char *, struct ui_file *, int,
 extern void ada_print_typedef (struct type *type, struct symbol *new_symbol,
 			       struct ui_file *stream);
 
-extern int ada_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
+extern int ada_val_print (struct type *, const gdb_byte *, LONGEST, CORE_ADDR,
                           struct ui_file *, int,
 			  const struct value *,
 			  const struct value_print_options *);
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 5599278..42fe3e6 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -274,7 +274,7 @@ static void
 print_enum_type (struct type *type, struct ui_file *stream)
 {
   int len = TYPE_NFIELDS (type);
-  int i, lastval;
+  LONGEST i, lastval;
 
   fprintf_filtered (stream, "(");
   wrap_here (" ");
@@ -289,7 +289,7 @@ print_enum_type (struct type *type, struct ui_file *stream)
       fputs_filtered (ada_enum_name (TYPE_FIELD_NAME (type, i)), stream);
       if (lastval != TYPE_FIELD_BITPOS (type, i))
 	{
-	  fprintf_filtered (stream, " => %d", TYPE_FIELD_BITPOS (type, i));
+	  fprintf_filtered (stream, " => %ld", TYPE_FIELD_BITPOS (type, i));
 	  lastval = TYPE_FIELD_BITPOS (type, i);
 	}
       lastval += 1;
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index f43f3e3..6ad0931 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -42,7 +42,7 @@ static void print_record (struct type *, const gdb_byte *, int,
 			  const struct value_print_options *);
 
 static int print_field_values (struct type *, const gdb_byte *,
-			       int,
+			       LONGEST,
 			       struct ui_file *, int,
 			       const struct value *,
 			       const struct value_print_options *,
@@ -50,7 +50,7 @@ static int print_field_values (struct type *, const gdb_byte *,
 
 static void adjust_type_signedness (struct type *);
 
-static int ada_val_print_1 (struct type *, const gdb_byte *, int, CORE_ADDR,
+static int ada_val_print_1 (struct type *, const gdb_byte *, LONGEST, CORE_ADDR,
 			    struct ui_file *, int,
 			    const struct value *,
 			    const struct value_print_options *);
@@ -571,7 +571,7 @@ ada_printstr (struct ui_file *stream, struct type *type,
 
 int
 ada_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)
@@ -667,7 +667,7 @@ ada_val_print_array (struct type *type, const gdb_byte *valaddr,
 
 static int
 ada_val_print_1 (struct type *type, const gdb_byte *valaddr,
-		 int offset, CORE_ADDR address,
+		 LONGEST offset, CORE_ADDR address,
 		 struct ui_file *stream, int recurse,
 		 const struct value *original_value,
 		 const struct value_print_options *options)
@@ -936,7 +936,7 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr,
 
 static int
 print_variant_part (struct type *type, int field_num,
-		    const gdb_byte *valaddr, int offset,
+		    const gdb_byte *valaddr, LONGEST offset,
 		    struct ui_file *stream, int recurse,
 		    const struct value *val,
 		    const struct value_print_options *options,
@@ -1048,7 +1048,7 @@ print_record (struct type *type, const gdb_byte *valaddr,
 
 static int
 print_field_values (struct type *type, const gdb_byte *valaddr,
-		    int offset, struct ui_file *stream, int recurse,
+		    LONGEST offset, struct ui_file *stream, int recurse,
 		    const struct value *val,
 		    const struct value_print_options *options,
 		    int comma_needed,
@@ -1133,7 +1133,7 @@ print_field_values (struct type *type, const gdb_byte *valaddr,
 	    }
 	  else
 	    {
-	      int bit_pos = TYPE_FIELD_BITPOS (type, i);
+	      LONGEST bit_pos = TYPE_FIELD_BITPOS (type, i);
 	      int bit_size = TYPE_FIELD_BITSIZE (type, i);
 	      struct value_print_options opts;
 
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 739677f..c4fcc1c 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -85,7 +85,7 @@ static void gen_left_shift (struct agent_expr *, int);
 
 static void gen_frame_args_address (struct gdbarch *, struct agent_expr *);
 static void gen_frame_locals_address (struct gdbarch *, struct agent_expr *);
-static void gen_offset (struct agent_expr *ax, int offset);
+static void gen_offset (struct agent_expr *ax, LONGEST offset);
 static void gen_sym_offset (struct agent_expr *, struct symbol *);
 static void gen_var_ref (struct gdbarch *, struct agent_expr *ax,
 			 struct axs_value *value, struct symbol *var);
@@ -135,15 +135,15 @@ static void gen_deref (struct agent_expr *, struct axs_value *);
 static void gen_address_of (struct agent_expr *, struct axs_value *);
 static void gen_bitfield_ref (struct expression *exp, struct agent_expr *ax,
 			      struct axs_value *value,
-			      struct type *type, int start, int end);
+			      struct type *type, LONGEST start, LONGEST end);
 static void gen_primitive_field (struct expression *exp,
 				 struct agent_expr *ax,
 				 struct axs_value *value,
-				 int offset, int fieldno, struct type *type);
+				 LONGEST offset, int fieldno, struct type *type);
 static int gen_struct_ref_recursive (struct expression *exp,
 				     struct agent_expr *ax,
 				     struct axs_value *value,
-				     char *field, int offset,
+				     char *field, LONGEST offset,
 				     struct type *type);
 static void gen_struct_ref (struct expression *exp, struct agent_expr *ax,
 			    struct axs_value *value,
@@ -621,7 +621,7 @@ gen_frame_locals_address (struct gdbarch *gdbarch, struct agent_expr *ax)
    programming in ML, it would be clearer why these are the same
    thing.  */
 static void
-gen_offset (struct agent_expr *ax, int offset)
+gen_offset (struct agent_expr *ax, LONGEST offset)
 {
   /* It would suffice to simply push the offset and add it, but this
      makes it easier to read positive and negative offsets in the
@@ -1283,7 +1283,7 @@ gen_address_of (struct agent_expr *ax, struct axs_value *value)
 static void
 gen_bitfield_ref (struct expression *exp, struct agent_expr *ax,
 		  struct axs_value *value, struct type *type,
-		  int start, int end)
+		  LONGEST start, LONGEST end)
 {
   /* Note that ops[i] fetches 8 << i bits.  */
   static enum agent_op ops[]
@@ -1318,13 +1318,13 @@ gen_bitfield_ref (struct expression *exp, struct agent_expr *ax,
 
   /* The first and one-after-last bits in the field, but rounded down
      and up to byte boundaries.  */
-  int bound_start = (start / TARGET_CHAR_BIT) * TARGET_CHAR_BIT;
-  int bound_end = (((end + TARGET_CHAR_BIT - 1)
+  LONGEST bound_start = (start / TARGET_CHAR_BIT) * TARGET_CHAR_BIT;
+  LONGEST bound_end = (((end + TARGET_CHAR_BIT - 1)
 		    / TARGET_CHAR_BIT)
 		   * TARGET_CHAR_BIT);
 
   /* current bit offset within the structure */
-  int offset;
+  LONGEST offset;
 
   /* The index in ops of the opcode we're considering.  */
   int op;
@@ -1443,7 +1443,7 @@ gen_bitfield_ref (struct expression *exp, struct agent_expr *ax,
 static void
 gen_primitive_field (struct expression *exp,
 		     struct agent_expr *ax, struct axs_value *value,
-		     int offset, int fieldno, struct type *type)
+		     LONGEST offset, int fieldno, struct type *type)
 {
   /* Is this a bitfield?  */
   if (TYPE_FIELD_PACKED (type, fieldno))
@@ -1468,7 +1468,7 @@ gen_primitive_field (struct expression *exp,
 static int
 gen_struct_ref_recursive (struct expression *exp, struct agent_expr *ax,
 			  struct axs_value *value,
-			  char *field, int offset, struct type *type)
+			  char *field, LONGEST offset, struct type *type)
 {
   int i, rslt;
   int nbases = TYPE_N_BASECLASSES (type);
diff --git a/gdb/c-lang.h b/gdb/c-lang.h
index e8c632f..edc62ce 100644
--- a/gdb/c-lang.h
+++ b/gdb/c-lang.h
@@ -72,7 +72,7 @@ extern void c_print_typedef (struct type *,
 			     struct ui_file *);
 
 extern int c_val_print (struct type *, const gdb_byte *,
-			int, CORE_ADDR,
+			LONGEST, CORE_ADDR,
 			struct ui_file *, int,
 			const struct value *,
 			const struct value_print_options *);
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 21887c6..e47b4e5 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -717,7 +717,7 @@ c_type_print_base (struct type *type, struct ui_file *stream,
 {
   int i;
   int len, real_len;
-  int lastval;
+  LONGEST lastval;
   enum
     {
       s_none, s_public, s_private, s_protected
@@ -1206,7 +1206,7 @@ c_type_print_base (struct type *type, struct ui_file *stream,
 	      fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
 	      if (lastval != TYPE_FIELD_BITPOS (type, i))
 		{
-		  fprintf_filtered (stream, " = %d", 
+		  fprintf_filtered (stream, " = %ld", 
 				    TYPE_FIELD_BITPOS (type, i));
 		  lastval = TYPE_FIELD_BITPOS (type, i);
 		}
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 82551e9..f034a88 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -147,7 +147,7 @@ c_textual_element_type (struct type *type, char format)
 
 int
 c_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 *original_value,
 	     const struct value_print_options *options)
@@ -416,7 +416,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
 	  /* Print vtable entry - we only get here if NOT using
 	     -fvtable_thunks.  (Otherwise, look under
 	     TYPE_CODE_PTR.)  */
-	  int offset = (embedded_offset
+	  LONGEST offset = (embedded_offset
 			+ TYPE_FIELD_BITPOS (type,
 					     VTBL_FNADDR_OFFSET) / 8);
 	  struct type *field_type = TYPE_FIELD_TYPE (type,
diff --git a/gdb/d-lang.h b/gdb/d-lang.h
index 67ca14c..e2cda03 100644
--- a/gdb/d-lang.h
+++ b/gdb/d-lang.h
@@ -25,7 +25,7 @@
 extern char *d_demangle (const char *mangled, int options);
 
 extern int d_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);
diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c
index 527c087..6c7921e 100644
--- a/gdb/d-valprint.c
+++ b/gdb/d-valprint.c
@@ -70,7 +70,7 @@ dynamic_array_type (struct type *type, const gdb_byte *valaddr,
 
 /* Implements the la_val_print routine for language D.  */
 int
-d_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
+d_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)
diff --git a/gdb/eval.c b/gdb/eval.c
index 9913a72..0922596 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -319,7 +319,8 @@ evaluate_struct_tuple (struct value *struct_val,
       int pc = *pos;
       struct value *val = NULL;
       int nlabels = 0;
-      int bitpos, bitsize;
+      int bitsize;
+      LONGEST bitpos;
       bfd_byte *addr;
 
       /* Skip past the labels, and count them.  */
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
index 4e5563d..e6407b7 100644
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -28,7 +28,7 @@ extern void f_error (char *);	/* Defined in f-exp.y */
 extern void f_print_type (struct type *, const char *, struct ui_file *, int,
 			  int);
 
-extern int f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
+extern int f_val_print (struct type *, const gdb_byte *, LONGEST, CORE_ADDR,
 			struct ui_file *, int,
 			const struct value *,
 			const struct value_print_options *);
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 17f747f..3b55640 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -247,7 +247,7 @@ Type node corrupt! F77 arrays cannot have %d subscripts (%d Max)"),
    also identical to val_print.  */
 
 int
-f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
+f_val_print (struct type *type, const gdb_byte *valaddr, LONGEST embedded_offset,
 	     CORE_ADDR address, struct ui_file *stream, int recurse,
 	     const struct value *original_value,
 	     const struct value_print_options *options)
@@ -498,7 +498,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       fprintf_filtered (stream, "( ");
       for (index = 0; index < TYPE_NFIELDS (type); index++)
         {
-          int offset = TYPE_FIELD_BITPOS (type, index) / 8;
+          LONGEST offset = TYPE_FIELD_BITPOS (type, index) / 8;
 
           val_print (TYPE_FIELD_TYPE (type, index), valaddr,
 		     embedded_offset + offset,
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index b6e8b4c..7f4d1ef 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3198,7 +3198,7 @@ recursive_dump_type (struct type *type, int spaces)
   for (idx = 0; idx < TYPE_NFIELDS (type); idx++)
     {
       printfi_filtered (spaces + 2,
-			"[%d] bitpos %d bitsize %d type ",
+			"[%d] bitpos %ld bitsize %d type ",
 			idx, TYPE_FIELD_BITPOS (type, idx),
 			TYPE_FIELD_BITSIZE (type, idx));
       gdb_print_host_address (TYPE_FIELD_TYPE (type, idx), gdb_stdout);
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index cddd2d0..3f4e849 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -514,7 +514,7 @@ struct main_type
 	   the LSB.  For a range bound or enum value, this is the
 	   value itself.  */
 
-	int bitpos;
+	LONGEST bitpos;
 
 	/* For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then physaddr
 	   is the location (in the target) of the static field.
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index 18a7c19..9323c0b 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -438,7 +438,7 @@ java_link_class_type (struct gdbarch *gdbarch,
   for (i = TYPE_N_BASECLASSES (type); i < nfields; i++)
     {
       int accflags;
-      int boffset;
+      LONGEST boffset;
 
       if (fields == NULL)
 	{
diff --git a/gdb/jv-lang.h b/gdb/jv-lang.h
index d061096..4380a42 100644
--- a/gdb/jv-lang.h
+++ b/gdb/jv-lang.h
@@ -42,7 +42,7 @@ struct builtin_java_type
 
 extern const struct builtin_java_type *builtin_java_type (struct gdbarch *);
 
-extern int java_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
+extern int java_val_print (struct type *, const gdb_byte *, LONGEST, CORE_ADDR,
 			   struct ui_file *, int,
 			   const struct value *,
 			   const struct value_print_options *);
diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c
index d430ba0..914d871 100644
--- a/gdb/jv-valprint.c
+++ b/gdb/jv-valprint.c
@@ -261,7 +261,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,
@@ -480,7 +480,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
 
 int
 java_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)
diff --git a/gdb/language.c b/gdb/language.c
index 49ba21a..1850880 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -849,7 +849,7 @@ unk_lang_print_type (struct type *type, const char *varstring,
 
 static int
 unk_lang_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)
diff --git a/gdb/language.h b/gdb/language.h
index a47a44d..c20c581 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -242,7 +242,7 @@ struct language_defn
 
     int (*la_val_print) (struct type *type,
 			 const gdb_byte *contents,
-			 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/m2-lang.h b/gdb/m2-lang.h
index 2803e63..865e8fb 100644
--- a/gdb/m2-lang.h
+++ b/gdb/m2-lang.h
@@ -32,7 +32,7 @@ extern void m2_print_typedef (struct type *, struct symbol *,
 extern int m2_is_long_set (struct type *type);
 extern int m2_is_unbounded_array (struct type *type);
 
-extern int m2_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
+extern int m2_val_print (struct type *, const gdb_byte *, LONGEST, CORE_ADDR,
 			 struct ui_file *, int,
 			 const struct value *,
 			 const struct value_print_options *);
diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c
index 9735d7f..6c5dc43 100644
--- a/gdb/m2-typeprint.c
+++ b/gdb/m2-typeprint.c
@@ -587,7 +587,8 @@ m2_record_fields (struct type *type, struct ui_file *stream, int show,
 void
 m2_enum (struct type *type, struct ui_file *stream, int show, int level)
 {
-  int lastval, i, len;
+  LONGEST lastval;
+  int i, len;
 
   if (show < 0)
     {
@@ -609,7 +610,7 @@ m2_enum (struct type *type, struct ui_file *stream, int show, int level)
 	  fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
 	  if (lastval != TYPE_FIELD_BITPOS (type, i))
 	    {
-	      fprintf_filtered (stream, " = %d", TYPE_FIELD_BITPOS (type, i));
+	      fprintf_filtered (stream, " = %ld", TYPE_FIELD_BITPOS (type, i));
 	      lastval = TYPE_FIELD_BITPOS (type, i);
 	    }
 	  lastval++;
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index 4378b00..4a7977f 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -36,7 +36,7 @@ static int print_unpacked_pointer (struct type *type,
 				   struct ui_file *stream);
 static void
 m2_print_array_contents (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,
@@ -89,7 +89,7 @@ get_long_set_bounds (struct type *type, LONGEST *low, LONGEST *high)
 
 static void
 m2_print_long_set (struct type *type, const gdb_byte *valaddr,
-		   int embedded_offset, CORE_ADDR address,
+		   LONGEST embedded_offset, CORE_ADDR address,
 		   struct ui_file *stream)
 {
   int empty_set        = 1;
@@ -180,7 +180,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
 
 static void
 m2_print_unbounded_array (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_print_options *options)
 {
@@ -277,7 +277,7 @@ print_variable_at_address (struct type *type,
 
 static void
 m2_print_array_contents (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,
@@ -315,7 +315,7 @@ m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
    also identical to val_print.  */
 
 int
-m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
+m2_val_print (struct type *type, const gdb_byte *valaddr, LONGEST embedded_offset,
 	      CORE_ADDR address, struct ui_file *stream, int recurse,
 	      const struct value *original_value,
 	      const struct value_print_options *options)
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index a670cd3..68f8e70 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -289,7 +289,7 @@ static void
 mips_xfer_register (struct gdbarch *gdbarch, struct regcache *regcache,
 		    int reg_num, int length,
 		    enum bfd_endian endian, gdb_byte *in,
-		    const gdb_byte *out, int buf_offset)
+		    const gdb_byte *out, LONGEST buf_offset)
 {
   int reg_offset = 0;
 
@@ -312,7 +312,7 @@ mips_xfer_register (struct gdbarch *gdbarch, struct regcache *regcache,
     }
   if (mips_debug)
     fprintf_unfiltered (gdb_stderr,
-			"xfer $%d, reg offset %d, buf offset %d, length %d, ",
+			"xfer $%d, reg offset %d, buf offset %ld, length %d, ",
 			reg_num, reg_offset, buf_offset, length);
   if (mips_debug && out != NULL)
     {
@@ -3221,7 +3221,7 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct type *func_type,
 
 static int
 mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
-			    int offset)
+			    LONGEST offset)
 {
   int i;
 
@@ -3236,7 +3236,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
 
   for (i = 0; i < TYPE_NFIELDS (arg_type); i++)
     {
-      int pos;
+      LONGEST pos;
       struct type *field_type;
 
       /* We're only looking at normal fields.  */
@@ -3630,10 +3630,10 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct type *func_type,
 				: MIPS_V0_REGNUM);
 	   field < TYPE_NFIELDS (type); field++, regnum += 2)
 	{
-	  int offset = (FIELD_BITPOS (TYPE_FIELDS (type)[field])
+	  LONGEST offset = (FIELD_BITPOS (TYPE_FIELDS (type)[field])
 			/ TARGET_CHAR_BIT);
 	  if (mips_debug)
-	    fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n",
+	    fprintf_unfiltered (gdb_stderr, "Return float struct+%ld\n",
 				offset);
 	  if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)) == 16)
 	    {
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 826d24f..80c1c68 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -96,8 +96,8 @@ pascal_main_name (void)
    are not multiple of TARGET_CHAR_BIT then the results are wrong
    but this does not happen for Free Pascal nor for GPC.  */
 int
-is_pascal_string_type (struct type *type,int *length_pos,
-                       int *length_size, int *string_pos,
+is_pascal_string_type (struct type *type,LONGEST *length_pos,
+                       int *length_size, LONGEST *string_pos,
 		       struct type **char_type,
 		       const char **arrayname)
 {
diff --git a/gdb/p-lang.h b/gdb/p-lang.h
index 180c544..350af71 100644
--- a/gdb/p-lang.h
+++ b/gdb/p-lang.h
@@ -35,7 +35,7 @@ extern void pascal_print_type (struct type *, const char *, struct ui_file *,
 extern void pascal_print_typedef (struct type *, struct symbol *,
 				  struct ui_file *);
 
-extern int pascal_val_print (struct type *, const gdb_byte *, int,
+extern int pascal_val_print (struct type *, const gdb_byte *, LONGEST,
 			     CORE_ADDR, struct ui_file *, int,
 			     const struct value *,
 			     const struct value_print_options *);
@@ -49,7 +49,7 @@ extern void pascal_type_print_method_args (const char *, const char *,
 /* These are in p-lang.c: */
 
 extern int
-  is_pascal_string_type (struct type *, int *, int *, int *,
+  is_pascal_string_type (struct type *, LONGEST *, int *, LONGEST *,
 			 struct type **, const char **);
 
 extern void pascal_printchar (int, struct type *, struct ui_file *);
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
index ab82d90..096776d 100644
--- a/gdb/p-typeprint.c
+++ b/gdb/p-typeprint.c
@@ -443,7 +443,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
 {
   int i;
   int len;
-  int lastval;
+  LONGEST lastval;
   enum
     {
       s_none, s_public, s_private, s_protected
@@ -754,7 +754,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
 	      if (lastval != TYPE_FIELD_BITPOS (type, i))
 		{
 		  fprintf_filtered (stream,
-				    " := %d", TYPE_FIELD_BITPOS (type, i));
+				    " := %ld", TYPE_FIELD_BITPOS (type, i));
 		  lastval = TYPE_FIELD_BITPOS (type, i);
 		}
 	      lastval++;
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 39eff10..f80e58f 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -47,7 +47,7 @@
 
 int
 pascal_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 *original_value,
 		  const struct value_print_options *options)
@@ -59,7 +59,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
   LONGEST low_bound, high_bound;
   struct type *elttype;
   unsigned eltlen;
-  int length_pos, length_size, string_pos;
+  LONGEST length_pos, string_pos;
+  int length_size;
   struct type *char_type;
   LONGEST val;
   CORE_ADDR addr;
diff --git a/gdb/regcache.c b/gdb/regcache.c
index c716280..12ed8fa 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -902,7 +902,7 @@ typedef void (regcache_write_ftype) (struct regcache *regcache, int regnum,
 
 static enum register_status
 regcache_xfer_part (struct regcache *regcache, int regnum,
-		    int offset, int len, void *in, const void *out,
+		    LONGEST offset, int len, void *in, const void *out,
 		    enum register_status (*read) (struct regcache *regcache,
 						  int regnum,
 						  gdb_byte *buf),
@@ -968,7 +968,7 @@ regcache_raw_write_part (struct regcache *regcache, int regnum,
 
 enum register_status
 regcache_cooked_read_part (struct regcache *regcache, int regnum,
-			   int offset, int len, gdb_byte *buf)
+			   LONGEST offset, int len, gdb_byte *buf)
 {
   struct regcache_descr *descr = regcache->descr;
 
@@ -979,7 +979,7 @@ regcache_cooked_read_part (struct regcache *regcache, int regnum,
 
 void
 regcache_cooked_write_part (struct regcache *regcache, int regnum,
-			    int offset, int len, const gdb_byte *buf)
+			    LONGEST offset, int len, const gdb_byte *buf)
 {
   struct regcache_descr *descr = regcache->descr;
 
diff --git a/gdb/regcache.h b/gdb/regcache.h
index 93b4499..81ccda6 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -129,10 +129,10 @@ extern void regcache_cooked_write_unsigned (struct regcache *regcache,
    write style operations.  */
 
 enum register_status regcache_cooked_read_part (struct regcache *regcache,
-						int regnum, int offset,
+						int regnum, LONGEST offset,
 						int len, gdb_byte *buf);
 void regcache_cooked_write_part (struct regcache *regcache, int regnum,
-				 int offset, int len, const gdb_byte *buf);
+				 LONGEST offset, int len, const gdb_byte *buf);
 
 /* Special routines to read/write the PC.  */
 
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 327eefe..1fe0cd7 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -639,7 +639,7 @@ sparc64_16_byte_align_p (struct type *type)
 
 static void
 sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
-			       const gdb_byte *valbuf, int element, int bitpos)
+			       const gdb_byte *valbuf, int element, LONGEST bitpos)
 {
   int len = TYPE_LENGTH (type);
 
@@ -681,7 +681,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
       for (i = 0; i < TYPE_NFIELDS (type); i++)
 	{
 	  struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
-	  int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
+	  LONGEST subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
 
 	  sparc64_store_floating_fields (regcache, subtype, valbuf,
 					 element, subpos);
@@ -713,7 +713,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
 
 static void
 sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
-				 gdb_byte *valbuf, int bitpos)
+				 gdb_byte *valbuf, LONGEST bitpos)
 {
   if (sparc64_floating_p (type))
     {
@@ -750,7 +750,7 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
       for (i = 0; i < TYPE_NFIELDS (type); i++)
 	{
 	  struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
-	  int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
+	  LONGEST subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
 
 	  sparc64_extract_floating_fields (regcache, subtype, valbuf, subpos);
 	}
diff --git a/gdb/valops.c b/gdb/valops.c
index fca601f..d4c567a 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -53,11 +53,11 @@ static int typecmp (int staticp, int varargs, int nargs,
 		    struct field t1[], struct value *t2[]);
 
 static struct value *search_struct_field (const char *, struct value *, 
-					  int, struct type *, int);
+					  LONGEST, struct type *, int);
 
 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 *,
@@ -85,7 +85,7 @@ oload_classification classify_oload_match (struct badness_vector *,
 					   int, int);
 
 static struct value *value_struct_elt_for_reference (struct type *,
-						     int, struct type *,
+						     LONGEST, struct type *,
 						     char *,
 						     struct type *,
 						     int, enum noside);
@@ -102,7 +102,7 @@ static CORE_ADDR allocate_space_in_inferior (int);
 static struct value *cast_into_complex (struct type *, struct value *);
 
 static struct fn_field *find_method_list (struct value **, const char *,
-					  int, struct type *, int *,
+					  LONGEST, struct type *, int *,
 					  struct type **, int *);
 
 void _initialize_valops (void);
@@ -1993,7 +1993,7 @@ typecmp (int staticp, int varargs, int nargs,
    fields, look for a baseclass named NAME.  */
 
 static struct value *
-search_struct_field (const char *name, struct value *arg1, int offset,
+search_struct_field (const char *name, struct value *arg1, LONGEST offset,
 		     struct type *type, int looking_for_baseclass)
 {
   int i;
@@ -2051,7 +2051,7 @@ search_struct_field (const char *name, struct value *arg1, int offset,
 		   <variant field>.  */
 
 		struct value *v;
-		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
@@ -2152,7 +2152,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;
@@ -2216,7 +2216,7 @@ search_struct_method (const char *name, struct value **arg1p,
 
   for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--)
     {
-      int base_offset;
+      LONGEST base_offset;
       int skip = 0;
       int this_offset;
 
@@ -2394,7 +2394,7 @@ value_struct_elt (struct value **argp, struct value **args,
 
 static struct fn_field *
 find_method_list (struct value **argp, const char *method,
-		  int offset, struct type *type, int *num_fns,
+		  LONGEST offset, struct type *type, int *num_fns,
 		  struct type **basetype, int *boffset)
 {
   int i;
@@ -2428,7 +2428,7 @@ find_method_list (struct value **argp, const char *method,
   /* Not found in object, check in base subobjects.  */
   for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--)
     {
-      int base_offset;
+      LONGEST base_offset;
 
       if (BASETYPE_VIA_VIRTUAL (type, i))
 	{
@@ -3263,7 +3263,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
    the form "DOMAIN::NAME".  */
 
 static struct value *
-value_struct_elt_for_reference (struct type *domain, int offset,
+value_struct_elt_for_reference (struct type *domain, LONGEST offset,
 				struct type *curtype, char *name,
 				struct type *intype, 
 				int want_address,
@@ -3300,7 +3300,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
 	  if (want_address)
 	    return value_from_longest
 	      (lookup_memberptr_type (TYPE_FIELD_TYPE (t, i), domain),
-	       offset + (LONGEST) (TYPE_FIELD_BITPOS (t, i) >> 3));
+	       offset + (TYPE_FIELD_BITPOS (t, i) >> 3));
 	  else if (noside == EVAL_AVOID_SIDE_EFFECTS)
 	    return allocate_value (TYPE_FIELD_TYPE (t, i));
 	  else
@@ -3443,7 +3443,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
   for (i = TYPE_N_BASECLASSES (t) - 1; i >= 0; i--)
     {
       struct value *v;
-      int base_offset;
+      LONGEST base_offset;
 
       if (BASETYPE_VIA_VIRTUAL (t, i))
 	base_offset = 0;
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 325cf40..9544720 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -336,7 +336,7 @@ val_print_invalid_address (struct ui_file *stream)
    characters printed.  */
 
 int
-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,
@@ -556,7 +556,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,
diff --git a/gdb/valprint.h b/gdb/valprint.h
index a34d09b..319e8e7 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -127,7 +127,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 583be33..49a6f43 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -308,7 +308,7 @@ struct value
      `type', and `embedded_offset' is zero, so everything works
      normally.  */
   struct type *enclosing_type;
-  int embedded_offset;
+  LONGEST embedded_offset;
   int pointed_to_offset;
 
   /* Values are stored in a chain, so that they can be deleted easily
@@ -1019,7 +1019,7 @@ value_entirely_optimized_out (const struct value *value)
 }
 
 int
-value_bits_valid (const struct value *value, int offset, int length)
+value_bits_valid (const struct value *value, LONGEST offset, int length)
 {
   if (!value->optimized_out)
     return 1;
@@ -1032,7 +1032,7 @@ value_bits_valid (const struct value *value, int offset, int length)
 
 int
 value_bits_synthetic_pointer (const struct value *value,
-			      int offset, int length)
+			      LONGEST offset, int length)
 {
   if (value->lval != lval_computed
       || !value->location.computed.funcs->check_synthetic_pointer)
@@ -2496,7 +2496,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;
@@ -2526,7 +2526,7 @@ 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);
+      LONGEST bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno);
       int container_bitsize = TYPE_LENGTH (type) * 8;
 
       v = allocate_value_lazy (type);
@@ -2674,7 +2674,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
 
 static int
 unpack_value_bits_as_long_1 (struct type *field_type, const gdb_byte *valaddr,
-			     int embedded_offset, int bitpos, int bitsize,
+			     LONGEST embedded_offset, int bitpos, int bitsize,
 			     const struct value *original_value,
 			     LONGEST *result)
 {
@@ -2774,7 +2774,7 @@ unpack_value_field_as_long_1 (struct type *type, const gdb_byte *valaddr,
 			      int embedded_offset, int fieldno,
 			      const struct value *val, LONGEST *result)
 {
-  int bitpos = TYPE_FIELD_BITPOS (type, fieldno);
+  LONGEST bitpos = TYPE_FIELD_BITPOS (type, fieldno);
   int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
   struct type *field_type = TYPE_FIELD_TYPE (type, fieldno);
 
@@ -2849,12 +2849,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, int 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;
diff --git a/gdb/value.h b/gdb/value.h
index 2a2274d..3ab523b 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -367,13 +367,13 @@ extern struct value *coerce_array (struct value *value);
    bits in the given range are valid, zero if any bit is invalid.  */
 
 extern int value_bits_valid (const struct value *value,
-			     int offset, int length);
+			     LONGEST offset, int length);
 
 /* Given a value, determine whether the bits starting at OFFSET and
    extending for LENGTH bits are a synthetic pointer.  */
 
 extern int value_bits_synthetic_pointer (const struct value *value,
-					 int offset, int length);
+					 LONGEST offset, int length);
 
 /* Given a value, determine whether the contents bytes starting at
    OFFSET and extending for LENGTH bytes are available.  This returns
@@ -610,7 +610,7 @@ 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);
 
@@ -775,7 +775,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, int bitsize);
 
 extern void type_print (struct type *type, const char *varstring,
 			struct ui_file *stream, int show);
@@ -805,7 +805,7 @@ extern void value_print_array_elements (struct value *val,
 extern struct value *value_release_to_mark (struct value *mark);
 
 extern int 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,

             reply	other threads:[~2012-02-20 13:27 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-20 14:53 Siddhesh Poyarekar [this message]
2012-02-21 20:46 ` Tom Tromey
2012-02-22  7:44   ` Siddhesh Poyarekar
2012-02-29 13:55   ` Siddhesh Poyarekar
2012-02-29 13:59     ` Siddhesh Poyarekar
2012-03-01 22:45     ` Jan Kratochvil
2012-03-05  6:34       ` Siddhesh Poyarekar
2012-03-05  8:05         ` Jan Kratochvil
2012-03-21 10:06           ` [PATCH] Allow 64-bit enum values Siddhesh Poyarekar
2012-03-27 17:00             ` Jan Kratochvil
2012-03-28  4:19               ` Siddhesh Poyarekar
2012-03-30 16:15                 ` Jan Kratochvil
2012-04-17 14:01                   ` Jan Kratochvil
2012-04-18  2:53                     ` Siddhesh Poyarekar
2012-04-18  6:58                       ` [commit] " Jan Kratochvil
2012-04-18  7:06                         ` [ChangeLog commit] " Jan Kratochvil
2012-04-19 16:58                         ` [commit] " Ulrich Weigand
2012-04-20  4:23                           ` Siddhesh Poyarekar
2012-04-20  7:50                             ` [obv] Fix python-2.4 compilation compat. [Re: [commit] [PATCH] Allow 64-bit enum values] Jan Kratochvil
2012-04-20 19:00                               ` Tom Tromey
2012-03-28 16:55             ` [PATCH] Allow 64-bit enum values Tom Tromey
2012-03-29 10:56               ` Siddhesh Poyarekar
2012-04-17 13:11             ` [commit] Support 64-bit constants/enums on 32-bit host [Re: [PATCH] Allow 64-bit enum values] Jan Kratochvil
2012-04-17 13:16               ` [patch!] " Jan Kratochvil
2012-04-17 14:33               ` [commit] " Tom Tromey
2012-04-17 14:55                 ` Jan Kratochvil
2012-04-17 15:18                   ` Tom Tromey
2012-04-17 15:32                     ` Jan Kratochvil
2012-04-17 19:32                 ` Jan Kratochvil
2012-04-17 20:51                   ` Tom Tromey
2012-04-18  7:01                     ` [real commit] " Jan Kratochvil
2012-04-17 14:33               ` [patch] " Jan Kratochvil
2012-04-17 15:59                 ` Tom Tromey
2012-04-17 15:42                   ` Jan Kratochvil
2012-04-17 15:52                     ` Tom Tromey
2012-02-21 21:39 ` [PATCH] Expand bitpos to LONGEST to allow access to large offsets within a struct Jan Kratochvil
2012-05-04 13:10   ` [PATCH v2] Expand bitpos and type.length to LONGEST and ULONGEST Siddhesh Poyarekar
2012-05-15  9:46     ` ping: " Siddhesh Poyarekar
2012-05-15  9:49       ` Jan Kratochvil
2012-05-15 10:02         ` Siddhesh Poyarekar
2012-05-15 20:07     ` Jan Kratochvil
2012-05-16  3:50       ` Siddhesh Poyarekar
2012-05-16  7:19         ` Jan Kratochvil
2012-05-16  7:41           ` Siddhesh Poyarekar
2012-05-20 15:43             ` Doug Evans
2012-05-20 20:24               ` Jan Kratochvil
2012-05-20 20:28                 ` Doug Evans
2012-05-23 13:52       ` Siddhesh Poyarekar
2012-05-23 17:46         ` Jan Kratochvil
2012-05-24  1:36           ` Siddhesh Poyarekar
2012-05-24 15:01             ` Jan Kratochvil
2012-05-31 18:15               ` [PATCH v3] " Siddhesh Poyarekar
2012-06-05 22:27                 ` Jan Kratochvil
2012-06-06 18:23                   ` Siddhesh Poyarekar
2012-06-06 21:34                     ` Jan Kratochvil
2012-06-08 14:16                       ` Jan Kratochvil
2012-06-08 15:27                         ` Jan Kratochvil
2012-06-11 12:53                           ` Siddhesh Poyarekar
2012-06-11 13:00                             ` Jan Kratochvil
2012-06-11 18:33                               ` Siddhesh Poyarekar
2012-06-12  9:56                                 ` Jan Kratochvil
2012-06-12 14:35                                   ` Jan Kratochvil
2012-06-18 10:31                                     ` [1/2][PATCH " Siddhesh Poyarekar
2012-06-20 15:47                                       ` Jan Kratochvil
2012-06-20 16:32                                         ` Siddhesh Poyarekar
2012-06-20 17:25                                           ` Jan Kratochvil
2012-06-23  1:59                                         ` Siddhesh Poyarekar
2012-06-18 10:31                                     ` [2/2][PATCH " Siddhesh Poyarekar
2012-05-31  6:39           ` [PATCH v2] " Siddhesh Poyarekar
2012-05-31  9:24             ` Siddhesh Poyarekar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120220132724.GB4753@spoyarek.pnq.redhat.com \
    --to=siddhesh@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox