Skip to content

Commit a25d943

Browse files
ivanivanov884jeffmahoney
authored andcommitted
gdb-rhbz795424-bitpos-23of25.patch
;; Fix `GDB cannot access struct member whose offset is larger than 256MB' ;; (RH BZ 795424). ;;=push http://sourceware.org/ml/gdb-patches/2012-09/msg00630.html --MP_/X_WjDOvz/B_fvlsrmCwRdxe Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, This is the last part of the bitpos change. This patch does the same thing that patch 1/4 does, except that it does so in the *-tdep files wherever necessary. I separated these changes mainly because they are related and can be reviewed independently. Tested on Fedora 16 x86_64. Regards, Siddhesh --MP_/X_WjDOvz/B_fvlsrmCwRdxe Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=ChangeLog-tdep gdb/ChangeLog * alpha-tdep.c (alpha_push_dummy_call): Expand ACCUMULATE_SIZE, REQUIRED_ARG_REGS, OFFSET, LEN, TLEN to ssize_t. (struct alpha_arg): Expand members LEN, OFFSET to ssize_t. * amd64-tdep.c (amd64_push_arguments): Expand NUM_ELEMENTS, ELEMENT and LEN to LONGEST. (amd64_return_value): Expand LEN to LONGEST. * amd64-windows-tdep.c (amd64_windows_return_value): Expand LEN to LONGEST. * arm-tdep.c (arm_vfp_cprc_sub_candidate): Return LONGEST. Expand COUNT, SUB_COUNT to LONGEST. (arm_vfp_call_candidate): Expand C to LONGEST. (arm_push_dummy_call): Expand LEN to LONGEST. * avr-tdep.c (struct stack_item): Expand member LEN to ssize_t. (push_stack_item): Expand parameter LEN to ssize_t. (avr_push_dummy_call): Expand LAST_REGNUM, J, LEN to ssize_t. * bfin-tdep.c (bfin_push_dummy_call): Expand TOTAL_LEN, CONTAINER_LEN to ssize_t. * cris-tdep.c (struct stack_item): Expand member LEN to ssize_t. (push_stack_item): Expand parameter LEN to ssize_t. (cris_push_dummy_call): Expand LEN, REG_DEMAND, I to ssize_t. * h8300-tdep.c (h8300_push_dummy_call): Expand STACK_ALLOC, STACK_OFFSET to LONGEST. Expand LEN, PADDED_LEN, OFFSET to ssize_t. * hppa-tdep.c (hppa64_push_dummy_call): Expand LEN to LONGEST. (hppa64_return_value): Likewise. * i386-darwin-tdep.c (i386_darwin_push_dummy_call): Expand ARGS_SPACE to LONGEST. * i386-tdep.c (i386_push_dummy_call): Expand ARG_SPACE, ARG_SPACE_USED, LEN to LONGEST. (i386_reg_struct_return_p): Expand LEN to LONGEST. (i386_convert_register_p): Likewise. (i386_register_to_value): Likewise. (i386_value_to_register): Likewise. * ia64-tdep.c (ia64_push_dummy_call): Expand ARGOFFSET, LEN, NSLOTS, MEMSLOTS to LONGEST. * iq2000-tdep.c (iq2000_push_dummy_call): Expand TYPELEN, STACKSPACE to LONGEST. * m32r-tdep.c (m32r_push_dummy_call): Expand LEN to LONGEST. * m68k-tdep.c (m68k_reg_struct_return_p): Expand LEN to LONGEST. (m68k_push_dummy_call): Expand LEN, CONTAINER_LEN, OFFSET to LONGEST. * m88k-tdep.c (m88k_store_arguments): Expand NUM_STACK_WORDS, LEN, STACK_WORD to LONGEST. * mep-tdep.c (push_large_arguments): Expand ARG_LEN to ULONGEST. * microblaze-tdep.c (microblaze_store_return_value): Expand LEN to LONGEST. * mips-tdep.c (mips_xfer_register): Expand parameter BUF_OFFSET to LONGEST. Use plongest to format print BUF_OFFSET. (mips_eabi_push_dummy_call): Expand LEN to LONGEST. Use plongest to format print LEN. (mips_n32n64_fp_arg_chunk_p): Expand parameter OFFSET to LONGEST. Expand POS to LONGEST. (mips_n32n64_push_dummy_call): Expand LEN to LONGEST. (mips_n32n64_return_value): Expand OFFSET to LONGEST. Use plongest to format print OFFSET. (mips_o32_push_dummy_call): Expand LEN to LONGEST. Use plongest to format print LEN. (mips_o64_push_dummy_call): Expand LEN, STACK_OFFSET to LONGEST. Use plongest to format print LEN. * mn10300-tdep.c (mn10300_push_dummy_call): Expand LEN to LONGEST. * mt-tdep.c (mt_push_dummy_call): Expand STACK_DEST, TYPELEN to LONGEST. * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Expand ARGSPACE, ARGOFFSET, STRUCTOFFSET, LEN, to LONGEST. (ppc64_sysv_abi_push_dummy_call): Expand BYTE, LEN to ssize_t. * rl78-tdep.c (rl78_push_dummy_call): Expand LEN, CONTAINER_LEN to LONGEST. * rs6000-aix-tdep.c (rs6000_push_dummy_call): Expand ARGBYTES, LEN to LONGEST. (ran_out_of_registers_for_arguments): Expand SPACE, JJ to LONGEST. * s390-linux-tdep.c (s390_value_from_register): Expand LEN to LONGEST. (is_power_of_two): Expand parameter N to ULONGEST. (s390_push_dummy_call): Expand LENGTH to ULONGEST. * score-tdep.c (score_push_dummy_call): Expand ARGLEN to LONGEST. * sh-tdep.c (sh_use_struct_convention) Expand len to LONGEST. (sh_justify_value_in_reg): Expand parameter LEN to LONGEST. (sh_push_dummy_call_fpu): Expand LEN to LONGEST. Expand REG_SIZE to ssize_t. (sh_push_dummy_call_nofpu): Likewise. * sh64-tdep.c (sh64_push_dummy_call): Expand STACK_OFFSET, STACK_ALLOC, LEN to LONGEST. * sparc-tdep.c (sparc32_store_arguments): Expand LEN to LONGEST. * sparc64-tdep.c (sparc64_store_floating_fields): Expand parameter BITPOS to LONGEST. Expand SUBPOS to LONGEST. (sparc64_extract_floating_fields): Likewise. (sparc64_store_arguments): Expand LEN to LONGEST. * spu-tdep.c (spu_push_dummy_call): Expand N_REGS, LEN to LONGEST. (spu_value_from_register): Expand LEN to LONGEST. * tic6x-tdep.c (tic6x_push_dummy_call): Expand REFERENCES_OFFST, LEN to LONGEST. Expand LEN to ssize_t. Use plongest to format print LEN. * tilegx-tdep.c (tilegx_push_dummy_call): Expand TYPELEN, SLACKLEN, ALIGNLEN to LONGEST. * v850-tdep.c (v850_push_dummy_call): Expand LEN to LONGEST. * vax-tdep.c (vax_store_arguments): Expand COUNT, LEN to LONGEST. (vax_return_value): Expand LEN to LONGEST. * xstormy16-tdep.c (xstormy16_push_dummy_call): Expand J, TYPELEN to LONGEST. * xtensa-tdep.c (xtensa_store_return_value): Print LEN instead of TYPE_LENGTH.. (struct argument_info): Expoand member LENGTH to ssize_t. (struct argument_info.u): Expand member OFFSET to ssize_t. (xtensa_push_dummy_call): Expand SIZE, ONSTACK_SIZE to LONGEST. Expand N to ssize_t. Use pulongest to format print TYPE_LENGTH. --MP_/X_WjDOvz/B_fvlsrmCwRdxe Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=bitpos-tdep.patch
1 parent d6418e9 commit a25d943

30 files changed

Lines changed: 140 additions & 132 deletions

gdb/alpha-tdep.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,17 +299,17 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
299299
{
300300
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
301301
int i;
302-
int accumulate_size = struct_return ? 8 : 0;
302+
ssize_t accumulate_size = struct_return ? 8 : 0;
303303
struct alpha_arg
304304
{
305305
const gdb_byte *contents;
306-
int len;
307-
int offset;
306+
ssize_t len;
307+
ssize_t offset;
308308
};
309309
struct alpha_arg *alpha_args = XALLOCAVEC (struct alpha_arg, nargs);
310310
struct alpha_arg *m_arg;
311311
gdb_byte arg_reg_buffer[ALPHA_REGISTER_SIZE * ALPHA_NUM_ARG_REGS];
312-
int required_arg_regs;
312+
ssize_t required_arg_regs;
313313
CORE_ADDR func_addr = find_function_addr (function, NULL);
314314

315315
/* The ABI places the address of the called function in T12. */
@@ -429,8 +429,8 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
429429
for (i = nargs; m_arg--, --i >= 0;)
430430
{
431431
const gdb_byte *contents = m_arg->contents;
432-
int offset = m_arg->offset;
433-
int len = m_arg->len;
432+
ssize_t offset = m_arg->offset;
433+
ssize_t len = m_arg->len;
434434

435435
/* Copy the bytes destined for registers into arg_reg_buffer. */
436436
if (offset < sizeof(arg_reg_buffer))
@@ -442,7 +442,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
442442
}
443443
else
444444
{
445-
int tlen = sizeof(arg_reg_buffer) - offset;
445+
ssize_t tlen = sizeof(arg_reg_buffer) - offset;
446446
memcpy (arg_reg_buffer + offset, contents, tlen);
447447
offset += tlen;
448448
contents += tlen;

gdb/amd64-tdep.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -878,8 +878,8 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
878878
};
879879
struct value **stack_args = XALLOCAVEC (struct value *, nargs);
880880
int num_stack_args = 0;
881-
int num_elements = 0;
882-
int element = 0;
881+
LONGEST num_elements = 0;
882+
LONGEST element = 0;
883883
int integer_reg = 0;
884884
int sse_reg = 0;
885885
int i;
@@ -891,7 +891,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
891891
for (i = 0; i < nargs; i++)
892892
{
893893
struct type *type = value_type (args[i]);
894-
int len = TYPE_LENGTH (type);
894+
LONGEST len = TYPE_LENGTH (type);
895895
enum amd64_reg_class theclass[2];
896896
int needed_integer_regs = 0;
897897
int needed_sse_regs = 0;
@@ -955,7 +955,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
955955

956956
gdb_assert (regnum != -1);
957957
memset (buf, 0, sizeof buf);
958-
memcpy (buf, valbuf + j * 8, std::min (len, 8));
958+
memcpy (buf, valbuf + j * 8, std::min (len, (LONGEST) 8));
959959
regcache->raw_write_part (regnum, offset, 8, buf);
960960
}
961961
}

gdb/amd64-windows-tdep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ amd64_windows_return_value (struct gdbarch *gdbarch, struct value *function,
291291
struct type *type, struct regcache *regcache,
292292
gdb_byte *readbuf, const gdb_byte *writebuf)
293293
{
294-
int len = TYPE_LENGTH (type);
294+
LONGEST len = TYPE_LENGTH (type);
295295
int regnum = -1;
296296

297297
/* See if our value is returned through a register. If it is, then

gdb/arm-tdep.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3468,7 +3468,7 @@ arm_vfp_cprc_reg_char (enum arm_vfp_cprc_base_type b)
34683468
array). Vector types are not currently supported, matching the
34693469
generic AAPCS support. */
34703470

3471-
static int
3471+
static LONGEST
34723472
arm_vfp_cprc_sub_candidate (struct type *t,
34733473
enum arm_vfp_cprc_base_type *base_type)
34743474
{
@@ -3551,7 +3551,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
35513551
}
35523552
else
35533553
{
3554-
int count;
3554+
LONGEST count;
35553555
unsigned unitlen;
35563556

35573557
count = arm_vfp_cprc_sub_candidate (TYPE_TARGET_TYPE (t),
@@ -3574,12 +3574,12 @@ arm_vfp_cprc_sub_candidate (struct type *t,
35743574

35753575
case TYPE_CODE_STRUCT:
35763576
{
3577-
int count = 0;
3577+
LONGEST count = 0;
35783578
unsigned unitlen;
35793579
int i;
35803580
for (i = 0; i < TYPE_NFIELDS (t); i++)
35813581
{
3582-
int sub_count = 0;
3582+
LONGEST sub_count = 0;
35833583

35843584
if (!field_is_static (&TYPE_FIELD (t, i)))
35853585
sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
@@ -3603,13 +3603,15 @@ arm_vfp_cprc_sub_candidate (struct type *t,
36033603

36043604
case TYPE_CODE_UNION:
36053605
{
3606-
int count = 0;
3606+
LONGEST count = 0;
36073607
unsigned unitlen;
36083608
int i;
36093609
for (i = 0; i < TYPE_NFIELDS (t); i++)
36103610
{
3611-
int sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
3612-
base_type);
3611+
LONGEST sub_count;
3612+
3613+
sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
3614+
base_type);
36133615
if (sub_count == -1)
36143616
return -1;
36153617
count = (count > sub_count ? count : sub_count);
@@ -3645,7 +3647,7 @@ arm_vfp_call_candidate (struct type *t, enum arm_vfp_cprc_base_type *base_type,
36453647
int *count)
36463648
{
36473649
enum arm_vfp_cprc_base_type b = VFP_CPRC_UNKNOWN;
3648-
int c = arm_vfp_cprc_sub_candidate (t, &b);
3650+
LONGEST c = arm_vfp_cprc_sub_candidate (t, &b);
36493651
if (c <= 0 || c > 4)
36503652
return 0;
36513653
*base_type = b;
@@ -3726,7 +3728,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
37263728

37273729
for (argnum = 0; argnum < nargs; argnum++)
37283730
{
3729-
int len;
3731+
LONGEST len;
37303732
struct type *arg_type;
37313733
struct type *target_type;
37323734
enum type_code typecode;

gdb/avr-tdep.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,13 +1192,13 @@ avr_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
11921192

11931193
struct stack_item
11941194
{
1195-
int len;
1195+
ssize_t len;
11961196
struct stack_item *prev;
11971197
gdb_byte *data;
11981198
};
11991199

12001200
static struct stack_item *
1201-
push_stack_item (struct stack_item *prev, const bfd_byte *contents, int len)
1201+
push_stack_item (struct stack_item *prev, const bfd_byte *contents, ssize_t len)
12021202
{
12031203
struct stack_item *si;
12041204
si = XNEW (struct stack_item);
@@ -1286,12 +1286,12 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
12861286

12871287
for (i = 0; i < nargs; i++)
12881288
{
1289-
int last_regnum;
1290-
int j;
1289+
ssize_t last_regnum;
1290+
ssize_t j;
12911291
struct value *arg = args[i];
12921292
struct type *type = check_typedef (value_type (arg));
12931293
const bfd_byte *contents = value_contents (arg);
1294-
int len = TYPE_LENGTH (type);
1294+
ssize_t len = TYPE_LENGTH (type);
12951295

12961296
/* Calculate the potential last register needed.
12971297
E.g. For length 2, registers regnum and regnum-1 (say 25 and 24)

gdb/bfin-tdep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ bfin_push_dummy_call (struct gdbarch *gdbarch,
504504
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
505505
int i;
506506
long reg_r0, reg_r1, reg_r2;
507-
int total_len = 0;
507+
ssize_t total_len = 0;
508508

509509
for (i = nargs - 1; i >= 0; i--)
510510
{
@@ -526,7 +526,7 @@ bfin_push_dummy_call (struct gdbarch *gdbarch,
526526
{
527527
struct type *value_type = value_enclosing_type (args[i]);
528528
struct type *arg_type = check_typedef (value_type);
529-
int container_len = (TYPE_LENGTH (value_type) + 3) & ~3;
529+
ssize_t container_len = (TYPE_LENGTH (value_type) + 3) & ~3;
530530

531531
sp -= container_len;
532532
write_memory (sp, value_contents (args[i]), container_len);

gdb/cris-tdep.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -663,13 +663,13 @@ static CORE_ADDR cris_unwind_sp (struct gdbarch *gdbarch,
663663

664664
struct stack_item
665665
{
666-
int len;
666+
ssize_t len;
667667
struct stack_item *prev;
668668
gdb_byte *data;
669669
};
670670

671671
static struct stack_item *
672-
push_stack_item (struct stack_item *prev, const gdb_byte *contents, int len)
672+
push_stack_item (struct stack_item *prev, const gdb_byte *contents, ssize_t len)
673673
{
674674
struct stack_item *si = XNEW (struct stack_item);
675675
si->data = (gdb_byte *) xmalloc (len);
@@ -833,13 +833,13 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
833833

834834
for (argnum = 0; argnum < nargs; argnum++)
835835
{
836-
int len;
836+
ssize_t len;
837837
const gdb_byte *val;
838-
int reg_demand;
839-
int i;
838+
ssize_t reg_demand;
839+
ssize_t i;
840840

841-
len = TYPE_LENGTH (value_type (args[argnum]));
842841
val = value_contents (args[argnum]);
842+
len = TYPE_LENGTH (value_type (args[argnum]));
843843

844844
/* How may registers worth of storage do we need for this argument? */
845845
reg_demand = (len / 4) + (len % 4 != 0 ? 1 : 0);

gdb/h8300-tdep.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
637637
int struct_return, CORE_ADDR struct_addr)
638638
{
639639
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
640-
int stack_alloc = 0, stack_offset = 0;
640+
LONGEST stack_alloc = 0, stack_offset = 0;
641641
int wordsize = BINWORD (gdbarch);
642642
int reg = E_ARG0_REGNUM;
643643
int argument;
@@ -663,11 +663,11 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
663663
for (argument = 0; argument < nargs; argument++)
664664
{
665665
struct type *type = value_type (args[argument]);
666-
int len = TYPE_LENGTH (type);
666+
ssize_t len = TYPE_LENGTH (type);
667667
char *contents = (char *) value_contents (args[argument]);
668668

669669
/* Pad the argument appropriately. */
670-
int padded_len = align_up (len, wordsize);
670+
ssize_t padded_len = align_up (len, wordsize);
671671
/* Use std::vector here to get zero initialization. */
672672
std::vector<gdb_byte> padded (padded_len);
673673

@@ -696,7 +696,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
696696
/* Heavens to Betsy --- it's really going in registers!
697697
Note that on the h8/300s, there are gaps between the
698698
registers in the register file. */
699-
int offset;
699+
ssize_t offset;
700700

701701
for (offset = 0; offset < padded_len; offset += wordsize)
702702
{

gdb/hppa-tdep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
984984
{
985985
struct value *arg = args[i];
986986
struct type *type = value_type (arg);
987-
int len = TYPE_LENGTH (type);
987+
LONGEST len = TYPE_LENGTH (type);
988988
const bfd_byte *valbuf;
989989
bfd_byte fptrbuf[8];
990990
int regnum;
@@ -1177,7 +1177,7 @@ hppa64_return_value (struct gdbarch *gdbarch, struct value *function,
11771177
struct type *type, struct regcache *regcache,
11781178
gdb_byte *readbuf, const gdb_byte *writebuf)
11791179
{
1180-
int len = TYPE_LENGTH (type);
1180+
LONGEST len = TYPE_LENGTH (type);
11811181
int regnum, offset;
11821182

11831183
if (len > 16)

gdb/i386-darwin-tdep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
166166

167167
for (write_pass = 0; write_pass < 2; write_pass++)
168168
{
169-
int args_space = 0;
169+
LONGEST args_space = 0;
170170
int num_m128 = 0;
171171

172172
if (struct_return)

0 commit comments

Comments
 (0)