From 6b8505468e64c2be8d0eea1f2b8db86fa3897600 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 12 Apr 2016 15:02:57 -0400 Subject: 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. --- gdb/opencl-lang.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gdb/opencl-lang.c') diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index 2a46d86..6fb8abe 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -172,8 +172,8 @@ 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); - int elsize = TYPE_LENGTH (eltype); + LONGEST offset = value_offset (v); + LONGEST elsize = TYPE_LENGTH (eltype); int n, i, j = 0; LONGEST lowb = 0; LONGEST highb = 0; @@ -201,8 +201,8 @@ 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); - int elsize = TYPE_LENGTH (eltype); + LONGEST offset = value_offset (v); + LONGEST elsize = TYPE_LENGTH (eltype); int n, i, j = 0; LONGEST lowb = 0; LONGEST highb = 0; @@ -243,7 +243,7 @@ lval_func_write (struct value *v, struct value *fromval) 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. */ -- cgit v1.1