diff options
author | David Taylor <dtaylor@emc.com> | 2016-04-12 15:02:57 -0400 |
---|---|---|
committer | David Taylor <david.taylor@emc.com> | 2016-06-24 21:02:36 -0400 |
commit | 6b8505468e64c2be8d0eea1f2b8db86fa3897600 (patch) | |
tree | 81de3154cfc05d9811239c11ef05cbb3a6fec06d /gdb/value.h | |
parent | e0204c4d4ceb9be0b0ccf8f92ab683aab54f67cd (diff) | |
download | binutils-6b8505468e64c2be8d0eea1f2b8db86fa3897600.zip binutils-6b8505468e64c2be8d0eea1f2b8db86fa3897600.tar.gz binutils-6b8505468e64c2be8d0eea1f2b8db86fa3897600.tar.bz2 |
Support structure offsets that are 512K or larger.
GDB computes structure byte offsets using a 32 bit integer. And,
first it computes the offset in bits and then converts to bytes. The
result is that any offset that if 512K bytes or larger overflows.
This patch changes GDB to use LONGEST for such calculations.
PR gdb/17520 Structure offset wrong when 1/4 GB or greater.
* c-lang.h: Change all parameters, variables, and struct or union
members used as struct or union fie3ld offsets from int to
LONGEST.
* c-valprint.c: Likewise.
* cp-abi.c: Likewise.
* cp-abi.h: Likewise.
* cp-valprint.c: Likewise.
* d-valprint.c: Likewise.
* dwarf2loc.c: Likewise.
* eval.c: Likewise.
* extension-priv.h: Likewise.
* extension.c: Likewise.
* extension.h: Likewise.
* findvar.c: Likewise.
* gdbtypes.h: Likewise.
* gnu-v2-abi.c: Likewise.
* gnu-v3-abi.c: Likewise.
* go-valprint.c: Likewise.
* guile/guile-internal.h: Likewise.
* guile/scm-pretty-print.c: Likewise.
* jv-valprint.c Likewise.
* opencl-lang.c: Likewise.
* p-lang.h: Likewise.
* python/py-prettyprint.c: Likewise.
* python/python-internal.h: Likewise.
* spu-tdep.c: Likewise.
* typeprint.c: Likewise.
* valarith.c: Likewise.
* valops.c: Likewise.
* valprint.c: Likewise.
* valprint.h: Likewise.
* value.c: Likewise.
* value.h: Likewise.
* p-valprint.c: Likewise.
* c-typeprint.c (c_type_print_base): When printing offset, use
plongest, not %d.
* gdbtypes.c (recursive_dump_type): Ditto.
Diffstat (limited to 'gdb/value.h')
-rw-r--r-- | gdb/value.h | 79 |
1 files changed, 40 insertions, 39 deletions
diff --git a/gdb/value.h b/gdb/value.h index f8ec854..0b417b4 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -112,15 +112,15 @@ extern void deprecated_set_value_type (struct value *value, /* Only used for bitfields; number of bits contained in them. */ -extern int value_bitsize (const struct value *); -extern void set_value_bitsize (struct value *, int bit); +extern LONGEST value_bitsize (const struct value *); +extern void set_value_bitsize (struct value *, LONGEST bit); /* Only used for bitfields; position of start of field. For gdbarch_bits_big_endian=0 targets, it is the position of the LSB. For gdbarch_bits_big_endian=1 targets, it is the position of the MSB. */ -extern int value_bitpos (const struct value *); -extern void set_value_bitpos (struct value *, int bit); +extern LONGEST value_bitpos (const struct value *); +extern void set_value_bitpos (struct value *, LONGEST bit); /* Only used for bitfields; the containing value. This allows a single read from the target when displaying multiple @@ -135,8 +135,8 @@ extern void set_value_parent (struct value *value, struct value *parent); within the registers structure. Note also the member embedded_offset below. */ -extern int value_offset (const struct value *); -extern void set_value_offset (struct value *, int offset); +extern LONGEST value_offset (const struct value *); +extern void set_value_offset (struct value *, LONGEST offset); /* The comment from "struct value" reads: ``Is it modifiable? Only relevant if lval != not_lval.''. Shouldn't the value instead be @@ -205,10 +205,10 @@ extern struct type *value_actual_type (struct value *value, int resolve_simple_types, int *real_type_found); -extern int value_pointed_to_offset (const struct value *value); -extern void set_value_pointed_to_offset (struct value *value, int val); -extern int value_embedded_offset (const struct value *value); -extern void set_value_embedded_offset (struct value *value, int val); +extern LONGEST value_pointed_to_offset (const struct value *value); +extern void set_value_pointed_to_offset (struct value *value, LONGEST val); +extern LONGEST value_embedded_offset (const struct value *value); +extern void set_value_embedded_offset (struct value *value, LONGEST val); /* For lval_computed values, this structure holds functions used to retrieve and set the value (or portions of the value). @@ -246,7 +246,7 @@ struct lval_funcs /* If non-NULL, this is used to determine whether the indicated bits of VALUE are a synthetic pointer. */ int (*check_synthetic_pointer) (const struct value *value, - int offset, int length); + LONGEST offset, int length); /* Return a duplicate of VALUE's closure, for use in a new value. This may simply return the same closure, if VALUE's is @@ -283,7 +283,7 @@ extern struct value *allocate_computed_value (struct type *type, Otherwise, return 1. */ extern int valprint_check_validity (struct ui_file *stream, struct type *type, - int embedded_offset, + LONGEST embedded_offset, const struct value *val); extern struct value *allocate_optimized_out_value (struct type *type); @@ -393,7 +393,7 @@ extern void mark_value_bytes_optimized_out (struct value *value, LENGTH bits as optimized out. */ extern void mark_value_bits_optimized_out (struct value *value, - int offset, int length); + LONGEST offset, LONGEST length); /* Set or return field indicating whether a variable is initialized or not, based on debugging information supplied by the compiler. @@ -476,7 +476,7 @@ extern struct value *coerce_array (struct value *value); extending for LENGTH bits are a synthetic pointer. */ extern int value_bits_synthetic_pointer (const struct value *value, - int offset, int length); + LONGEST offset, LONGEST length); /* Given a value, determine whether the contents bytes starting at OFFSET and extending for LENGTH bytes are available. This returns @@ -484,7 +484,7 @@ extern int value_bits_synthetic_pointer (const struct value *value, byte is unavailable. */ extern int value_bytes_available (const struct value *value, - int offset, int length); + LONGEST offset, LONGEST length); /* Given a value, determine whether the contents bits starting at OFFSET and extending for LENGTH bits are available. This returns @@ -492,7 +492,7 @@ extern int value_bytes_available (const struct value *value, bit is unavailable. */ extern int value_bits_available (const struct value *value, - int offset, int length); + LONGEST offset, LONGEST length); /* Like value_bytes_available, but return false if any byte in the whole object is unavailable. */ @@ -506,13 +506,13 @@ extern int value_entirely_unavailable (struct value *value); LENGTH bytes as unavailable. */ extern void mark_value_bytes_unavailable (struct value *value, - int offset, int length); + LONGEST offset, LONGEST length); /* Mark VALUE's content bits starting at OFFSET and extending for LENGTH bits as unavailable. */ extern void mark_value_bits_unavailable (struct value *value, - int offset, int length); + LONGEST offset, LONGEST length); /* Compare LENGTH bytes of VAL1's contents starting at OFFSET1 with LENGTH bytes of VAL2's contents starting at OFFSET2. @@ -567,9 +567,9 @@ extern void mark_value_bits_unavailable (struct value *value, after the inferior is gone, it works with const values. Therefore, this routine must not be called with lazy values. */ -extern int value_contents_eq (const struct value *val1, int offset1, - const struct value *val2, int offset2, - int length); +extern int value_contents_eq (const struct value *val1, LONGEST offset1, + const struct value *val2, LONGEST offset2, + LONGEST length); /* Read LENGTH addressable memory units starting at MEMADDR into BUFFER, which is (or will be copied to) VAL's contents buffer offset by @@ -578,7 +578,7 @@ extern int value_contents_eq (const struct value *val1, int offset1, memory is likewise unavailable. STACK indicates whether the memory is known to be stack memory. */ -extern void read_value_memory (struct value *val, int embedded_offset, +extern void read_value_memory (struct value *val, LONGEST embedded_offset, int stack, CORE_ADDR memaddr, gdb_byte *buffer, size_t length); @@ -614,17 +614,18 @@ extern LONGEST unpack_field_as_long (struct type *type, const gdb_byte *valaddr, int fieldno); extern int unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr, - int embedded_offset, int fieldno, + LONGEST embedded_offset, int fieldno, const struct value *val, LONGEST *result); extern void unpack_value_bitfield (struct value *dest_val, - int bitpos, int bitsize, - const gdb_byte *valaddr, int embedded_offset, + LONGEST bitpos, LONGEST bitsize, + const gdb_byte *valaddr, + LONGEST embedded_offset, const struct value *val); extern struct value *value_field_bitfield (struct type *type, int fieldno, const gdb_byte *valaddr, - int embedded_offset, + LONGEST embedded_offset, const struct value *val); extern void pack_long (gdb_byte *buf, struct type *type, LONGEST num); @@ -683,12 +684,12 @@ extern struct value *default_read_var_value (struct symbol *var, extern struct value *allocate_value (struct type *type); extern struct value *allocate_value_lazy (struct type *type); -extern void value_contents_copy (struct value *dst, int dst_offset, - struct value *src, int src_offset, - int length); -extern void value_contents_copy_raw (struct value *dst, int dst_offset, - struct value *src, int src_offset, - int length); +extern void value_contents_copy (struct value *dst, LONGEST dst_offset, + struct value *src, LONGEST src_offset, + LONGEST length); +extern void value_contents_copy_raw (struct value *dst, LONGEST dst_offset, + struct value *src, LONGEST src_offset, + LONGEST length); extern struct value *allocate_repeat_value (struct type *type, int count); @@ -766,12 +767,12 @@ extern int find_overload_match (struct value **args, int nargs, extern struct value *value_field (struct value *arg1, int fieldno); -extern struct value *value_primitive_field (struct value *arg1, int offset, +extern struct value *value_primitive_field (struct value *arg1, LONGEST offset, int fieldno, struct type *arg_type); -extern struct type *value_rtti_indirect_type (struct value *, int *, int *, +extern struct type *value_rtti_indirect_type (struct value *, int *, LONGEST *, int *); extern struct value *value_full_object (struct value *, struct type *, int, @@ -870,8 +871,8 @@ extern void set_internalvar_string (struct internalvar *var, extern void clear_internalvar (struct internalvar *var); extern void set_internalvar_component (struct internalvar *var, - int offset, - int bitpos, int bitsize, + LONGEST offset, + LONGEST bitpos, LONGEST bitsize, struct value *newvalue); extern struct internalvar *lookup_only_internalvar (const char *name); @@ -951,7 +952,7 @@ extern struct value *value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside); extern struct value *value_fn_field (struct value **arg1p, struct fn_field *f, - int j, struct type *type, int offset); + int j, struct type *type, LONGEST offset); extern int binop_types_user_defined_p (enum exp_opcode op, struct type *type1, @@ -979,7 +980,7 @@ extern void release_value_or_incref (struct value *val); extern int record_latest_value (struct value *val); extern void modify_field (struct type *type, gdb_byte *addr, - LONGEST fieldval, int bitpos, int bitsize); + LONGEST fieldval, LONGEST bitpos, LONGEST bitsize); extern void type_print (struct type *type, const char *varstring, struct ui_file *stream, int show); @@ -1009,7 +1010,7 @@ extern void value_print_array_elements (struct value *val, extern struct value *value_release_to_mark (const struct value *mark); extern void val_print (struct type *type, const gdb_byte *valaddr, - int embedded_offset, CORE_ADDR address, + LONGEST embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, const struct value *val, const struct value_print_options *options, |