Skip to content

Commit abf0c8c

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 72d2e4b commit abf0c8c

30 files changed

+135
-127
lines changed

gdb/alpha-tdep.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,17 +300,17 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
300300
{
301301
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
302302
int i;
303-
int accumulate_size = (return_method == return_method_struct) ? 8 : 0;
303+
ssize_t accumulate_size = (return_method == return_method_struct) ? 8 : 0;
304304
struct alpha_arg
305305
{
306306
const gdb_byte *contents;
307-
int len;
308-
int offset;
307+
ssize_t len;
308+
ssize_t offset;
309309
};
310310
struct alpha_arg *alpha_args = XALLOCAVEC (struct alpha_arg, nargs);
311311
struct alpha_arg *m_arg;
312312
gdb_byte arg_reg_buffer[ALPHA_REGISTER_SIZE * ALPHA_NUM_ARG_REGS];
313-
int required_arg_regs;
313+
ssize_t required_arg_regs;
314314
CORE_ADDR func_addr = find_function_addr (function, NULL);
315315

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

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

gdb/amd64-tdep.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -905,8 +905,8 @@ amd64_push_arguments (struct regcache *regcache, int nargs, struct value **args,
905905
};
906906
struct value **stack_args = XALLOCAVEC (struct value *, nargs);
907907
int num_stack_args = 0;
908-
int num_elements = 0;
909-
int element = 0;
908+
LONGEST num_elements = 0;
909+
LONGEST element = 0;
910910
int integer_reg = 0;
911911
int sse_reg = 0;
912912
int i;
@@ -918,7 +918,7 @@ if (return_method == return_method_struct)
918918
for (i = 0; i < nargs; i++)
919919
{
920920
struct type *type = value_type (args[i]);
921-
int len = TYPE_LENGTH (type);
921+
LONGEST len = TYPE_LENGTH (type);
922922
enum amd64_reg_class theclass[2];
923923
int needed_integer_regs = 0;
924924
int needed_sse_regs = 0;
@@ -982,7 +982,7 @@ if (return_method == return_method_struct)
982982

983983
gdb_assert (regnum != -1);
984984
memset (buf, 0, sizeof buf);
985-
memcpy (buf, valbuf + j * 8, std::min (len, 8));
985+
memcpy (buf, valbuf + j * 8, std::min (len, (LONGEST) 8));
986986
regcache->raw_write_part (regnum, offset, 8, buf);
987987
}
988988
}

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
@@ -3440,7 +3440,7 @@ arm_vfp_cprc_reg_char (enum arm_vfp_cprc_base_type b)
34403440
array). Vector types are not currently supported, matching the
34413441
generic AAPCS support. */
34423442

