aboutsummaryrefslogtreecommitdiff
path: root/gdb/cp-valprint.c
diff options
context:
space:
mode:
authorDavid Taylor <dtaylor@emc.com>2016-04-12 15:02:57 -0400
committerDavid Taylor <david.taylor@emc.com>2016-06-24 21:02:36 -0400
commit6b8505468e64c2be8d0eea1f2b8db86fa3897600 (patch)
tree81de3154cfc05d9811239c11ef05cbb3a6fec06d /gdb/cp-valprint.c
parente0204c4d4ceb9be0b0ccf8f92ab683aab54f67cd (diff)
downloadgdb-6b8505468e64c2be8d0eea1f2b8db86fa3897600.zip
gdb-6b8505468e64c2be8d0eea1f2b8db86fa3897600.tar.gz
gdb-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/cp-valprint.c')
-rw-r--r--gdb/cp-valprint.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index effce30..7b0c19a 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -80,7 +80,7 @@ static void cp_print_static_field (struct type *, struct value *,
const struct value_print_options *);
static void cp_print_value (struct type *, struct type *,
- const gdb_byte *, int,
+ const gdb_byte *, LONGEST,
CORE_ADDR, struct ui_file *,
int, const struct value *,
const struct value_print_options *,
@@ -154,7 +154,7 @@ cp_is_vtbl_member (struct type *type)
void
cp_print_value_fields (struct type *type, struct type *real_type,
- const gdb_byte *valaddr, int offset,
+ const gdb_byte *valaddr, LONGEST offset,
CORE_ADDR address, struct ui_file *stream,
int recurse, const struct value *val,
const struct value_print_options *options,
@@ -417,7 +417,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,
@@ -434,7 +434,8 @@ cp_print_value_fields_rtti (struct type *type,
TARGET_CHAR_BIT * TYPE_LENGTH (type)))
{
struct value *value;
- int full, top, using_enc;
+ int full, using_enc;
+ LONGEST top;
/* Ugh, we have to convert back to a value here. */
value = value_from_contents_and_address (type, valaddr + offset,
@@ -459,7 +460,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,
@@ -469,7 +470,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)
@@ -483,7 +484,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 = 0;
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
const char *basename = TYPE_NAME (baseclass);