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.
This commit is contained in:
David Taylor
2016-04-12 15:02:57 -04:00
committed by David Taylor
parent e0204c4d4c
commit 6b8505468e
38 changed files with 328 additions and 194 deletions

View File

@@ -183,7 +183,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
static struct type *
gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, int *using_enc)
{
struct type *known_type;
struct type *rtti_type;
@@ -340,7 +340,7 @@ vb_match (struct type *type, int index, struct type *basetype)
static int
gnuv2_baseclass_offset (struct type *type, int index,
const bfd_byte *valaddr, int embedded_offset,
const bfd_byte *valaddr, LONGEST embedded_offset,
CORE_ADDR address, const struct value *val)
{
struct type *basetype = TYPE_BASECLASS (type, index);
@@ -358,7 +358,7 @@ gnuv2_baseclass_offset (struct type *type, int index,
if (vb_match (type, i, basetype))
{
struct type *field_type;
int field_offset;
LONGEST field_offset;
int field_length;
CORE_ADDR addr;