From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8116 invoked by alias); 1 Mar 2012 22:45:47 -0000 Received: (qmail 8061 invoked by uid 22791); 1 Mar 2012 22:45:33 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_EG,TW_FN,TW_VT,TW_XF,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 01 Mar 2012 22:45:01 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q21Mj02Q025716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 1 Mar 2012 17:45:01 -0500 Received: from host2.jankratochvil.net (ovpn-116-19.ams2.redhat.com [10.36.116.19]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q21MiS2G016887 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 1 Mar 2012 17:44:31 -0500 Date: Thu, 01 Mar 2012 22:45:00 -0000 From: Jan Kratochvil To: Siddhesh Poyarekar Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH] Expand bitpos to LONGEST to allow access to large offsets within a struct Message-ID: <20120301224428.GA30631@host2.jankratochvil.net> References: <20120220132724.GB4753@spoyarek.pnq.redhat.com> <87d397syts.fsf@fleche.redhat.com> <20120229135148.GA32128@spoyarek.pnq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120229135148.GA32128@spoyarek.pnq.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-03/txt/msg00052.txt.bz2 On Wed, 29 Feb 2012 14:51:51 +0100, Siddhesh Poyarekar wrote: > There is one problem that still remains that I haven't fixed yet, > which is the size of TYPE_FIELD. It is currently unsigned int, which > is less than sizeof(bitpos) now. This looks wrong since bitpos is > considered an offset within these types and it seems possible to have > an offset larger than the total size right now. There are a couple of > places where this comes into play, but fixing this in the same patch > would mean another 2.5k lines in the patch. I can work on this on my > free time later if not having it in this change is OK I fully agree. But to make this patch really working for struct offsets (and not just enum's) one needs to also extend the type->length width. I am sorry but it will be a big patch. > * (gdb.base/structs4.c, gdb.base/structs4.exp): New test case. This should be written as - for example: * gdb.base/structs4.c, gdb.base/structs4.exp: New test files. And please choose some arbitrary name expressing what it tests, not "4", such as struct-64bit-offset or anything of your idea. Some patched lines exceed 80 character, please fix them, these lines: -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, -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, -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, - int offset = baseclass_offset (search_type, i, valaddr, embedded_offset, + LONGEST offset = baseclass_offset (search_type, i, valaddr, embedded_offset, -extern int value_available_contents_eq (const struct value *val1, int offset1, - const struct value *val2, int offset2, +extern int value_available_contents_eq (const struct value *val1, LONGEST offset1, + const struct value *val2, LONGEST offset2, splint gives nice advices, thanks for the idea. I think it would not give a warning if there is incorrectly used 'long' instead of LONGEST'. Still neded to fix: gnu-v2-abi.c:269:9: Assignment of long int to int: *top = (((rtti_type)->main_type->flds_bnds.fields[(rtti_type)->main_type->vp tr_fieldno]).loc.bitpos) / 8 Therefore: gnuv2_value_rtti_type: 3rd parameter should be: int *top -> LONGEST *top (It will introduce some more sources changes. > diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c > index 107df93..f743db1 100644 > --- a/gdb/ada-lang.c > +++ b/gdb/ada-lang.c > @@ -80,7 +80,7 @@ static struct type *desc_bounds_type (struct type *); > > static struct value *desc_bounds (struct value *); > > -static int fat_pntr_bounds_bitpos (struct type *); > +static LONGEST fat_pntr_bounds_bitpos (struct type *); > > static int fat_pntr_bounds_bitsize (struct type *); > > @@ -88,13 +88,13 @@ static struct type *desc_data_target_type (struct type *); > > static struct value *desc_data (struct value *); > > -static int fat_pntr_data_bitpos (struct type *); > +static LONGEST fat_pntr_data_bitpos (struct type *); > > static int fat_pntr_data_bitsize (struct type *); > > static struct value *desc_one_bound (struct value *, int, int); > > -static int desc_bound_bitpos (struct type *, int, int); > +static LONGEST desc_bound_bitpos (struct type *, int, int); > > static int desc_bound_bitsize (struct type *, int, int); > > @@ -217,14 +217,14 @@ static struct value *value_val_atr (struct type *, struct value *); > static struct symbol *standard_lookup (const char *, const struct block *, > domain_enum); > > -static struct value *ada_search_struct_field (char *, struct value *, int, > +static struct value *ada_search_struct_field (char *, struct value *, LONGEST, > struct type *); > > -static struct value *ada_value_primitive_field (struct value *, int, int, > +static struct value *ada_value_primitive_field (struct value *, LONGEST, int, > struct type *); > > -static int find_struct_field (const char *, struct type *, int, > - struct type **, int *, int *, int *, int *); > +static int find_struct_field (const char *, struct type *, LONGEST, > + struct type **, LONGEST *, int *, int *, int *); > > static struct value *ada_to_fixed_value_create (struct type *, CORE_ADDR, > struct value *); > @@ -240,7 +240,7 @@ static void ada_language_arch_info (struct gdbarch *, > > static void check_size (const struct type *); > > -static struct value *ada_index_struct_field (int, struct value *, int, > +static struct value *ada_index_struct_field (LONGEST, struct value *, LONGEST, > struct type *); > > static struct value *assign_aggregate (struct value *, struct value *, > @@ -584,7 +584,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type) > } > > static const gdb_byte * > -cond_offset_host (const gdb_byte *valaddr, long offset) > +cond_offset_host (const gdb_byte *valaddr, LONGEST offset) > { > if (valaddr == NULL) > return NULL; > @@ -593,7 +593,7 @@ cond_offset_host (const gdb_byte *valaddr, long offset) > } > > static CORE_ADDR > -cond_offset_target (CORE_ADDR address, long offset) > +cond_offset_target (CORE_ADDR address, LONGEST offset) > { > if (address == 0) > return 0; > @@ -1559,7 +1559,7 @@ desc_bounds (struct value *arr) > /* If TYPE is the type of an array-descriptor (fat pointer), the bit > position of the field containing the address of the bounds data. */ > > -static int > +static LONGEST > fat_pntr_bounds_bitpos (struct type *type) > { > return TYPE_FIELD_BITPOS (desc_base_type (type), 1); > @@ -1625,7 +1625,7 @@ desc_data (struct value *arr) > /* If TYPE is the type of an array-descriptor (fat pointer), the bit > position of the field containing the address of the data. */ > > -static int > +static LONGEST > fat_pntr_data_bitpos (struct type *type) > { > return TYPE_FIELD_BITPOS (desc_base_type (type), 0); > @@ -1660,7 +1660,7 @@ desc_one_bound (struct value *bounds, int i, int which) > of the Ith lower bound stored in it, if WHICH is 0, and the Ith upper > bound, if WHICH is 1. The first bound is I=1. */ > > -static int > +static LONGEST > desc_bound_bitpos (struct type *type, int i, int which) > { > return TYPE_FIELD_BITPOS (desc_base_type (type), 2 * i + which - 2); > @@ -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; > @@ -5950,7 +5950,7 @@ value_tag_from_contents_and_address (struct type *type, > const gdb_byte *valaddr, > CORE_ADDR address) > { > - int tag_byte_offset; > + LONGEST tag_byte_offset; > struct type *tag_type; > > if (find_struct_field ("_tag", type, 0, &tag_type, &tag_byte_offset, > @@ -6328,7 +6328,7 @@ ada_in_variant (LONGEST val, struct type *type, int field_num) > only in that it can handle packed values of arbitrary type. */ > > static struct value * > -ada_value_primitive_field (struct value *arg1, int offset, int fieldno, > +ada_value_primitive_field (struct value *arg1, LONGEST offset, int fieldno, > struct type *arg_type) > { > struct type *type; > @@ -6340,12 +6340,13 @@ 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), > offset + bit_pos / 8, > - bit_pos % 8, bit_size, type); > + (int)(bit_pos % 8), bit_size, > + type); GNU Coding Style would be '(int) (bit_pos % 8)'. But I do not see any need for the cast here. splint warning is not relevant in this case. > } > else > return value_primitive_field (arg1, offset, fieldno, arg_type); > @@ -6367,9 +6368,9 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno, > Returns 1 if found, 0 otherwise. */ > > static int > -find_struct_field (const char *name, struct type *type, int offset, > +find_struct_field (const char *name, struct type *type, LONGEST offset, > struct type **field_type_p, > - int *byte_offset_p, int *bit_offset_p, int *bit_size_p, > + LONGEST *byte_offset_p, int *bit_offset_p, int *bit_size_p, > int *index_p) > { > int i; > @@ -6387,8 +6388,8 @@ 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); > - int fld_offset = offset + bit_pos / 8; > + LONGEST bit_pos = TYPE_FIELD_BITPOS (type, i); > + LONGEST fld_offset = offset + bit_pos / 8; > const char *t_field_name = TYPE_FIELD_NAME (type, i); > > if (t_field_name == NULL) > @@ -6403,7 +6404,7 @@ find_struct_field (const char *name, struct type *type, int offset, > if (byte_offset_p != NULL) > *byte_offset_p = fld_offset; > if (bit_offset_p != NULL) > - *bit_offset_p = bit_pos % 8; > + *bit_offset_p = (int)(bit_pos % 8); Again. > if (bit_size_p != NULL) > *bit_size_p = bit_size; > return 1; > @@ -6458,7 +6459,7 @@ num_visible_fields (struct type *type) > Searches recursively through wrapper fields (e.g., '_parent'). */ > > static struct value * > -ada_search_struct_field (char *name, struct value *arg, int offset, > +ada_search_struct_field (char *name, struct value *arg, LONGEST offset, > struct type *type) > { > int i; > @@ -6491,7 +6492,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) > { > @@ -6509,8 +6510,8 @@ ada_search_struct_field (char *name, struct value *arg, int offset, > return NULL; > } > > -static struct value *ada_index_struct_field_1 (int *, struct value *, > - int, struct type *); > +static struct value *ada_index_struct_field_1 (LONGEST *, struct value *, > + LONGEST, struct type *); > > > /* Return field #INDEX in ARG, where the index is that returned by > @@ -6519,7 +6520,7 @@ static struct value *ada_index_struct_field_1 (int *, struct value *, > * If found, return value, else return NULL. */ > > static struct value * > -ada_index_struct_field (int index, struct value *arg, int offset, > +ada_index_struct_field (LONGEST index, struct value *arg, LONGEST offset, > struct type *type) > { > return ada_index_struct_field_1 (&index, arg, offset, type); > @@ -6531,7 +6532,7 @@ ada_index_struct_field (int index, struct value *arg, int offset, > * *INDEX_P. */ > > static struct value * > -ada_index_struct_field_1 (int *index_p, struct value *arg, int offset, > +ada_index_struct_field_1 (LONGEST *index_p, struct value *arg, LONGEST offset, > struct type *type) > { > int i; > @@ -6621,7 +6622,8 @@ ada_value_struct_elt (struct value *arg, char *name, int no_err) > v = ada_search_struct_field (name, arg, 0, t); > else > { > - int bit_offset, bit_size, byte_offset; > + int bit_offset, bit_size; > + LONGEST byte_offset; > struct type *field_type; > CORE_ADDR address; > > @@ -6929,7 +6931,7 @@ ada_coerce_ref (struct value *val0) > ALIGNMENT (a power of 2). */ > > static unsigned int > -align_value (unsigned int off, unsigned int alignment) > +align_value (LONGEST off, unsigned int alignment) > { > return (off + alignment - 1) & ~(alignment - 1); > } > @@ -7303,9 +7305,9 @@ ada_template_to_fixed_record_type_1 (struct type *type, > struct value *mark = value_mark (); > struct value *dval; > struct type *rtype; > - int nfields, bit_len; > + int nfields; > int variant_field; > - long off; > + LONGEST off, bit_len; > int fld_bit_len; > int f; > > @@ -7377,7 +7379,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..d79a2ba 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 *); > @@ -249,7 +249,7 @@ extern int ada_is_constrained_packed_array_type (struct type *); > > extern struct value *ada_value_primitive_packed_val (struct value *, > const gdb_byte *, > - long, int, int, > + LONGEST, int, int, > struct type *); > > extern struct type *ada_coerce_to_simple_array_type (struct type *); > diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c > index 5599278..de3ed5fa 100644 > --- a/gdb/ada-typeprint.c > +++ b/gdb/ada-typeprint.c > @@ -274,7 +274,8 @@ static void > print_enum_type (struct type *type, struct ui_file *stream) > { > int len = TYPE_NFIELDS (type); > - int i, lastval; > + LONGEST lastval; > + int i; > > fprintf_filtered (stream, "("); > wrap_here (" "); > @@ -289,7 +290,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, " => %s", plongest(TYPE_FIELD_BITPOS (type, i))); GNU Coding style: 'plongest (TYPE_FIELD_BITPOS ...' > lastval = TYPE_FIELD_BITPOS (type, i); > } > lastval += 1; > diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c > index f43f3e3..1f01260 100644 > --- a/gdb/ada-valprint.c > +++ b/gdb/ada-valprint.c > @@ -42,15 +42,15 @@ 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 *, > - int, struct type *, int); > + int, struct type *, LONGEST); > > 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,12 +936,12 @@ 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, > int comma_needed, > - struct type *outer_type, int outer_offset) > + struct type *outer_type, LONGEST outer_offset) > { > struct type *var_type = TYPE_FIELD_TYPE (type, field_num); > int which = ada_which_variant_applies (var_type, outer_type, > @@ -1048,11 +1048,11 @@ 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, > - struct type *outer_type, int outer_offset) > + struct type *outer_type, LONGEST outer_offset) > { > int i, len; > > @@ -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; > > @@ -1141,7 +1141,7 @@ print_field_values (struct type *type, const gdb_byte *valaddr, > v = ada_value_primitive_packed_val > (NULL, valaddr, > offset + bit_pos / HOST_CHAR_BIT, > - bit_pos % HOST_CHAR_BIT, > + (int)(bit_pos % HOST_CHAR_BIT), Again. > bit_size, TYPE_FIELD_TYPE (type, i)); > opts = *options; > opts.deref_ref = 0; > diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c > index ea65d0d..d52205f 100644 > --- a/gdb/amd64-tdep.c > +++ b/gdb/amd64-tdep.c > @@ -482,10 +482,10 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2]) > for (i = 0; i < TYPE_NFIELDS (type); i++) > { > struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i)); > - int pos = TYPE_FIELD_BITPOS (type, i) / 64; > + LONGEST pos = TYPE_FIELD_BITPOS (type, i) / 64; > enum amd64_reg_class subclass[2]; > int bitsize = TYPE_FIELD_BITSIZE (type, i); > - int endpos; > + LONGEST endpos; > > if (bitsize == 0) > bitsize = TYPE_LENGTH (subtype) * 8; > diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c > index 739677f..8eff381 100644 > --- a/gdb/ax-gdb.c > +++ b/gdb/ax-gdb.c > @@ -80,12 +80,12 @@ static void gen_traced_pop (struct gdbarch *, struct agent_expr *, > static void gen_sign_extend (struct agent_expr *, struct type *); > static void gen_extend (struct agent_expr *, struct type *); > static void gen_fetch (struct agent_expr *, struct type *); > -static void gen_left_shift (struct agent_expr *, int); > +static void gen_left_shift (struct agent_expr *, LONGEST); > > > 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, > @@ -567,7 +567,7 @@ gen_fetch (struct agent_expr *ax, struct type *type) > right shift it by -DISTANCE bits if DISTANCE < 0. This generates > unsigned (logical) right shifts. */ > static void > -gen_left_shift (struct agent_expr *ax, int distance) > +gen_left_shift (struct agent_expr *ax, LONGEST distance) > { > if (distance > 0) > { > @@ -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) > - / TARGET_CHAR_BIT) > - * TARGET_CHAR_BIT); > + 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; > @@ -1428,7 +1428,7 @@ gen_bitfield_ref (struct expression *exp, struct agent_expr *ax, > ax_simple (ax, aop_bit_or); > > /* Sign- or zero-extend the value as appropriate. */ > - ((TYPE_UNSIGNED (type) ? ax_zero_ext : ax_ext) (ax, end - start)); > + ((TYPE_UNSIGNED (type) ? ax_zero_ext : ax_ext) (ax, (int)(end - start))); Here I think ax_zero_ext and ax_ext should use LONGEST instead of the cast. (OK, one may argue a bit about it.) > > /* This is *not* an lvalue. Ugh. */ > value->kind = axs_rvalue; > @@ -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..7fc6f61 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 *); > @@ -118,14 +118,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-typeprint.c b/gdb/c-typeprint.c > index 21887c6..7a0f7e9 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,8 +1206,8 @@ 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", > - TYPE_FIELD_BITPOS (type, i)); > + fprintf_filtered (stream, " = %s", > + plongest(TYPE_FIELD_BITPOS (type, i))); Again: 'plongest (TYPE_FIELD_BITPOS ...'. > lastval = TYPE_FIELD_BITPOS (type, i); > } > lastval++; > 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); Wrong indentation of the continuing lines. > struct type *field_type = TYPE_FIELD_TYPE (type, > diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c > index e949088..c7afcd0 100644 > --- a/gdb/cp-abi.c > +++ b/gdb/cp-abi.c > @@ -68,13 +68,13 @@ is_operator_name (const char *name) > return (*current_cp_abi.is_operator_name) (name); > } > > -int > +LONGEST > 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; > - int res = 0; > + LONGEST res = 0; > > gdb_assert (current_cp_abi.baseclass_offset != NULL); > > @@ -98,7 +98,7 @@ baseclass_offset (struct type *type, int index, const gdb_byte *valaddr, > struct value * > value_virtual_fn_field (struct value **arg1p, > struct fn_field *f, int j, > - struct type *type, int offset) > + struct type *type, LONGEST offset) > { > if ((current_cp_abi.virtual_fn_field) == NULL) > return NULL; > diff --git a/gdb/cp-abi.h b/gdb/cp-abi.h > index 0f24e9a..6e6c26e 100644 > --- a/gdb/cp-abi.h > +++ b/gdb/cp-abi.h > @@ -108,7 +108,7 @@ extern struct value *value_virtual_fn_field (struct value **valuep, > struct fn_field *f, > int j, > struct type *type, > - int offset); > + LONGEST offset); > > > /* Try to find the run-time type of VALUE, using C++ run-time type > @@ -144,9 +144,9 @@ extern struct type *value_rtti_type (struct value *value, > contents of VAL. The result is the offset of the baseclass value > relative to (the address of)(ARG) + OFFSET. */ > > -extern int baseclass_offset (struct type *type, > +extern LONGEST baseclass_offset (struct type *type, > int index, const gdb_byte *valaddr, > - int embedded_offset, > + LONGEST embedded_offset, > CORE_ADDR address, > const struct value *val); Wrong indentation of the continuing lines. > > @@ -199,11 +199,11 @@ struct cp_abi_ops > struct value *(*virtual_fn_field) (struct value **arg1p, > struct fn_field * f, > int j, struct type * type, > - int offset); > + LONGEST offset); > struct type *(*rtti_type) (struct value *v, int *full, > int *top, int *using_enc); > - int (*baseclass_offset) (struct type *type, int index, > - const bfd_byte *valaddr, int embedded_offset, > + LONGEST (*baseclass_offset) (struct type *type, int index, > + const bfd_byte *valaddr, LONGEST embedded_offset, > CORE_ADDR address, const struct value *val); Wrong indentation of the continuing lines. > void (*print_method_ptr) (const gdb_byte *contents, > struct type *type, > diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c > index 1697006..563f759 100644 > --- a/gdb/cp-valprint.c > +++ b/gdb/cp-valprint.c > @@ -82,7 +82,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 *, > @@ -156,7 +156,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, > @@ -428,7 +428,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, > @@ -468,7 +468,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, > @@ -478,7 +478,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) > @@ -492,7 +492,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-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..813e9ee 100644 > --- a/gdb/d-valprint.c > +++ b/gdb/d-valprint.c > @@ -29,7 +29,7 @@ > a dynamic array. */ > 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) > @@ -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/dwarf2loc.c b/gdb/dwarf2loc.c > index 313df7b..9415300 100644 > --- a/gdb/dwarf2loc.c > +++ b/gdb/dwarf2loc.c > @@ -1391,7 +1391,7 @@ read_pieced_value (struct value *v) > cleanup = make_cleanup (free_current_contents, &buffer); > > contents = value_contents_raw (v); > - bits_to_skip = 8 * value_offset (v); > + bits_to_skip = (ULONGEST)(8 * value_offset (v)); Again, split warnings are not relevant for this, it has no functionality impact, the cast is not needed. > if (value_bitsize (v)) > { > bits_to_skip += value_bitpos (v); > @@ -1575,7 +1575,7 @@ write_pieced_value (struct value *to, struct value *from) > cleanup = make_cleanup (free_current_contents, &buffer); > > contents = value_contents (from); > - bits_to_skip = 8 * value_offset (to); > + bits_to_skip = (ULONGEST)(8 * value_offset (to)); Again. > if (value_bitsize (to)) > { > bits_to_skip += value_bitpos (to); > @@ -1717,7 +1717,7 @@ write_pieced_value (struct value *to, struct value *from) > implicit pointer. */ > > static int > -check_pieced_value_bits (const struct value *value, int bit_offset, > +check_pieced_value_bits (const struct value *value, LONGEST bit_offset, > int bit_length, > enum dwarf_value_location check_for) > { > @@ -1772,7 +1772,7 @@ check_pieced_value_bits (const struct value *value, int bit_offset, > } > > static int > -check_pieced_value_validity (const struct value *value, int bit_offset, > +check_pieced_value_validity (const struct value *value, LONGEST bit_offset, > int bit_length) > { > return check_pieced_value_bits (value, bit_offset, bit_length, > @@ -1791,7 +1791,7 @@ check_pieced_value_invalid (const struct value *value) > a synthetic pointer. */ > > static int > -check_pieced_synthetic_pointer (const struct value *value, int bit_offset, > +check_pieced_synthetic_pointer (const struct value *value, LONGEST bit_offset, > int bit_length) > { > return check_pieced_value_bits (value, bit_offset, bit_length, > @@ -1817,9 +1817,9 @@ 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; > struct dwarf_expr_piece *piece = NULL; > - LONGEST byte_offset; > + LONGEST byte_offset, bit_offset; > > type = check_typedef (value_type (value)); > if (TYPE_CODE (type) != TYPE_CODE_PTR) > 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..6c30cfd 100644 > --- a/gdb/f-valprint.c > +++ b/gdb/f-valprint.c > @@ -164,7 +164,7 @@ f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream) > static void > f77_print_array_1 (int nss, int ndimensions, 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, > @@ -215,7 +215,7 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, > > static void > f77_print_array (struct type *type, const gdb_byte *valaddr, > - int embedded_offset, > + LONGEST embedded_offset, > CORE_ADDR address, struct ui_file *stream, > int recurse, > const struct value *val, > @@ -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/findvar.c b/gdb/findvar.c > index 79c4221..4ae70b3 100644 > --- a/gdb/findvar.c > +++ b/gdb/findvar.c > @@ -631,7 +631,7 @@ void > read_frame_register_value (struct value *value, struct frame_info *frame) > { > struct gdbarch *gdbarch = get_frame_arch (frame); > - int offset = 0; > + LONGEST offset = 0; > int 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 b6e8b4c..60a9f23 100644 > --- a/gdb/gdbtypes.c > +++ b/gdb/gdbtypes.c > @@ -2137,8 +2137,8 @@ is_public_ancestor (struct type *base, struct type *dclass) > > static int > is_unique_ancestor_worker (struct type *base, struct type *dclass, > - int *offset, > - const gdb_byte *valaddr, int embedded_offset, > + LONGEST *offset, > + const gdb_byte *valaddr, LONGEST embedded_offset, > CORE_ADDR address, struct value *val) > { > int i, count = 0; > @@ -2149,7 +2149,7 @@ is_unique_ancestor_worker (struct type *base, struct type *dclass, > for (i = 0; i < TYPE_N_BASECLASSES (dclass) && count < 2; ++i) > { > struct type *iter; > - int this_offset; > + LONGEST this_offset; > > iter = check_typedef (TYPE_BASECLASS (dclass, i)); > > @@ -2190,7 +2190,7 @@ is_unique_ancestor_worker (struct type *base, struct type *dclass, > int > is_unique_ancestor (struct type *base, struct value *val) > { > - int offset = -1; > + LONGEST offset = -1; > > return is_unique_ancestor_worker (base, value_type (val), &offset, > value_contents_for_printing (val), > @@ -3198,8 +3198,8 @@ 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 ", > - idx, TYPE_FIELD_BITPOS (type, idx), > + "[%d] bitpos %s bitsize %d type ", > + idx, plongest(TYPE_FIELD_BITPOS (type, idx)), Again: 'plongest (TYPE_FIELD_BITPOS ...'. > 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 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/gnu-v2-abi.c b/gdb/gnu-v2-abi.c > index e635e8f..6312a10 100644 > --- a/gdb/gnu-v2-abi.c > +++ b/gdb/gnu-v2-abi.c > @@ -86,7 +86,7 @@ gnuv2_is_operator_name (const char *name) > TYPE is the type in which F is located. */ > static struct value * > gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, > - struct type * type, int offset) > + struct type * type, LONGEST offset) > { > struct value *arg1 = *arg1p; > struct type *type1 = check_typedef (value_type (arg1)); > @@ -342,9 +342,9 @@ vb_match (struct type *type, int index, struct type *basetype) > target). The result is the offset of the baseclass value relative > to (the address of)(ARG) + OFFSET. */ > > -static int > +static LONGEST > 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); > @@ -362,7 +362,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; > > @@ -387,7 +387,7 @@ gnuv2_baseclass_offset (struct type *type, int index, > /* Don't go through baseclass_offset, as that wraps > exceptions, thus, inner exceptions would be wrapped more > than once. */ > - int boffset = > + LONGEST boffset = > gnuv2_baseclass_offset (type, i, valaddr, > embedded_offset, address, val); > > diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c > index f015af6..afd404c 100644 > --- a/gdb/gnu-v3-abi.c > +++ b/gdb/gnu-v3-abi.c > @@ -180,7 +180,7 @@ vtable_ptrdiff_type (struct gdbarch *gdbarch) > /* Return the offset from the start of the imaginary `struct > gdb_gnu_v3_abi_vtable' object to the vtable's "address point" > (i.e., where objects' virtual table pointers point). */ > -static int > +static LONGEST > vtable_address_point_offset (struct gdbarch *gdbarch) > { > struct type *vtable_type = gdbarch_data (gdbarch, vtable_type_gdbarch_data); > @@ -383,7 +383,7 @@ gnuv3_get_virtual_fn (struct gdbarch *gdbarch, struct value *container, > static struct value * > gnuv3_virtual_fn_field (struct value **value_p, > struct fn_field *f, int j, > - struct type *vfn_base, int offset) > + struct type *vfn_base, LONGEST offset) > { > struct type *values_type = check_typedef (value_type (*value_p)); > struct gdbarch *gdbarch; > @@ -413,16 +413,16 @@ gnuv3_virtual_fn_field (struct value **value_p, > > -1 is returned on error. */ > > -static int > +static LONGEST > 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; > struct type *ptr_type; > struct value *vtable; > struct value *vbase_array; > - long int cur_base_offset, base_offset; > + LONGEST cur_base_offset, base_offset; > > /* Determine architecture. */ > gdbarch = get_type_arch (type); > @@ -489,7 +489,7 @@ gnuv3_find_method_in (struct type *domain, CORE_ADDR voffset, > we're out of luck. */ > for (i = 0; i < TYPE_N_BASECLASSES (domain); i++) > { > - int pos; > + LONGEST pos; > struct type *basetype; > > if (BASETYPE_VIA_VIRTUAL (domain, i)) > 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..26615b0 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,8 @@ 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, " = %s", > + plongest(TYPE_FIELD_BITPOS (type, i))); Again: 'plongest (TYPE_FIELD_BITPOS ...'. > 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..a09d19a 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,8 +312,8 @@ 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, ", > - reg_num, reg_offset, buf_offset, length); > + "xfer $%d, reg offset %d, buf offset %s, length %d, ", > + reg_num, reg_offset, plongest(buf_offset), length); Again: 'plongest (buf_offset)'. > if (mips_debug && out != NULL) > { > int i; > @@ -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,11 +3630,11 @@ 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); Wrong indentation of the continuing line. > if (mips_debug) > - fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n", > - offset); > + fprintf_unfiltered (gdb_stderr, "Return float struct+%s\n", > + plongest(offset)); Again: 'plongest (offset)'. > if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)) == 16) > { > /* A 16-byte long double field goes in two consecutive > diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c > index 80f978c..dffc7a4 100644 > --- a/gdb/opencl-lang.c > +++ b/gdb/opencl-lang.c > @@ -174,9 +174,9 @@ 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); > + LONGEST offset = value_offset (v); > int elsize = TYPE_LENGTH (eltype); > - int n, i, j = 0; > + LONGEST n, i, j = 0; > LONGEST lowb = 0; > LONGEST highb = 0; > > @@ -203,9 +203,9 @@ 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); > + LONGEST offset = value_offset (v); > int elsize = TYPE_LENGTH (eltype); > - int n, i, j = 0; > + LONGEST n, i, j = 0; > LONGEST lowb = 0; > LONGEST highb = 0; > > @@ -243,17 +243,17 @@ lval_func_write (struct value *v, struct value *fromval) > /* Return nonzero if all bits in V within OFFSET and LENGTH are valid. */ > > static int > -lval_func_check_validity (const struct value *v, int offset, int length) > +lval_func_check_validity (const struct value *v, LONGEST offset, int length) > { > struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); > /* Size of the target type in bits. */ > int elsize = > TYPE_LENGTH (TYPE_TARGET_TYPE (check_typedef (value_type (c->val)))) * 8; > - int startrest = offset % elsize; > - int start = offset / elsize; > - int endrest = (offset + length) % elsize; > - int end = (offset + length) / elsize; > - int i; > + int startrest = (int)(offset % elsize); Unneeded cast. > + LONGEST start = offset / elsize; > + int endrest = (int)((offset + length) % elsize); Unneeded cast. > + LONGEST end = (offset + length) / elsize; > + LONGEST i; > > if (endrest) > end++; > @@ -297,17 +297,17 @@ lval_func_check_any_valid (const struct value *v) > > static int > lval_func_check_synthetic_pointer (const struct value *v, > - int offset, int length) > + LONGEST offset, int length) > { > struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); > /* Size of the target type in bits. */ > int elsize = > TYPE_LENGTH (TYPE_TARGET_TYPE (check_typedef (value_type (c->val)))) * 8; > - int startrest = offset % elsize; > - int start = offset / elsize; > - int endrest = (offset + length) % elsize; > - int end = (offset + length) / elsize; > - int i; > + int startrest = (int)(offset % elsize); Unneeded cast. > + LONGEST start = offset / elsize; > + int endrest = (int)((offset + length) % elsize); Unneeded cast. > + LONGEST end = (offset + length) / elsize; > + LONGEST i; > > if (endrest) > end++; > 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, s/,LONGEST/, LONGEST/. And BTW you could fix up spaces to tabs for the indentation here. > struct type **char_type, > const char **arrayname) > { > diff --git a/gdb/p-lang.h b/gdb/p-lang.h > index 180c544..2627aa4 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 *); > @@ -69,7 +69,7 @@ extern void > pascal_type_print_varspec_prefix (struct type *, struct ui_file *, int, int); > > 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-typeprint.c b/gdb/p-typeprint.c > index ab82d90..b97c7e9 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,8 @@ 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)); > + " := %s", > + plongest(TYPE_FIELD_BITPOS (type, i))); Again: 'plongest (TYPE_FIELD_BITPOS ...'. > lastval = TYPE_FIELD_BITPOS (type, i); > } > lastval++; > diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c > index 39eff10..aa75095 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; > @@ -70,7 +71,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, > case TYPE_CODE_ARRAY: > if (get_array_bounds (type, &low_bound, &high_bound)) > { > - len = high_bound - low_bound + 1; > + len = (unsigned int)(high_bound - low_bound + 1); Unneeded cast. It is a bit incorrect, we do need to extend also type->length. > elttype = check_typedef (TYPE_TARGET_TYPE (type)); > eltlen = TYPE_LENGTH (elttype); > if (options->prettyprint_arrays) > @@ -633,7 +634,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 *, > @@ -692,7 +693,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, > @@ -887,7 +888,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, > @@ -910,11 +911,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 86d4f2c..1ceb23b 100644 > --- a/gdb/python/py-prettyprint.c > +++ b/gdb/python/py-prettyprint.c > @@ -676,7 +676,7 @@ print_children (PyObject *printer, const char *hint, > > int > apply_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, > @@ -824,7 +824,7 @@ gdbpy_default_visualizer (PyObject *self, PyObject *args) > > int > apply_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/python/python.h b/gdb/python/python.h > index 597ed2e..476299b 100644 > --- a/gdb/python/python.h > +++ b/gdb/python/python.h > @@ -33,7 +33,7 @@ void eval_python_from_control_command (struct command_line *); > void source_python_script (FILE *file, const char *filename); > > int apply_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/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..3c4e034 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); > > @@ -662,7 +662,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type, > { > gdb_assert (bitpos == 0 || bitpos == 64); > > - regnum = SPARC64_D0_REGNUM + element + bitpos / 64; > + regnum = (int)(SPARC64_D0_REGNUM + element + bitpos / 64); Unneeded cast. > regcache_cooked_write (regcache, regnum, valbuf + (bitpos / 8)); > } > else > @@ -670,7 +670,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type, > gdb_assert (len == 4); > gdb_assert (bitpos % 32 == 0 && bitpos >= 0 && bitpos < 128); > > - regnum = SPARC_F0_REGNUM + element * 2 + bitpos / 32; > + regnum = (int)(SPARC_F0_REGNUM + element * 2 + bitpos / 32); Unneeded cast. > regcache_cooked_write (regcache, regnum, valbuf + (bitpos / 8)); > } > } > @@ -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)) > { > @@ -724,14 +724,14 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type, > { > gdb_assert (bitpos == 0 || bitpos == 128); > > - regnum = SPARC64_Q0_REGNUM + bitpos / 128; > + regnum = (int)(SPARC64_Q0_REGNUM + bitpos / 128); Unneeded cast. > regcache_cooked_read (regcache, regnum, valbuf + (bitpos / 8)); > } > else if (len == 8) > { > gdb_assert (bitpos % 64 == 0 && bitpos >= 0 && bitpos < 256); > > - regnum = SPARC64_D0_REGNUM + bitpos / 64; > + regnum = (int)(SPARC64_D0_REGNUM + bitpos / 64); Unneeded cast. > regcache_cooked_read (regcache, regnum, valbuf + (bitpos / 8)); > } > else > @@ -739,7 +739,7 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type, > gdb_assert (len == 4); > gdb_assert (bitpos % 32 == 0 && bitpos >= 0 && bitpos < 256); > > - regnum = SPARC_F0_REGNUM + bitpos / 32; > + regnum = (int)(SPARC_F0_REGNUM + bitpos / 32); Unneeded cast. > regcache_cooked_read (regcache, regnum, valbuf + (bitpos / 8)); > } > } > @@ -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/testsuite/gdb.base/structs4.c b/gdb/testsuite/gdb.base/structs4.c > new file mode 100644 > index 0000000..e5dfc5c > --- /dev/null > +++ b/gdb/testsuite/gdb.base/structs4.c > @@ -0,0 +1,27 @@ > +/* This testcase is part of GDB, the GNU debugger. > + > + Copyright 2012 Free Software Foundation, Inc. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see . */ > + > +enum e { I, J = (unsigned)0xffffffff } e = J; Either '(unsigned) 0xffffffff' or just '0xffffffffU'. enum e { I, J = 0xffffffffU } e = J; > + > +void dummy() Not such strict for testcases but according to C prototypes + GNU Coding style: void dummy (void) > +{ > +} > + > +main() int main (void) > +{ > + dummy(); > +} { dummy (); return 0; } > diff --git a/gdb/testsuite/gdb.base/structs4.exp b/gdb/testsuite/gdb.base/structs4.exp > new file mode 100644 > index 0000000..b66a6eb > --- /dev/null > +++ b/gdb/testsuite/gdb.base/structs4.exp > @@ -0,0 +1,29 @@ > +# This testcase is part of GDB, the GNU debugger. > + > +# Copyright 2012 Free Software Foundation, Inc. > + > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see . > + > +set testfile "structs4" > +set srcfile ${testfile}.c > +set binfile ${objdir}/${subdir}/${testfile} > + > +if { [prepare_for_testing structs4.exp "structs4" "" {debug}] } { > + return -1 > +} > + > +# Check the real contents. > +gdb_test "print e" "= J" > + > +gdb_test "print J" "= J" > diff --git a/gdb/valops.c b/gdb/valops.c > index fca601f..0774f65 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,8 +102,8 @@ 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 *, > - struct type **, int *); > + LONGEST, struct type *, int *, > + struct type **, LONGEST *); > > void _initialize_valops (void); > > @@ -651,7 +651,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, > @@ -663,7 +663,7 @@ 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, > + LONGEST offset = baseclass_offset (search_type, i, valaddr, embedded_offset, > address, val); Wrong indentation of the continuing line. > > if (class_types_same_p (desired_type, TYPE_BASECLASS (search_type, i))) > @@ -698,7 +698,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, > @@ -708,7 +708,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; > @@ -1329,7 +1329,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; > @@ -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, > . */ > > 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 > @@ -2088,7 +2088,7 @@ search_struct_field (const char *name, struct value *arg1, int offset, > > if (BASETYPE_VIA_VIRTUAL (type, i)) > { > - int boffset; > + LONGEST boffset; > struct value *v2; > > boffset = baseclass_offset (type, i, > @@ -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,9 +2216,9 @@ 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; > + LONGEST this_offset; > > if (BASETYPE_VIA_VIRTUAL (type, i)) > { > @@ -2230,7 +2230,7 @@ search_struct_method (const char *name, struct value **arg1p, > clobbered by the user program. Make sure that it > still points to a valid memory location. */ > > - if (offset < 0 || offset >= TYPE_LENGTH (type)) > + if (offset < 0 || offset >= (LONGEST)TYPE_LENGTH (type)) Unneeded cast. > { > gdb_byte *tmp = alloca (TYPE_LENGTH (baseclass)); > CORE_ADDR address = value_address (*arg1p); > @@ -2394,8 +2394,8 @@ 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, > - struct type **basetype, int *boffset) > + LONGEST offset, struct type *type, int *num_fns, > + struct type **basetype, LONGEST *boffset) > { > int i; > struct fn_field *f; > @@ -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)) > { > @@ -2464,7 +2464,7 @@ find_method_list (struct value **argp, const char *method, > struct fn_field * > value_find_oload_method_list (struct value **argp, const char *method, > int offset, int *num_fns, > - struct type **basetype, int *boffset) > + struct type **basetype, LONGEST *boffset) > { > struct type *t; > > @@ -2556,7 +2556,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); > > @@ -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..8f261f5 100644 > --- a/gdb/valprint.c > +++ b/gdb/valprint.c > @@ -261,7 +261,7 @@ scalar_type_p (struct type *type) > static int > valprint_check_validity (struct ui_file *stream, > struct type *type, > - int embedded_offset, > + LONGEST embedded_offset, > const struct value *val) > { > CHECK_TYPEDEF (type); > @@ -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, > @@ -1189,7 +1189,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 a34d09b..74326f7 100644 > --- a/gdb/valprint.h > +++ b/gdb/valprint.h > @@ -113,7 +113,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 *, > @@ -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..c56c22f 100644 > --- a/gdb/value.c > +++ b/gdb/value.c > @@ -66,7 +66,7 @@ struct internal_function > struct range > { > /* Lowest offset in the range. */ > - int offset; > + LONGEST offset; > > /* Length of the range. */ > int length; > @@ -80,8 +80,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, int len1, > + LONGEST offset2, int len2) > { > ULONGEST h, l; > > @@ -105,7 +105,7 @@ 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, int length) > { > range_s what; > int i; > @@ -238,7 +238,7 @@ 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; > @@ -308,8 +308,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 > @@ -331,7 +331,7 @@ struct value > }; > > int > -value_bytes_available (const struct value *value, int offset, int length) > +value_bytes_available (const struct value *value, LONGEST offset, int length) > { > gdb_assert (!value->lazy); > > @@ -352,7 +352,7 @@ value_entirely_available (struct value *value) > } > > void > -mark_value_bytes_unavailable (struct value *value, int offset, int length) > +mark_value_bytes_unavailable (struct value *value, LONGEST offset, int length) > { > range_s newr; > int i; > @@ -523,7 +523,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, int length) > { > range_s *r; > int i; > @@ -536,8 +536,8 @@ find_first_range_overlap (VEC(range_s) *ranges, int pos, > } > > int > -value_available_contents_eq (const struct value *val1, int offset1, > - const struct value *val2, int offset2, > +value_available_contents_eq (const struct value *val1, LONGEST offset1, > + const struct value *val2, LONGEST offset2, > int length) > { > int idx1 = 0, idx2 = 0; > @@ -766,13 +766,13 @@ 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; > } > @@ -874,8 +874,8 @@ value_contents_all (struct value *value) > 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, int length) > { > range_s *r; > int i; > @@ -923,8 +923,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, int length) > { > require_not_optimized_out (src); > > @@ -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) > @@ -1042,26 +1042,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; > } > @@ -1832,7 +1832,7 @@ get_internalvar_function (struct internalvar *var, > } > > void > -set_internalvar_component (struct internalvar *var, int offset, int bitpos, > +set_internalvar_component (struct internalvar *var, LONGEST offset, int bitpos, > int bitsize, struct value *newval) > { > gdb_byte *addr; > @@ -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,16 +2526,16 @@ 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); > v->bitsize = TYPE_FIELD_BITSIZE (arg_type, fieldno); > if ((bitpos % container_bitsize) + v->bitsize <= container_bitsize > && TYPE_LENGTH (type) <= (int) sizeof (LONGEST)) > - v->bitpos = bitpos % container_bitsize; > + v->bitpos = (int)(bitpos % container_bitsize); Unneeded cast. (It is non-trivial but it seems correct it should fit in.) > else > - v->bitpos = bitpos % 8; > + v->bitpos = (int)(bitpos % 8); Unneeded cast. > v->offset = (value_embedded_offset (arg1) > + offset > + (bitpos - v->bitpos) / 8); > @@ -2614,7 +2614,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); > @@ -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, LONGEST bitpos, int bitsize, > const struct value *original_value, > LONGEST *result) > { > @@ -2683,13 +2683,13 @@ unpack_value_bits_as_long_1 (struct type *field_type, const gdb_byte *valaddr, > ULONGEST valmask; > int lsbcount; > int bytes_read; > - int read_offset; > + LONGEST read_offset; > > /* Read the minimum number of bytes required; there may not be > enough bytes to read an entire ULONGEST. */ > CHECK_TYPEDEF (field_type); > if (bitsize) > - bytes_read = ((bitpos % 8) + bitsize + 7) / 8; > + bytes_read = (int)(((bitpos % 8) + bitsize + 7) / 8); Unneeded cast. > else > bytes_read = TYPE_LENGTH (field_type); > > @@ -2706,9 +2706,9 @@ unpack_value_bits_as_long_1 (struct type *field_type, const gdb_byte *valaddr, > /* Extract bits. See comment above. */ > > if (gdbarch_bits_big_endian (get_type_arch (field_type))) > - lsbcount = (bytes_read * 8 - bitpos % 8 - bitsize); > + lsbcount = (int)(bytes_read * 8 - bitpos % 8 - bitsize); Unneeded cast. > else > - lsbcount = (bitpos % 8); > + lsbcount = (int)(bitpos % 8); Unneeded cast. > val >>= lsbcount; > > /* If the field does not entirely fill a LONGEST, then zero the sign bits. > @@ -2753,7 +2753,7 @@ unpack_value_bits_as_long_1 (struct type *field_type, const gdb_byte *valaddr, > > int > unpack_value_bits_as_long (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) > { > @@ -2771,10 +2771,10 @@ unpack_value_bits_as_long (struct type *field_type, const gdb_byte *valaddr, > > static int > unpack_value_field_as_long_1 (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); > + LONGEST bitpos = TYPE_FIELD_BITPOS (type, fieldno); > int bitsize = TYPE_FIELD_BITSIZE (type, fieldno); > struct type *field_type = TYPE_FIELD_TYPE (type, fieldno); > > @@ -2790,7 +2790,7 @@ unpack_value_field_as_long_1 (struct type *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) > { > gdb_assert (val != NULL); > @@ -2822,7 +2822,7 @@ unpack_field_as_long (struct type *type, const gdb_byte *valaddr, int fieldno) > 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) > { > LONGEST l; > > @@ -2842,23 +2842,23 @@ value_field_bitfield (struct type *type, int fieldno, > > /* Modify the value of a bitfield. ADDR points to a block of memory in > target byte order; the bitfield starts in the byte pointed to. FIELDVAL > - is the desired value of the field, in host byte order. BITPOS and BITSIZE > + is the desired value of the field, in host byte order. OFFSET and BITSIZE > indicate which bits (in target bit order) comprise the bitfield. > - Requires 0 < BITSIZE <= lbits, 0 <= BITPOS % 8 + BITSIZE <= lbits, and > - 0 <= BITPOS, where lbits is the size of a LONGEST in bits. */ > + Requires 0 < BITSIZE <= lbits, 0 <= OFFSET % 8 + BITSIZE <= lbits, and > + 0 <= OFFSET, where lbits is the size of a LONGEST in bits. */ > > void > modify_field (struct type *type, gdb_byte *addr, > - LONGEST fieldval, int bitpos, int bitsize) > + LONGEST fieldval, LONGEST offset, 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; > + int bitpos, bytesize; > > /* Normalize BITPOS. */ > - addr += bitpos / 8; > - bitpos %= 8; > + addr += offset / 8; > + bitpos = (int)(offset % 8); Unneeded cast. > > /* If a negative fieldval fits in the field in question, chop > off the sign extension bits. */ > diff --git a/gdb/value.h b/gdb/value.h > index 2a2274d..6eecbce 100644 > --- a/gdb/value.h > +++ b/gdb/value.h > @@ -81,8 +81,8 @@ struct value *value_parent (struct value *); > 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 > @@ -137,10 +137,10 @@ extern struct type *value_enclosing_type (struct value *); > extern void set_value_enclosing_type (struct value *val, > struct type *new_type); > > -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). > @@ -168,7 +168,7 @@ struct lval_funcs > /* Check the validity of some bits in VALUE. This should return 1 > if all the bits starting at OFFSET and extending for LENGTH bits > are valid, or 0 if any bit is invalid. */ > - int (*check_validity) (const struct value *value, int offset, int length); > + int (*check_validity) (const struct value *value, LONGEST offset, int length); > > /* Return 1 if any bit in VALUE is valid, 0 if they are all invalid. */ > int (*check_any_valid) (const struct value *value); > @@ -186,7 +186,7 @@ struct lval_funcs > /* If non-NULL, this is used to determine whether the indicated bits > of VALUE are a synthetic pointer. */ > int (*check_synthetic_pointer) (const struct value *value, > - int offset, int length); > + LONGEST offset, int length); > > /* Return a duplicate of VALUE's closure, for use in a new value. > This may simply return the same closure, if VALUE's is > @@ -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 > @@ -381,7 +381,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, int length); > > /* Like value_bytes_available, but return false if any byte in the > whole object is unavailable. */ > @@ -391,7 +391,7 @@ extern int value_entirely_available (struct value *value); > LENGTH bytes as unavailable. */ > > extern void mark_value_bytes_unavailable (struct value *value, > - int offset, int length); > + LONGEST offset, int length); > > /* Compare LENGTH bytes of VAL1's contents starting at OFFSET1 with > LENGTH bytes of VAL2's contents starting at OFFSET2. > @@ -423,8 +423,8 @@ extern void mark_value_bytes_unavailable (struct value *value, > value_available_contents_eq(val, 3, val, 4, 4) => 0 > */ > > -extern int value_available_contents_eq (const struct value *val1, int offset1, > - const struct value *val2, int offset2, > +extern int value_available_contents_eq (const struct value *val1, LONGEST offset1, > + const struct value *val2, LONGEST offset2, > int length); > > /* Read LENGTH bytes of memory starting at MEMADDR into BUFFER, which > @@ -461,7 +461,7 @@ extern CORE_ADDR unpack_pointer (struct type *type, const gdb_byte *valaddr); > > extern int unpack_value_bits_as_long (struct type *field_type, > const gdb_byte *valaddr, > - int embedded_offset, int bitpos, > + LONGEST embedded_offset, int bitpos, > int bitsize, > const struct value *original_value, > LONGEST *result); > @@ -470,12 +470,12 @@ 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 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); > @@ -526,11 +526,11 @@ extern struct value *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 allocate_value_contents (struct value *value); > -extern void value_contents_copy (struct value *dst, int dst_offset, > - struct value *src, int src_offset, > +extern void value_contents_copy (struct value *dst, LONGEST dst_offset, > + struct value *src, LONGEST src_offset, > int length); > -extern void value_contents_copy_raw (struct value *dst, int dst_offset, > - struct value *src, int src_offset, > +extern void value_contents_copy_raw (struct value *dst, LONGEST dst_offset, > + struct value *src, LONGEST src_offset, > int length); > > extern struct value *allocate_repeat_value (struct type *type, int count); > @@ -597,7 +597,7 @@ extern struct value *value_static_field (struct type *type, int fieldno); > extern struct fn_field *value_find_oload_method_list (struct value **, > const char *, > int, int *, > - struct type **, int *); > + struct type **, LONGEST *); > > enum oload_search_type { NON_METHOD, METHOD, BOTH }; > > @@ -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); > > @@ -709,7 +709,7 @@ 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, > + LONGEST offset, > int bitpos, int bitsize, > struct value *newvalue); > > @@ -747,7 +747,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, > @@ -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, > -- > 1.7.7.4 > Thanks, Jan