3443-
static int
3443+
static LONGEST
34443444
arm_vfp_cprc_sub_candidate (struct type *t,
34453445
enum arm_vfp_cprc_base_type *base_type)
34463446
{
@@ -3523,7 +3523,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
35233523
}
35243524
else
35253525
{
3526-
int count;
3526+
LONGEST count;
35273527
unsigned unitlen;
35283528

35293529
count = arm_vfp_cprc_sub_candidate (TYPE_TARGET_TYPE (t),
@@ -3546,12 +3546,12 @@ arm_vfp_cprc_sub_candidate (struct type *t,
35463546

35473547
case TYPE_CODE_STRUCT:
35483548
{
3549-
int count = 0;
3549+
LONGEST count = 0;
35503550
unsigned unitlen;
35513551
int i;
35523552
for (i = 0; i < TYPE_NFIELDS (t); i++)
35533553
{
3554-
int sub_count = 0;
3554+
LONGEST sub_count = 0;
35553555

35563556
if (!field_is_static (&TYPE_FIELD (t, i)))
35573557
sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
@@ -3575,13 +3575,15 @@ arm_vfp_cprc_sub_candidate (struct type *t,
35753575

35763576
case TYPE_CODE_UNION:
35773577
{
3578-
int count = 0;
3578+
LONGEST count = 0;
35793579
unsigned unitlen;
35803580
int i;
35813581
for (i = 0; i < TYPE_NFIELDS (t); i++)
35823582
{
3583-
int sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
3584-
base_type);
3583+
LONGEST sub_count;
3584+
3585+
sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
3586+
base_type);
35853587
if (sub_count == -1)
35863588
return -1;
35873589
count = (count > sub_count ? count : sub_count);
@@ -3617,7 +3619,7 @@ arm_vfp_call_candidate (struct type *t, enum arm_vfp_cprc_base_type *base_type,
36173619
int *count)
36183620
{
36193621
enum arm_vfp_cprc_base_type b = VFP_CPRC_UNKNOWN;
3620-
int c = arm_vfp_cprc_sub_candidate (t, &b);
3622+
LONGEST c = arm_vfp_cprc_sub_candidate (t, &b);
36213623
if (c <= 0 || c > 4)
36223624
return 0;
36233625
*base_type = b;
@@ -3699,7 +3701,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
36993701

37003702
for (argnum = 0; argnum < nargs; argnum++)
37013703
{
3702-
int len;
3704+
LONGEST len;
37033705
struct type *arg_type;
37043706
struct type *target_type;
37053707
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);
@@ -1287,12 +1287,12 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
12871287

12881288
for (i = 0; i < nargs; i++)
12891289
{
1290-
int last_regnum;
1291-
int j;
1290+
ssize_t last_regnum;
1291+
ssize_t j;
12921292
struct value *arg = args[i];
12931293
struct type *type = check_typedef (value_type (arg));
12941294
const bfd_byte *contents = value_contents (arg);
1295-
int len = TYPE_LENGTH (type);
1295+
ssize_t len = TYPE_LENGTH (type);
12961296

12971297
/* Calculate the potential last register needed.
12981298
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 (arg_type) + 3) & ~3;
529+
ssize_t container_len = (TYPE_LENGTH (arg_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
@@ -657,13 +657,13 @@ static CORE_ADDR crisv32_scan_prologue (CORE_ADDR pc,
657657

658658
struct stack_item
659659
{
660-
int len;
660+
ssize_t len;
661661
struct stack_item *prev;
662662
gdb_byte *data;
663663
};
664664

665665
static struct stack_item *
666-
push_stack_item (struct stack_item *prev, const gdb_byte *contents, int len)
666+
push_stack_item (struct stack_item *prev, const gdb_byte *contents, ssize_t len)
667667
{
668668
struct stack_item *si = XNEW (struct stack_item);
669669
si->data = (gdb_byte *) xmalloc (len);
@@ -814,13 +814,13 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
814814

815815
for (argnum = 0; argnum < nargs; argnum++)
816816
{
817-
int len;
817+
ssize_t len;
818818
const gdb_byte *val;
819-
int reg_demand;
820-
int i;
819+
ssize_t reg_demand;
820+
ssize_t i;
821821

822-
len = TYPE_LENGTH (value_type (args[argnum]));
823822
val = value_contents (args[argnum]);
823+
len = TYPE_LENGTH (value_type (args[argnum]));
824824

825825
/* How may registers worth of storage do we need for this argument? */
826826
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
@@ -619,7 +619,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
619619
CORE_ADDR struct_addr)
620620
{
621621
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
622-
int stack_alloc = 0, stack_offset = 0;
622+
LONGEST stack_alloc = 0, stack_offset = 0;
623623
int wordsize = BINWORD (gdbarch);
624624
int reg = E_ARG0_REGNUM;
625625
int argument;
@@ -645,11 +645,11 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
645645
for (argument = 0; argument < nargs; argument++)
646646
{
647647
struct type *type = value_type (args[argument]);
648-
int len = TYPE_LENGTH (type);
648+
ssize_t len = TYPE_LENGTH (type);
649649
char *contents = (char *) value_contents (args[argument]);
650650

651651
/* Pad the argument appropriately. */
652-
int padded_len = align_up (len, wordsize);
652+
ssize_t padded_len = align_up (len, wordsize);
653653
/* Use std::vector here to get zero initialization. */
654654
std::vector<gdb_byte> padded (padded_len);
655655

@@ -678,7 +678,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
678678
/* Heavens to Betsy --- it's really going in registers!
679679
Note that on the h8/300s, there are gaps between the
680680
registers in the register file. */
681-
int offset;
681+
ssize_t offset;
682682

683683
for (offset = 0; offset < padded_len; offset += wordsize)
684684
{

gdb/hppa-tdep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
985985
{
986986
struct value *arg = args[i];
987987
struct type *type = value_type (arg);
988-
int len = TYPE_LENGTH (type);
988+
LONGEST len = TYPE_LENGTH (type);
989989
const bfd_byte *valbuf;
990990
bfd_byte fptrbuf[8];
991991
int regnum;
@@ -1178,7 +1178,7 @@ hppa64_return_value (struct gdbarch *gdbarch, struct value *function,
11781178
struct type *type, struct regcache *regcache,
11791179
gdb_byte *readbuf, const gdb_byte *writebuf)
11801180
{
1181-
int len = TYPE_LENGTH (type);
1181+
LONGEST len = TYPE_LENGTH (type);
11821182
int regnum, offset;
11831183

11841184
if (len > 16)

gdb/i386-darwin-tdep.c

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

168168
for (write_pass = 0; write_pass < 2; write_pass++)
169169
{
170-
int args_space = 0;
170+
LONGEST args_space = 0;
171171
int num_m128 = 0;
172172

173173
if (return_method == return_method_struct)

0 commit comments

Comments
 (0)