Fix `GDB cannot access struct member whose offset is larger than 256MB'

(RH BZ 871066).
This commit is contained in:
Jan Kratochvil 2012-11-09 19:03:10 +01:00
parent 75aac11369
commit 92b52c5e6f
23 changed files with 9967 additions and 1 deletions

View File

@ -0,0 +1,23 @@
http://sourceware.org/ml/gdb-cvs/2012-07/msg00173.html
### src/gdb/ChangeLog 2012/07/20 17:54:05 1.14507
### src/gdb/ChangeLog 2012/07/22 16:52:39 1.14508
## -1,3 +1,7 @@
+2012-07-22 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * sh-tdep.c (sh_treat_as_flt_p): Remove unused variable LEN.
+
2012-07-20 Jeff Kenton <jkenton@tilera.com>
* tilegx-linux-tdep.c (tilegx_linux_sigframe_init): Fix
--- src/gdb/sh-tdep.c 2012/06/08 14:24:57 1.245
+++ src/gdb/sh-tdep.c 2012/07/22 16:52:41 1.246
@@ -1032,8 +1032,6 @@
static int
sh_treat_as_flt_p (struct type *type)
{
- int len = TYPE_LENGTH (type);
-
/* Ordinary float types are obviously treated as float. */
if (TYPE_CODE (type) == TYPE_CODE_FLT)
return 1;

View File

@ -0,0 +1,64 @@
http://sourceware.org/ml/gdb-cvs/2012-07/msg00182.html
### src/gdb/ChangeLog 2012/07/23 15:25:11 1.14514
### src/gdb/ChangeLog 2012/07/23 18:08:27 1.14515
## -1,3 +1,9 @@
+2012-07-23 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * p-valprint.c (pascal_object_print_value): Replace potentially
+ unsafe alloca with xmalloc/xfree.
+ * valops.c (search_struct_method): Likewise.
+
2012-07-23 Tom Tromey <tromey@redhat.com>
* solib-svr4.c (enable_break): Update.
--- src/gdb/p-valprint.c 2012/05/18 21:02:49 1.100
+++ src/gdb/p-valprint.c 2012/07/23 18:08:29 1.101
@@ -797,8 +797,11 @@
if (boffset < 0 || boffset >= TYPE_LENGTH (type))
{
- /* FIXME (alloc): not safe is baseclass is really really big. */
- gdb_byte *buf = alloca (TYPE_LENGTH (baseclass));
+ gdb_byte *buf;
+ struct cleanup *back_to;
+
+ buf = xmalloc (TYPE_LENGTH (baseclass));
+ back_to = make_cleanup (xfree, buf);
base_valaddr = buf;
if (target_read_memory (address + boffset, buf,
@@ -807,6 +810,7 @@
address = address + boffset;
thisoffset = 0;
boffset = 0;
+ do_cleanups (back_to);
}
else
base_valaddr = valaddr;
--- src/gdb/valops.c 2012/06/24 07:28:10 1.297
+++ src/gdb/valops.c 2012/07/23 18:08:29 1.298
@@ -2281,8 +2281,13 @@
if (offset < 0 || offset >= TYPE_LENGTH (type))
{
- gdb_byte *tmp = alloca (TYPE_LENGTH (baseclass));
- CORE_ADDR address = value_address (*arg1p);
+ gdb_byte *tmp;
+ struct cleanup *back_to;
+ CORE_ADDR address;
+
+ tmp = xmalloc (TYPE_LENGTH (baseclass));
+ back_to = make_cleanup (xfree, tmp);
+ address = value_address (*arg1p);
if (target_read_memory (address + offset,
tmp, TYPE_LENGTH (baseclass)) != 0)
@@ -2293,6 +2298,7 @@
address + offset);
base_valaddr = value_contents_for_printing (base_val);
this_offset = 0;
+ do_cleanups (back_to);
}
else
{

View File

@ -0,0 +1,139 @@
http://sourceware.org/ml/gdb-cvs/2012-07/msg00213.html
### src/gdb/ChangeLog 2012/07/25 20:14:17 1.14531
### src/gdb/ChangeLog 2012/07/26 02:03:14 1.14532
## -1,3 +1,17 @@
+2012-07-26 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Expand parameter
+ SIZE to size_t.
+ (dwarf2_evaluate_loc_desc): Likewise.
+ (dwarf2_loc_desc_needs_frame): Likewise.
+ (locexpr_describe_location_1): Likewise.
+ * dwarf2loc.h (struct dwarf2_locexpr_baton): Make SIZE as
+ size_t.
+ (struct dwarf2_loclist_baton): Likewise.
+ * dwarf2read.c (struct dwarf_block): Likewise.
+ (dump_die_shallow): Use pulongest to print dwarf_block.size.
+ (decode_locdesc): Expand SIZE and I to size_t.
+
2012-07-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* contrib/cc-with-tweaks.sh: Put into comment path gdb/contrib/.
--- src/gdb/dwarf2loc.c 2012/07/13 20:15:50 1.152
+++ src/gdb/dwarf2loc.c 2012/07/26 02:03:16 1.153
@@ -54,8 +54,8 @@
static struct value *dwarf2_evaluate_loc_desc_full (struct type *type,
struct frame_info *frame,
const gdb_byte *data,
- unsigned short size,
- struct dwarf2_per_cu_data *per_cu,
+ size_t size,
+ struct dwarf2_per_cu_data *per_cu,
LONGEST byte_offset);
/* Until these have formal names, we define these here.
@@ -2111,7 +2111,7 @@
static struct value *
dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
- const gdb_byte *data, unsigned short size,
+ const gdb_byte *data, size_t size,
struct dwarf2_per_cu_data *per_cu,
LONGEST byte_offset)
{
@@ -2312,7 +2312,7 @@
struct value *
dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame,
- const gdb_byte *data, unsigned short size,
+ const gdb_byte *data, size_t size,
struct dwarf2_per_cu_data *per_cu)
{
return dwarf2_evaluate_loc_desc_full (type, frame, data, size, per_cu, 0);
@@ -2433,7 +2433,7 @@
requires a frame to evaluate. */
static int
-dwarf2_loc_desc_needs_frame (const gdb_byte *data, unsigned short size,
+dwarf2_loc_desc_needs_frame (const gdb_byte *data, size_t size,
struct dwarf2_per_cu_data *per_cu)
{
struct needs_frame_baton baton;
@@ -3827,7 +3827,7 @@
static void
locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr,
struct ui_file *stream,
- const gdb_byte *data, int size,
+ const gdb_byte *data, size_t size,
struct objfile *objfile, unsigned int addr_size,
int offset_size, struct dwarf2_per_cu_data *per_cu)
{
--- src/gdb/dwarf2loc.h 2012/05/22 18:45:22 1.33
+++ src/gdb/dwarf2loc.h 2012/07/26 02:03:16 1.34
@@ -77,7 +77,7 @@
struct value *dwarf2_evaluate_loc_desc (struct type *type,
struct frame_info *frame,
const gdb_byte *data,
- unsigned short size,
+ size_t size,
struct dwarf2_per_cu_data *per_cu);
CORE_ADDR dwarf2_read_addr_index (struct dwarf2_per_cu_data *per_cu,
@@ -97,7 +97,7 @@
/* Length of the location expression. For optimized out expressions it is
zero. */
- unsigned long size;
+ size_t size;
/* The compilation unit containing the symbol whose location
we're computing. */
@@ -114,7 +114,7 @@
const gdb_byte *data;
/* Length of the location list. */
- unsigned long size;
+ size_t size;
/* The compilation unit containing the symbol whose location
we're computing. */
--- src/gdb/dwarf2read.c 2012/07/20 17:38:04 1.697
+++ src/gdb/dwarf2read.c 2012/07/26 02:03:16 1.698
@@ -990,7 +990,7 @@
/* Blocks are a bunch of untyped bytes. */
struct dwarf_block
{
- unsigned int size;
+ size_t size;
/* Valid only if SIZE is not zero. */
gdb_byte *data;
@@ -16197,12 +16197,12 @@
case DW_FORM_block4:
case DW_FORM_block:
case DW_FORM_block1:
- fprintf_unfiltered (f, "block: size %d",
- DW_BLOCK (&die->attrs[i])->size);
+ fprintf_unfiltered (f, "block: size %s",
+ pulongest (DW_BLOCK (&die->attrs[i])->size));
break;
case DW_FORM_exprloc:
- fprintf_unfiltered (f, "expression: size %u",
- DW_BLOCK (&die->attrs[i])->size);
+ fprintf_unfiltered (f, "expression: size %s",
+ pulongest (DW_BLOCK (&die->attrs[i])->size));
break;
case DW_FORM_ref_addr:
fprintf_unfiltered (f, "ref address: ");
@@ -16746,8 +16746,8 @@
decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->objfile;
- int i;
- int size = blk->size;
+ size_t i;
+ size_t size = blk->size;
gdb_byte *data = blk->data;
CORE_ADDR stack[64];
int stacki;

View File

@ -0,0 +1,34 @@
http://sourceware.org/ml/gdb-cvs/2012-08/msg00085.html
### src/gdb/ChangeLog 2012/08/10 05:03:07 1.14574
### src/gdb/ChangeLog 2012/08/10 18:55:16 1.14575
## -1,3 +1,9 @@
+2012-08-10 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * python/py-type.c (convert_field): Use gdb_py_long_from_longest
+ for TYPE_FIELD_BITPOS.
+ (typy_get_sizeof): Likewise for TYPE_LENGTH.
+
2012-08-10 Mike Frysinger <vapier@gentoo.org>
PR cli/10436:
--- src/gdb/python/py-type.c 2012/05/18 21:02:52 1.39
+++ src/gdb/python/py-type.c 2012/08/10 18:55:18 1.40
@@ -176,7 +176,7 @@
}
else
{
- arg = PyLong_FromLong (TYPE_FIELD_BITPOS (type, field));
+ arg = gdb_py_long_from_longest (TYPE_FIELD_BITPOS (type, field));
attrstring = "bitpos";
}
@@ -683,7 +683,7 @@
}
/* Ignore exceptions. */
- return PyLong_FromLong (TYPE_LENGTH (type));
+ return gdb_py_long_from_longest (TYPE_LENGTH (type));
}
static struct type *

View File

@ -0,0 +1,119 @@
http://sourceware.org/ml/gdb-cvs/2012-08/msg00187.html
### src/gdb/ChangeLog 2012/08/24 03:17:12 1.14628
### src/gdb/ChangeLog 2012/08/24 03:57:22 1.14629
## -1,3 +1,11 @@
+2012-08-24 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * h8300-tdep.c (h8300_push_dummy_call): Replace unsafe alloca
+ with xmalloc/cleanup.
+ * mt-tdep.c (mt_push_dummy_call): Likewise.
+ * tilegx-tdep.c (tilegx_push_dummy_call): Likewise.
+ * xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise.
+
2012-08-24 Yao Qi <yao@codesourcery.com>
* jv-exp.y (push_expression_name): Add "." at the end of error
--- src/gdb/h8300-tdep.c 2012/05/18 21:02:47 1.133
+++ src/gdb/h8300-tdep.c 2012/08/24 03:57:22 1.134
@@ -666,13 +666,15 @@
for (argument = 0; argument < nargs; argument++)
{
+ struct cleanup *back_to;
struct type *type = value_type (args[argument]);
int len = TYPE_LENGTH (type);
char *contents = (char *) value_contents (args[argument]);
/* Pad the argument appropriately. */
int padded_len = align_up (len, wordsize);
- gdb_byte *padded = alloca (padded_len);
+ gdb_byte *padded = xmalloc (padded_len);
+ back_to = make_cleanup (xfree, padded);
memset (padded, 0, padded_len);
memcpy (len < wordsize ? padded + padded_len - len : padded,
@@ -720,6 +722,8 @@
subsequent arguments go on the stack. */
reg = E_ARGLAST_REGNUM + 1;
}
+
+ do_cleanups (back_to);
}
/* Store return address. */
--- src/gdb/mt-tdep.c 2012/05/16 14:35:06 1.40
+++ src/gdb/mt-tdep.c 2012/08/24 03:57:22 1.41
@@ -845,16 +845,20 @@
for (j = nargs - 1; j >= i; j--)
{
gdb_byte *val;
+ struct cleanup *back_to;
+ const gdb_byte *contents = value_contents (args[j]);
/* Right-justify the value in an aligned-length buffer. */
typelen = TYPE_LENGTH (value_type (args[j]));
slacklen = (wordsize - (typelen % wordsize)) % wordsize;
- val = alloca (typelen + slacklen);
- memcpy (val, value_contents (args[j]), typelen);
+ val = xmalloc (typelen + slacklen);
+ back_to = make_cleanup (xfree, val);
+ memcpy (val, contents, typelen);
memset (val + typelen, 0, slacklen);
/* Now write this data to the stack. */
stack_dest -= typelen + slacklen;
write_memory (stack_dest, val, typelen + slacklen);
+ do_cleanups (back_to);
}
/* Finally, if a param needs to be split between registers and stack,
--- src/gdb/tilegx-tdep.c 2012/05/30 19:31:44 1.1
+++ src/gdb/tilegx-tdep.c 2012/08/24 03:57:22 1.2
@@ -343,16 +343,20 @@
for (j = nargs - 1; j >= i; j--)
{
gdb_byte *val;
+ struct cleanup *back_to;
+ const gdb_byte *contents = value_contents (args[j]);
typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
slacklen = ((typelen + 3) & (~3)) - typelen;
- val = alloca (typelen + slacklen);
- memcpy (val, value_contents (args[j]), typelen);
+ val = xmalloc (typelen + slacklen);
+ back_to = make_cleanup (xfree, val);
+ memcpy (val, contents, typelen);
memset (val + typelen, 0, slacklen);
/* Now write data to the stack. The stack grows downwards. */
stack_dest -= typelen + slacklen;
write_memory (stack_dest, val, typelen + slacklen);
+ do_cleanups (back_to);
}
/* Add 2 words for linkage space to the stack. */
--- src/gdb/xstormy16-tdep.c 2012/05/16 14:35:08 1.118
+++ src/gdb/xstormy16-tdep.c 2012/08/24 03:57:22 1.119
@@ -279,16 +279,20 @@
for (j = nargs - 1; j >= i; j--)
{
char *val;
+ struct cleanup *back_to;
+ const gdb_byte *bytes = value_contents (args[j]);
typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
slacklen = typelen & 1;
- val = alloca (typelen + slacklen);
- memcpy (val, value_contents (args[j]), typelen);
+ val = xmalloc (typelen + slacklen);
+ back_to = make_cleanup (xfree, val);
+ memcpy (val, bytes, typelen);
memset (val + typelen, 0, slacklen);
/* Now write this data to the stack. The stack grows upwards. */
write_memory (stack_dest, val, typelen + slacklen);
stack_dest += typelen + slacklen;
+ do_cleanups (back_to);
}
store_unsigned_integer (buf, xstormy16_pc_size, byte_order, bp_addr);

View File

@ -0,0 +1,34 @@
http://sourceware.org/ml/gdb-cvs/2012-09/msg00065.html
### src/gdb/ChangeLog 2012/09/14 00:54:57 1.14656
### src/gdb/ChangeLog 2012/09/14 07:00:37 1.14657
## -1,3 +1,8 @@
+2012-09-14 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * printcmd.c (ui_printf): Eliminate single-use variable
+ PARAM_LEN.
+
2012-09-14 Yao Qi <yao@codesourcery.com>
Pedro Alves <palves@redhat.com>
--- src/gdb/printcmd.c 2012/09/11 21:26:16 1.211
+++ src/gdb/printcmd.c 2012/09/14 07:00:42 1.212
@@ -2267,7 +2267,6 @@
/* Parameter data. */
struct type *param_type = value_type (val_args[i]);
- unsigned int param_len = TYPE_LENGTH (param_type);
struct gdbarch *gdbarch = get_type_arch (param_type);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -2329,8 +2328,8 @@
/* Conversion between different DFP types. */
if (TYPE_CODE (param_type) == TYPE_CODE_DECFLOAT)
- decimal_convert (param_ptr, param_len, byte_order,
- dec, dfp_len, byte_order);
+ decimal_convert (param_ptr, TYPE_LENGTH (param_type),
+ byte_order, dec, dfp_len, byte_order);
else
/* If this is a non-trivial conversion, just output 0.
A correct converted value can be displayed by explicitly

View File

@ -0,0 +1,66 @@
http://sourceware.org/ml/gdb-cvs/2012-09/msg00068.html
### src/gdb/ChangeLog 2012/09/14 12:10:21 1.14659
### src/gdb/ChangeLog 2012/09/14 12:46:55 1.14660
## -1,3 +1,8 @@
+2012-09-14 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * valarith.c (value_concat): Replace unsafe ALLOCA with
+ XMALLOC/XFREE.
+
2012-09-14 Pedro Alves <palves@redhat.com>
* gdb.1 (SEE ALSO): Expand pointer to GDB's Texinfo manual.
Index: gdb-7.5.0.20120926/gdb/valarith.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/valarith.c 2012-11-07 22:00:41.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/valarith.c 2012-11-07 22:02:18.661767281 +0100
@@ -716,9 +716,12 @@ value_concat (struct value *arg1, struct
if (TYPE_CODE (type2) == TYPE_CODE_STRING
|| TYPE_CODE (type2) == TYPE_CODE_CHAR)
{
+ struct cleanup *back_to;
+
count = longest_to_int (value_as_long (inval1));
inval2len = TYPE_LENGTH (type2);
- ptr = (char *) alloca (count * inval2len);
+ ptr = (char *) xmalloc (count * inval2len);
+ back_to = make_cleanup (xfree, ptr);
if (TYPE_CODE (type2) == TYPE_CODE_CHAR)
{
char_type = type2;
@@ -741,6 +744,7 @@ value_concat (struct value *arg1, struct
}
}
outval = value_string (ptr, count * inval2len, char_type);
+ do_cleanups (back_to);
}
else if (TYPE_CODE (type2) == TYPE_CODE_BITSTRING
|| TYPE_CODE (type2) == TYPE_CODE_BOOL)
@@ -755,6 +759,8 @@ value_concat (struct value *arg1, struct
else if (TYPE_CODE (type1) == TYPE_CODE_STRING
|| TYPE_CODE (type1) == TYPE_CODE_CHAR)
{
+ struct cleanup *back_to;
+
/* We have two character strings to concatenate. */
if (TYPE_CODE (type2) != TYPE_CODE_STRING
&& TYPE_CODE (type2) != TYPE_CODE_CHAR)
@@ -763,7 +769,8 @@ value_concat (struct value *arg1, struct
}
inval1len = TYPE_LENGTH (type1);
inval2len = TYPE_LENGTH (type2);
- ptr = (char *) alloca (inval1len + inval2len);
+ ptr = (char *) xmalloc (inval1len + inval2len);
+ back_to = make_cleanup (xfree, ptr);
if (TYPE_CODE (type1) == TYPE_CODE_CHAR)
{
char_type = type1;
@@ -786,6 +793,7 @@ value_concat (struct value *arg1, struct
memcpy (ptr + inval1len, value_contents (inval2), inval2len);
}
outval = value_string (ptr, inval1len + inval2len, char_type);
+ do_cleanups (back_to);
}
else if (TYPE_CODE (type1) == TYPE_CODE_BITSTRING
|| TYPE_CODE (type1) == TYPE_CODE_BOOL)

View File

@ -0,0 +1,28 @@
http://sourceware.org/ml/gdb-cvs/2012-09/msg00082.html
### src/gdb/ChangeLog 2012/09/17 07:15:47 1.14664
### src/gdb/ChangeLog 2012/09/17 07:26:54 1.14665
## -1,3 +1,8 @@
+2012-09-17 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * infrun.c (restore_infcall_suspend_state): Eliminate single-use
+ variable LEN.
+
2012-09-17 Jan Kratochvil <jan.kratochvil@redhat.com>
PR 14119
--- src/gdb/infrun.c 2012/09/17 07:09:34 1.558
+++ src/gdb/infrun.c 2012/09/17 07:26:55 1.559
@@ -6777,11 +6777,10 @@
if (inf_state->siginfo_gdbarch == gdbarch)
{
struct type *type = gdbarch_get_siginfo_type (gdbarch);
- size_t len = TYPE_LENGTH (type);
/* Errors ignored. */
target_write (&current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
- inf_state->siginfo_data, 0, len);
+ inf_state->siginfo_data, 0, TYPE_LENGTH (type));
}
/* The inferior can be gone if the user types "print exit(0)"

View File

@ -0,0 +1,209 @@
http://sourceware.org/ml/gdb-cvs/2012-09/msg00084.html
### src/gdb/ChangeLog 2012/09/17 08:42:07 1.14666
### src/gdb/ChangeLog 2012/09/17 08:52:17 1.14667
## -1,3 +1,23 @@
+2012-09-17 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * m2-valprint.c (m2_print_array_contents): Eliminate variable
+ ELTLEN and use TYPE_LENGTH directly.
+ (m2_val_print): Likewise.
+ * m68k-tdep.c (m68k_svr4_extract_return_value): Eliminate
+ variable LEN and use TYPE_LENGTH directly.
+ (m68k_svr4_store_return_value): Likewise.
+ * mips-tdep.c (mips_o32_push_dummy_call): Eliminate variable
+ ARGLEN and use TYPE_LENGTH directly.
+ (mips_o64_push_dummy_call): Likewise.
+ * s390-tdep (s390_function_arg_pass_by_reference): Eliminate
+ variable LENGTH and use TYPE_LENGTH directly.
+ (s390_function_arg_float): Likewise.
+ (s390_function_arg_integer): Likewise.
+ (s390_push_dummy_call): Likewise.
+ (s390_return_value_convention): Likewise.
+ * spu-tdep.c (spu_push_dummy_call): Eliminate LEN and use
+ TYPE_LENGTH directly.
+
2012-09-17 Yao Qi <yao@codesourcery.com>
* cli/cli-decode.c (add_setshow_zuinteger_unlimited_cmd): New.
--- src/gdb/m2-valprint.c 2012/08/16 07:36:20 1.45
+++ src/gdb/m2-valprint.c 2012/09/17 08:52:18 1.46
@@ -269,16 +269,14 @@
const struct value_print_options *options,
int len)
{
- int eltlen;
CHECK_TYPEDEF (type);
if (TYPE_LENGTH (type) > 0)
{
- eltlen = TYPE_LENGTH (type);
if (options->prettyprint_arrays)
print_spaces_filtered (2 + 2 * recurse, stream);
/* For an array of chars, print with string syntax. */
- if (eltlen == 1 &&
+ if (TYPE_LENGTH (type) == 1 &&
((TYPE_CODE (type) == TYPE_CODE_INT)
|| ((current_language->la_language == language_m2)
&& (TYPE_CODE (type) == TYPE_CODE_CHAR)))
@@ -320,7 +318,6 @@
unsigned int i = 0; /* Number of characters printed. */
unsigned len;
struct type *elttype;
- unsigned eltlen;
CORE_ADDR addr;
CHECK_TYPEDEF (type);
@@ -330,12 +327,11 @@
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
{
elttype = check_typedef (TYPE_TARGET_TYPE (type));
- eltlen = TYPE_LENGTH (elttype);
- len = TYPE_LENGTH (type) / eltlen;
+ len = TYPE_LENGTH (type) / TYPE_LENGTH (elttype);
if (options->prettyprint_arrays)
print_spaces_filtered (2 + 2 * recurse, stream);
/* For an array of chars, print with string syntax. */
- if (eltlen == 1 &&
+ if (TYPE_LENGTH (elttype) == 1 &&
((TYPE_CODE (elttype) == TYPE_CODE_INT)
|| ((current_language->la_language == language_m2)
&& (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
--- src/gdb/m68k-tdep.c 2012/07/24 16:37:24 1.159
+++ src/gdb/m68k-tdep.c 2012/09/17 08:52:18 1.160
@@ -315,7 +315,6 @@
m68k_svr4_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf)
{
- int len = TYPE_LENGTH (type);
gdb_byte buf[M68K_MAX_REGISTER_SIZE];
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -326,7 +325,7 @@
regcache_raw_read (regcache, M68K_FP0_REGNUM, buf);
convert_typed_floating (buf, fpreg_type, valbuf, type);
}
- else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4)
+ else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4)
regcache_raw_read (regcache, M68K_A0_REGNUM, valbuf);
else
m68k_extract_return_value (type, regcache, valbuf);
@@ -357,7 +356,6 @@
m68k_svr4_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf)
{
- int len = TYPE_LENGTH (type);
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -368,7 +366,7 @@
convert_typed_floating (valbuf, type, buf, fpreg_type);
regcache_raw_write (regcache, M68K_FP0_REGNUM, buf);
}
- else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4)
+ else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4)
{
regcache_raw_write (regcache, M68K_A0_REGNUM, valbuf);
regcache_raw_write (regcache, M68K_D0_REGNUM, valbuf);
--- src/gdb/mips-tdep.c 2012/08/19 22:22:49 1.561
+++ src/gdb/mips-tdep.c 2012/09/17 08:52:18 1.562
@@ -5174,13 +5174,12 @@
for (argnum = 0; argnum < nargs; argnum++)
{
struct type *arg_type = check_typedef (value_type (args[argnum]));
- int arglen = TYPE_LENGTH (arg_type);
/* Align to double-word if necessary. */
if (mips_type_needs_double_align (arg_type))
len = align_up (len, MIPS32_REGSIZE * 2);
/* Allocate space on the stack. */
- len += align_up (arglen, MIPS32_REGSIZE);
+ len += align_up (TYPE_LENGTH (arg_type), MIPS32_REGSIZE);
}
sp -= align_up (len, 16);
@@ -5703,10 +5702,9 @@
for (argnum = 0; argnum < nargs; argnum++)
{
struct type *arg_type = check_typedef (value_type (args[argnum]));
- int arglen = TYPE_LENGTH (arg_type);
/* Allocate space on the stack. */
- len += align_up (arglen, MIPS64_REGSIZE);
+ len += align_up (TYPE_LENGTH (arg_type), MIPS64_REGSIZE);
}
sp -= align_up (len, 16);
--- src/gdb/s390-tdep.c 2012/05/18 21:02:50 1.206
+++ src/gdb/s390-tdep.c 2012/09/17 08:52:18 1.207
@@ -2489,8 +2489,7 @@
static int
s390_function_arg_pass_by_reference (struct type *type)
{
- unsigned length = TYPE_LENGTH (type);
- if (length > 8)
+ if (TYPE_LENGTH (type) > 8)
return 1;
return (is_struct_like (type) && !is_power_of_two (TYPE_LENGTH (type)))
@@ -2503,8 +2502,7 @@
static int
s390_function_arg_float (struct type *type)
{
- unsigned length = TYPE_LENGTH (type);
- if (length > 8)
+ if (TYPE_LENGTH (type) > 8)
return 0;
return is_float_like (type);
@@ -2515,13 +2513,12 @@
static int
s390_function_arg_integer (struct type *type)
{
- unsigned length = TYPE_LENGTH (type);
- if (length > 8)
+ if (TYPE_LENGTH (type) > 8)
return 0;
return is_integer_like (type)
|| is_pointer_like (type)
- || (is_struct_like (type) && is_power_of_two (length));
+ || (is_struct_like (type) && is_power_of_two (TYPE_LENGTH (type)));
}
/* Return ARG, a `SIMPLE_ARG', sign-extended or zero-extended to a full
@@ -2616,11 +2613,10 @@
{
struct value *arg = args[i];
struct type *type = check_typedef (value_type (arg));
- unsigned length = TYPE_LENGTH (type);
if (s390_function_arg_pass_by_reference (type))
{
- sp -= length;
+ sp -= TYPE_LENGTH (type);
sp = align_down (sp, alignment_of (type));
copy_addr[i] = sp;
}
@@ -2799,8 +2795,7 @@
static enum return_value_convention
s390_return_value_convention (struct gdbarch *gdbarch, struct type *type)
{
- int length = TYPE_LENGTH (type);
- if (length > 8)
+ if (TYPE_LENGTH (type) > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
switch (TYPE_CODE (type))
--- src/gdb/spu-tdep.c 2012/05/18 21:02:50 1.81
+++ src/gdb/spu-tdep.c 2012/09/17 08:52:18 1.82
@@ -1373,8 +1373,7 @@
struct value *arg = args[i];
struct type *type = check_typedef (value_type (arg));
const gdb_byte *contents = value_contents (arg);
- int len = TYPE_LENGTH (type);
- int n_regs = align_up (len, 16) / 16;
+ int n_regs = align_up (TYPE_LENGTH (type), 16) / 16;
/* If the argument doesn't wholly fit into registers, it and
all subsequent arguments go to the stack. */

View File

@ -0,0 +1,36 @@
http://sourceware.org/ml/gdb-cvs/2012-09/msg00132.html
### src/gdb/ChangeLog 2012/09/22 13:04:54 1.14691
### src/gdb/ChangeLog 2012/09/24 10:25:07 1.14692
## -1,3 +1,8 @@
+2012-09-24 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * m2-typeprint.c (m2_enum): Expand LASTVAL to LONGEST.
+ * p-valprint.c (pascal_type_print_base): Likewise.
+
2012-09-22 Yao Qi <yao@codesourcery.com>
* remote.c (remote_get_trace_status): Remove setting default
--- src/gdb/m2-typeprint.c 2012/04/18 06:46:46 1.30
+++ src/gdb/m2-typeprint.c 2012/09/24 10:25:09 1.31
@@ -587,7 +587,8 @@
void
m2_enum (struct type *type, struct ui_file *stream, int show, int level)
{
- int lastval, i, len;
+ LONGEST lastval;
+ int i, len;
if (show < 0)
{
--- src/gdb/p-typeprint.c 2012/08/16 07:36:20 1.47
+++ src/gdb/p-typeprint.c 2012/09/24 10:25:09 1.48
@@ -440,7 +440,7 @@
{
int i;
int len;
- int lastval;
+ LONGEST lastval;
enum
{
s_none, s_public, s_private, s_protected

View File

@ -0,0 +1,27 @@
http://sourceware.org/ml/gdb-cvs/2012-09/msg00138.html
### src/gdb/ChangeLog 2012/09/24 10:25:07 1.14692
### src/gdb/ChangeLog 2012/09/25 12:20:35 1.14693
## -1,3 +1,8 @@
+2012-09-25 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * c-typeprint.c (c_type_print_varspec_suffix): Remove cast and
+ use plongest to print the array size.
+
2012-09-24 Siddhesh Poyarekar <siddhesh@redhat.com>
* m2-typeprint.c (m2_enum): Expand LASTVAL to LONGEST.
Index: gdb-7.5.0.20120926/gdb/c-typeprint.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/c-typeprint.c 2012-11-07 22:00:40.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/c-typeprint.c 2012-11-07 22:03:39.269650157 +0100
@@ -631,7 +631,8 @@ c_type_print_varspec_suffix (struct type
fprintf_filtered (stream, "variable");
}
else if (get_array_bounds (type, &low_bound, &high_bound))
- fprintf_filtered (stream, "%d", (int) (high_bound - low_bound + 1));
+ fprintf_filtered (stream, "%s",
+ plongest (high_bound - low_bound + 1));
fprintf_filtered (stream, "]");
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,

View File

@ -0,0 +1,729 @@
http://sourceware.org/ml/gdb-cvs/2012-09/msg00142.html
### src/gdb/ChangeLog 2012/09/25 12:38:55 1.14696
### src/gdb/ChangeLog 2012/09/25 12:48:52 1.14697
## -1,3 +1,36 @@
+2012-09-25 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * ada-valprint.c (ada_val_print_1): Eliminate single-use
+ variable LEN.
+ * alpha-tdep.c (alpha_extract_return_value): Use TYPE_LENGTH
+ directly.
+ (alpha_store_return_value): Likewise.
+ * amd64-tdep.c (amd64_classify_aggregate): Likewise.
+ (amd64_push_arguments): Likewise.
+ * ax-gdb.c (gen_trace_static_fields): Likewise.
+ (gen_traced_pop): Likewise.
+ * bfin-tdep.c (bfin_push_dummy_call): Likewise.
+ * breakpoint.c (update_watchpoint): Likewise.
+ * findcmd.c (parse_find_args): Use local variable for type
+ instead of length.
+ * findvar.c (default_read_var_value): Use TYPE_LENGTH directly.
+ * h8300-tdep.c (h8300h_extract_return_value): Likewise.
+ (h8300_store_return_value): Likewise.
+ * i386-darwin-tdep.c (i386_darwin_push_dummy_call): Likewise.
+ Use i386_darwin_arg_type_alignment directly.
+ * infcall.c (call_function_by_hand): Use TYPE_LENGTH directly.
+ * lm32-tdep.c (lm32_push_dummy_call): Likewise.
+ * m68hc11-tdep.c (m68hc11_push_dummy_call): Likewise.
+ (m68hc11_extract_return_value): Likewise.
+ * mep-tdep.c (mep_push_dummy_call): Likewise.
+ * printcmd.c (float_type_from_length): Likewise.
+ * s390-tdep.c (s390_value_from_register): Likewise.
+ * stack.c (read_frame_arg): Likewise.
+ * tracepoint.c (encode_actions_1): Likewise.
+ * valops.c (value_fetch_lazy): Use local variable for type
+ instead of length. Use TYPE_LENGTH directly.
+ * value.c (value_contents_equal): Use TYPE_LENGTH directly.
+
2012-09-25 Joel Brobecker <brobecker@adacore.com>
* symtab.c (skip_prologue_sal): Fix typo in comment.
Index: gdb-7.5.0.20120926/gdb/ada-valprint.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/ada-valprint.c 2012-04-18 08:46:46.000000000 +0200
+++ gdb-7.5.0.20120926/gdb/ada-valprint.c 2012-11-07 22:03:57.600623522 +0100
@@ -730,9 +730,8 @@ ada_val_print_1 (struct type *type, cons
if (ada_is_fixed_point_type (type))
{
LONGEST v = unpack_long (type, valaddr + offset_aligned);
- int len = TYPE_LENGTH (type);
- fprintf_filtered (stream, len < 4 ? "%.11g" : "%.17g",
+ fprintf_filtered (stream, TYPE_LENGTH (type) < 4 ? "%.11g" : "%.17g",
(double) ada_fixed_to_float (type, v));
return;
}
Index: gdb-7.5.0.20120926/gdb/alpha-tdep.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/alpha-tdep.c 2012-05-16 16:35:02.000000000 +0200
+++ gdb-7.5.0.20120926/gdb/alpha-tdep.c 2012-11-07 22:03:57.602623520 +0100
@@ -475,14 +475,13 @@ alpha_extract_return_value (struct type
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- int length = TYPE_LENGTH (valtype);
gdb_byte raw_buffer[ALPHA_REGISTER_SIZE];
ULONGEST l;
switch (TYPE_CODE (valtype))
{
case TYPE_CODE_FLT:
- switch (length)
+ switch (TYPE_LENGTH (valtype))
{
case 4:
regcache_cooked_read (regcache, ALPHA_FP0_REGNUM, raw_buffer);
@@ -505,7 +504,7 @@ alpha_extract_return_value (struct type
break;
case TYPE_CODE_COMPLEX:
- switch (length)
+ switch (TYPE_LENGTH (valtype))
{
case 8:
/* ??? This isn't correct wrt the ABI, but it's what GCC does. */
@@ -531,7 +530,7 @@ alpha_extract_return_value (struct type
default:
/* Assume everything else degenerates to an integer. */
regcache_cooked_read_unsigned (regcache, ALPHA_V0_REGNUM, &l);
- store_unsigned_integer (valbuf, length, byte_order, l);
+ store_unsigned_integer (valbuf, TYPE_LENGTH (valtype), byte_order, l);
break;
}
}
@@ -544,14 +543,13 @@ alpha_store_return_value (struct type *v
const gdb_byte *valbuf)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
- int length = TYPE_LENGTH (valtype);
gdb_byte raw_buffer[ALPHA_REGISTER_SIZE];
ULONGEST l;
switch (TYPE_CODE (valtype))
{
case TYPE_CODE_FLT:
- switch (length)
+ switch (TYPE_LENGTH (valtype))
{
case 4:
alpha_lds (gdbarch, raw_buffer, valbuf);
@@ -575,7 +573,7 @@ alpha_store_return_value (struct type *v
break;
case TYPE_CODE_COMPLEX:
- switch (length)
+ switch (TYPE_LENGTH (valtype))
{
case 8:
/* ??? This isn't correct wrt the ABI, but it's what GCC does. */
@@ -603,7 +601,7 @@ alpha_store_return_value (struct type *v
/* Assume everything else degenerates to an integer. */
/* 32-bit values must be sign-extended to 64 bits
even if the base data type is unsigned. */
- if (length == 4)
+ if (TYPE_LENGTH (valtype) == 4)
valtype = builtin_type (gdbarch)->builtin_int32;
l = unpack_long (valtype, valbuf);
regcache_cooked_write_unsigned (regcache, ALPHA_V0_REGNUM, l);
Index: gdb-7.5.0.20120926/gdb/amd64-tdep.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/amd64-tdep.c 2012-11-07 22:00:42.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/amd64-tdep.c 2012-11-07 22:03:57.623623489 +0100
@@ -446,12 +446,10 @@ amd64_non_pod_p (struct type *type)
static void
amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
{
- int len = TYPE_LENGTH (type);
-
/* 1. If the size of an object is larger than two eightbytes, or in
C++, is a non-POD structure or union type, or contains
unaligned fields, it has class memory. */
- if (len > 16 || amd64_non_pod_p (type))
+ if (TYPE_LENGTH (type) > 16 || amd64_non_pod_p (type))
{
class[0] = class[1] = AMD64_MEMORY;
return;
@@ -471,7 +469,7 @@ amd64_classify_aggregate (struct type *t
/* All fields in an array have the same type. */
amd64_classify (subtype, class);
- if (len > 8 && class[1] == AMD64_NO_CLASS)
+ if (TYPE_LENGTH (type) > 8 && class[1] == AMD64_NO_CLASS)
class[1] = class[0];
}
else
@@ -839,10 +837,9 @@ amd64_push_arguments (struct regcache *r
{
struct type *type = value_type (stack_args[i]);
const gdb_byte *valbuf = value_contents (stack_args[i]);
- int len = TYPE_LENGTH (type);
CORE_ADDR arg_addr = sp + element * 8;
- write_memory (arg_addr, valbuf, len);
+ write_memory (arg_addr, valbuf, TYPE_LENGTH (type));
if (arg_addr_regno[i] >= 0)
{
/* We also need to store the address of that argument in
@@ -853,7 +850,7 @@ amd64_push_arguments (struct regcache *r
store_unsigned_integer (buf, 8, byte_order, arg_addr);
regcache_cooked_write (regcache, arg_addr_regno[i], buf);
}
- element += ((len + 7) / 8);
+ element += ((TYPE_LENGTH (type) + 7) / 8);
}
/* The psABI says that "For calls that may call functions that use
Index: gdb-7.5.0.20120926/gdb/ax-gdb.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/ax-gdb.c 2012-07-05 03:03:01.000000000 +0200
+++ gdb-7.5.0.20120926/gdb/ax-gdb.c 2012-11-07 22:03:57.626623484 +0100
@@ -367,9 +367,9 @@ gen_trace_static_fields (struct gdbarch
{
case axs_lvalue_memory:
{
- int length = TYPE_LENGTH (check_typedef (value.type));
-
- ax_const_l (ax, length);
+ /* Initialize the TYPE_LENGTH if it is a typedef. */
+ check_typedef (value.type);
+ ax_const_l (ax, TYPE_LENGTH (value.type));
ax_simple (ax, aop_trace);
}
break;
@@ -425,17 +425,18 @@ gen_traced_pop (struct gdbarch *gdbarch,
case axs_lvalue_memory:
{
- int length = TYPE_LENGTH (check_typedef (value->type));
-
if (string_trace)
ax_simple (ax, aop_dup);
+ /* Initialize the TYPE_LENGTH if it is a typedef. */
+ check_typedef (value->type);
+
/* There's no point in trying to use a trace_quick bytecode
here, since "trace_quick SIZE pop" is three bytes, whereas
"const8 SIZE trace" is also three bytes, does the same
thing, and the simplest code which generates that will also
work correctly for objects with large sizes. */
- ax_const_l (ax, length);
+ ax_const_l (ax, TYPE_LENGTH (value->type));
ax_simple (ax, aop_trace);
if (string_trace)
Index: gdb-7.5.0.20120926/gdb/bfin-tdep.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/bfin-tdep.c 2012-05-16 16:35:03.000000000 +0200
+++ gdb-7.5.0.20120926/gdb/bfin-tdep.c 2012-11-07 22:03:57.643623460 +0100
@@ -513,9 +513,8 @@ bfin_push_dummy_call (struct gdbarch *gd
for (i = nargs - 1; i >= 0; i--)
{
struct type *value_type = value_enclosing_type (args[i]);
- int len = TYPE_LENGTH (value_type);
- total_len += (len + 3) & ~3;
+ total_len += (TYPE_LENGTH (value_type) + 3) & ~3;
}
/* At least twelve bytes of stack space must be allocated for the function's
@@ -531,8 +530,7 @@ bfin_push_dummy_call (struct gdbarch *gd
{
struct type *value_type = value_enclosing_type (args[i]);
struct type *arg_type = check_typedef (value_type);
- int len = TYPE_LENGTH (value_type);
- int container_len = (len + 3) & ~3;
+ int container_len = (TYPE_LENGTH (value_type) + 3) & ~3;
sp -= container_len;
write_memory (sp, value_contents_writeable (args[i]), container_len);
Index: gdb-7.5.0.20120926/gdb/breakpoint.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/breakpoint.c 2012-11-07 22:00:43.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/breakpoint.c 2012-11-07 22:03:57.660623434 +0100
@@ -1844,11 +1844,10 @@ update_watchpoint (struct watchpoint *b,
&& TYPE_CODE (vtype) != TYPE_CODE_ARRAY))
{
CORE_ADDR addr;
- int len, type;
+ int type;
struct bp_location *loc, **tmp;
addr = value_address (v);
- len = TYPE_LENGTH (value_type (v));
type = hw_write;
if (b->base.type == bp_read_watchpoint)
type = hw_read;
@@ -1863,7 +1862,7 @@ update_watchpoint (struct watchpoint *b,
loc->pspace = frame_pspace;
loc->address = addr;
- loc->length = len;
+ loc->length = TYPE_LENGTH (value_type (v));
loc->watchpoint_type = type;
}
}
Index: gdb-7.5.0.20120926/gdb/findcmd.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/findcmd.c 2012-07-06 17:51:39.000000000 +0200
+++ gdb-7.5.0.20120926/gdb/findcmd.c 2012-11-07 22:03:57.676623411 +0100
@@ -169,19 +169,19 @@ parse_find_args (char *args, ULONGEST *m
while (*s != '\0')
{
LONGEST x;
- int val_bytes;
+ struct type *t;
ULONGEST pattern_buf_size_need;
while (isspace (*s))
++s;
v = parse_to_comma_and_eval (&s);
- val_bytes = TYPE_LENGTH (value_type (v));
+ t = value_type (v);
/* Keep it simple and assume size == 'g' when watching for when we
need to grow the pattern buf. */
pattern_buf_size_need = (pattern_buf_end - pattern_buf
- + max (val_bytes, sizeof (int64_t)));
+ + max (TYPE_LENGTH (t), sizeof (int64_t)));
if (pattern_buf_size_need > pattern_buf_size)
{
size_t current_offset = pattern_buf_end - pattern_buf;
@@ -215,8 +215,8 @@ parse_find_args (char *args, ULONGEST *m
}
else
{
- memcpy (pattern_buf_end, value_contents (v), val_bytes);
- pattern_buf_end += val_bytes;
+ memcpy (pattern_buf_end, value_contents (v), TYPE_LENGTH (t));
+ pattern_buf_end += TYPE_LENGTH (t);
}
if (*s == ',')
Index: gdb-7.5.0.20120926/gdb/h8300-tdep.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/h8300-tdep.c 2012-11-07 22:00:44.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/h8300-tdep.c 2012-11-07 22:03:57.679623409 +0100
@@ -785,16 +785,15 @@ h8300h_extract_return_value (struct type
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- int len = TYPE_LENGTH (type);
ULONGEST c;
- switch (len)
+ switch (TYPE_LENGTH (type))
{
case 1:
case 2:
case 4:
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
- store_unsigned_integer (valbuf, len, byte_order, c);
+ store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, c);
break;
case 8: /* long long is now 8 bytes. */
if (TYPE_CODE (type) == TYPE_CODE_INT)
@@ -852,18 +851,17 @@ h8300_store_return_value (struct type *t
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- int len = TYPE_LENGTH (type);
ULONGEST val;
- switch (len)
+ switch (TYPE_LENGTH (type))
{
case 1:
case 2: /* short... */
- val = extract_unsigned_integer (valbuf, len, byte_order);
+ val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val);
break;
case 4: /* long, float */
- val = extract_unsigned_integer (valbuf, len, byte_order);
+ val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM,
(val >> 16) & 0xffff);
regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM, val & 0xffff);
@@ -882,19 +880,18 @@ h8300h_store_return_value (struct type *
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- int len = TYPE_LENGTH (type);
ULONGEST val;
- switch (len)
+ switch (TYPE_LENGTH (type))
{
case 1:
case 2:
case 4: /* long, float */
- val = extract_unsigned_integer (valbuf, len, byte_order);
+ val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val);
break;
case 8:
- val = extract_unsigned_integer (valbuf, len, byte_order);
+ val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM,
(val >> 32) & 0xffffffff);
regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM,
Index: gdb-7.5.0.20120926/gdb/i386-darwin-tdep.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/i386-darwin-tdep.c 2012-04-02 15:15:48.000000000 +0200
+++ gdb-7.5.0.20120926/gdb/i386-darwin-tdep.c 2012-11-07 22:03:57.680623407 +0100
@@ -196,13 +196,12 @@ i386_darwin_push_dummy_call (struct gdba
}
else
{
- int len = TYPE_LENGTH (arg_type);
- int align = i386_darwin_arg_type_alignment (arg_type);
-
- args_space = align_up (args_space, align);
+ args_space = align_up (args_space,
+ i386_darwin_arg_type_alignment (arg_type));
if (write_pass)
write_memory (sp + args_space,
- value_contents_all (args[i]), len);
+ value_contents_all (args[i]),
+ TYPE_LENGTH (arg_type));
/* The System V ABI says that:
@@ -211,7 +210,7 @@ i386_darwin_push_dummy_call (struct gdba
depending on the size of the argument."
This makes sure the stack stays word-aligned. */
- args_space += align_up (len, 4);
+ args_space += align_up (TYPE_LENGTH (arg_type), 4);
}
}
Index: gdb-7.5.0.20120926/gdb/infcall.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/infcall.c 2012-07-31 09:34:39.000000000 +0200
+++ gdb-7.5.0.20120926/gdb/infcall.c 2012-11-07 22:03:57.694623385 +0100
@@ -709,13 +709,11 @@ call_function_by_hand (struct value *fun
if (struct_return || hidden_first_param_p)
{
- int len = TYPE_LENGTH (values_type);
-
if (gdbarch_inner_than (gdbarch, 1, 2))
{
/* Stack grows downward. Align STRUCT_ADDR and SP after
making space for the return value. */
- sp -= len;
+ sp -= TYPE_LENGTH (values_type);
if (gdbarch_frame_align_p (gdbarch))
sp = gdbarch_frame_align (gdbarch, sp);
struct_addr = sp;
@@ -727,7 +725,7 @@ call_function_by_hand (struct value *fun
if (gdbarch_frame_align_p (gdbarch))
sp = gdbarch_frame_align (gdbarch, sp);
struct_addr = sp;
- sp += len;
+ sp += TYPE_LENGTH (values_type);
if (gdbarch_frame_align_p (gdbarch))
sp = gdbarch_frame_align (gdbarch, sp);
}
Index: gdb-7.5.0.20120926/gdb/lm32-tdep.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/lm32-tdep.c 2012-05-18 23:02:48.000000000 +0200
+++ gdb-7.5.0.20120926/gdb/lm32-tdep.c 2012-11-07 22:03:57.695623384 +0100
@@ -261,7 +261,6 @@ lm32_push_dummy_call (struct gdbarch *gd
struct value *arg = args[i];
struct type *arg_type = check_typedef (value_type (arg));
gdb_byte *contents;
- int len;
ULONGEST val;
/* Promote small integer types to int. */
@@ -283,8 +282,8 @@ lm32_push_dummy_call (struct gdbarch *gd
/* FIXME: Handle structures. */
contents = (gdb_byte *) value_contents (arg);
- len = TYPE_LENGTH (arg_type);
- val = extract_unsigned_integer (contents, len, byte_order);
+ val = extract_unsigned_integer (contents, TYPE_LENGTH (arg_type),
+ byte_order);
/* First num_arg_regs parameters are passed by registers,
and the rest are passed on the stack. */
@@ -292,7 +291,7 @@ lm32_push_dummy_call (struct gdbarch *gd
regcache_cooked_write_unsigned (regcache, first_arg_reg + i, val);
else
{
- write_memory (sp, (void *) &val, len);
+ write_memory (sp, (void *) &val, TYPE_LENGTH (arg_type));
sp -= 4;
}
}
Index: gdb-7.5.0.20120926/gdb/m68hc11-tdep.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/m68hc11-tdep.c 2012-05-16 16:35:06.000000000 +0200
+++ gdb-7.5.0.20120926/gdb/m68hc11-tdep.c 2012-11-07 22:03:57.724623347 +0100
@@ -1174,7 +1174,6 @@ m68hc11_push_dummy_call (struct gdbarch
int first_stack_argnum;
struct type *type;
char *val;
- int len;
char buf[2];
first_stack_argnum = 0;
@@ -1185,19 +1184,18 @@ m68hc11_push_dummy_call (struct gdbarch
else if (nargs > 0)
{
type = value_type (args[0]);
- len = TYPE_LENGTH (type);
/* First argument is passed in D and X registers. */
- if (len <= 4)
+ if (TYPE_LENGTH (type) <= 4)
{
ULONGEST v;
v = extract_unsigned_integer (value_contents (args[0]),
- len, byte_order);
+ TYPE_LENGTH (type), byte_order);
first_stack_argnum = 1;
regcache_cooked_write_unsigned (regcache, HARD_D_REGNUM, v);
- if (len > 2)
+ if (TYPE_LENGTH (type) > 2)
{
v >>= 16;
regcache_cooked_write_unsigned (regcache, HARD_X_REGNUM, v);
@@ -1208,9 +1206,8 @@ m68hc11_push_dummy_call (struct gdbarch
for (argnum = nargs - 1; argnum >= first_stack_argnum; argnum--)
{
type = value_type (args[argnum]);
- len = TYPE_LENGTH (type);
- if (len & 1)
+ if (TYPE_LENGTH (type) & 1)
{
static char zero = 0;
@@ -1218,8 +1215,8 @@ m68hc11_push_dummy_call (struct gdbarch
write_memory (sp, &zero, 1);
}
val = (char*) value_contents (args[argnum]);
- sp -= len;
- write_memory (sp, val, len);
+ sp -= TYPE_LENGTH (type);
+ write_memory (sp, val, TYPE_LENGTH (type));
}
/* Store return address. */
@@ -1291,11 +1288,10 @@ static void
m68hc11_extract_return_value (struct type *type, struct regcache *regcache,
void *valbuf)
{
- int len = TYPE_LENGTH (type);
char buf[M68HC11_REG_SIZE];
regcache_raw_read (regcache, HARD_D_REGNUM, buf);
- switch (len)
+ switch (TYPE_LENGTH (type))
{
case 1:
memcpy (valbuf, buf + 1, 1);
Index: gdb-7.5.0.20120926/gdb/mep-tdep.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/mep-tdep.c 2012-05-16 16:35:06.000000000 +0200
+++ gdb-7.5.0.20120926/gdb/mep-tdep.c 2012-11-07 22:03:57.727623334 +0100
@@ -2337,11 +2337,10 @@ mep_push_dummy_call (struct gdbarch *gdb
for (i = 0; i < argc; i++)
{
- unsigned arg_size = TYPE_LENGTH (value_type (argv[i]));
ULONGEST value;
/* Arguments that fit in a GPR get expanded to fill the GPR. */
- if (arg_size <= MEP_GPR_SIZE)
+ if (TYPE_LENGTH (value_type (argv[i])) <= MEP_GPR_SIZE)
value = extract_unsigned_integer (value_contents (argv[i]),
TYPE_LENGTH (value_type (argv[i])),
byte_order);
Index: gdb-7.5.0.20120926/gdb/printcmd.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/printcmd.c 2012-11-07 22:00:44.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/printcmd.c 2012-11-07 22:03:57.730623334 +0100
@@ -347,13 +347,12 @@ float_type_from_length (struct type *typ
{
struct gdbarch *gdbarch = get_type_arch (type);
const struct builtin_type *builtin = builtin_type (gdbarch);
- unsigned int len = TYPE_LENGTH (type);
- if (len == TYPE_LENGTH (builtin->builtin_float))
+ if (TYPE_LENGTH (type) == TYPE_LENGTH (builtin->builtin_float))
type = builtin->builtin_float;
- else if (len == TYPE_LENGTH (builtin->builtin_double))
+ else if (TYPE_LENGTH (type) == TYPE_LENGTH (builtin->builtin_double))
type = builtin->builtin_double;
- else if (len == TYPE_LENGTH (builtin->builtin_long_double))
+ else if (TYPE_LENGTH (type) == TYPE_LENGTH (builtin->builtin_long_double))
type = builtin->builtin_long_double;
return type;
Index: gdb-7.5.0.20120926/gdb/s390-tdep.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/s390-tdep.c 2012-11-07 22:02:30.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/s390-tdep.c 2012-11-07 22:03:57.733623329 +0100
@@ -376,9 +376,11 @@ s390_value_from_register (struct type *t
struct frame_info *frame)
{
struct value *value = default_value_from_register (type, regnum, frame);
- int len = TYPE_LENGTH (check_typedef (type));
- if (regnum >= S390_F0_REGNUM && regnum <= S390_F15_REGNUM && len < 8)
+ check_typedef (type);
+
+ if (regnum >= S390_F0_REGNUM && regnum <= S390_F15_REGNUM
+ && TYPE_LENGTH (type) < 8)
set_value_offset (value, 0);
return value;
Index: gdb-7.5.0.20120926/gdb/stack.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/stack.c 2012-11-07 22:00:43.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/stack.c 2012-11-07 22:03:57.737623322 +0100
@@ -354,14 +354,15 @@ read_frame_arg (struct symbol *sym, stru
if (val && entryval && !ui_out_is_mi_like_p (current_uiout))
{
- unsigned len = TYPE_LENGTH (value_type (val));
+ struct type *type = value_type (val);
if (!value_optimized_out (val) && value_lazy (val))
value_fetch_lazy (val);
if (!value_optimized_out (val) && value_lazy (entryval))
value_fetch_lazy (entryval);
if (!value_optimized_out (val)
- && value_available_contents_eq (val, 0, entryval, 0, len))
+ && value_available_contents_eq (val, 0, entryval, 0,
+ TYPE_LENGTH (type)))
{
/* Initialize it just to avoid a GCC false warning. */
struct value *val_deref = NULL, *entryval_deref;
@@ -373,12 +374,12 @@ read_frame_arg (struct symbol *sym, stru
TRY_CATCH (except, RETURN_MASK_ERROR)
{
- unsigned len_deref;
+ struct type *type_deref;
val_deref = coerce_ref (val);
if (value_lazy (val_deref))
value_fetch_lazy (val_deref);
- len_deref = TYPE_LENGTH (value_type (val_deref));
+ type_deref = value_type (val_deref);
entryval_deref = coerce_ref (entryval);
if (value_lazy (entryval_deref))
@@ -389,7 +390,7 @@ read_frame_arg (struct symbol *sym, stru
if (val != val_deref
&& value_available_contents_eq (val_deref, 0,
entryval_deref, 0,
- len_deref))
+ TYPE_LENGTH (type_deref)))
val_equal = 1;
}
Index: gdb-7.5.0.20120926/gdb/tracepoint.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/tracepoint.c 2012-06-30 00:46:46.000000000 +0200
+++ gdb-7.5.0.20120926/gdb/tracepoint.c 2012-11-07 22:03:57.741623318 +0100
@@ -1450,7 +1450,7 @@ encode_actions_1 (struct command_line *a
}
else
{
- unsigned long addr, len;
+ unsigned long addr;
struct cleanup *old_chain = NULL;
struct cleanup *old_chain1 = NULL;
@@ -1480,8 +1480,10 @@ encode_actions_1 (struct command_line *a
/* Safe because we know it's a simple expression. */
tempval = evaluate_expression (exp);
addr = value_address (tempval);
- len = TYPE_LENGTH (check_typedef (exp->elts[1].type));
- add_memrange (collect, memrange_absolute, addr, len);
+ /* Initialize the TYPE_LENGTH if it is a typedef. */
+ check_typedef (exp->elts[1].type);
+ add_memrange (collect, memrange_absolute, addr,
+ TYPE_LENGTH (exp->elts[1].type));
break;
case OP_VAR_VALUE:
Index: gdb-7.5.0.20120926/gdb/valops.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/valops.c 2012-11-07 22:00:44.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/valops.c 2012-11-07 22:06:35.899393539 +0100
@@ -1055,7 +1055,6 @@ value_fetch_lazy (struct value *val)
struct value *parent = value_parent (val);
LONGEST offset = value_offset (val);
LONGEST num;
- int length = TYPE_LENGTH (type);
if (!value_bits_valid (val,
TARGET_CHAR_BIT * offset + value_bitpos (val),
@@ -1069,9 +1068,9 @@ value_fetch_lazy (struct value *val)
value_bitsize (val), parent, &num))
mark_value_bytes_unavailable (val,
value_embedded_offset (val),
- length);
+ TYPE_LENGTH (type));
else
- store_signed_integer (value_contents_raw (val), length,
+ store_signed_integer (value_contents_raw (val), TYPE_LENGTH (type),
byte_order, num);
}
else if (VALUE_LVAL (val) == lval_memory)
@@ -1080,16 +1079,16 @@ value_fetch_lazy (struct value *val)
if (object_address_get_data (value_type (val), &addr))
{
- struct type *type = value_enclosing_type (val);
- int length = TYPE_LENGTH (check_typedef (type));
+ struct type *type = check_typedef (value_enclosing_type (val));
- if (length)
+ if (TYPE_LENGTH (type))
{
/* Delay it after object_address_get_data above. */
allocate_value_contents (val);
addr += value_offset (val);
read_value_memory (val, 0, value_stack (val),
- addr, value_contents_all_raw (val), length);
+ addr, value_contents_all_raw (val),
+ TYPE_LENGTH (type));
}
}
/* Just to be sure it has been called. */
Index: gdb-7.5.0.20120926/gdb/value.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/value.c 2012-11-07 22:00:43.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/value.c 2012-11-07 22:03:57.751623303 +0100
@@ -1034,15 +1034,14 @@ value_contents_equal (struct value *val1
{
struct type *type1;
struct type *type2;
- int len;
type1 = check_typedef (value_type (val1));
type2 = check_typedef (value_type (val2));
- len = TYPE_LENGTH (type1);
- if (len != TYPE_LENGTH (type2))
+ if (TYPE_LENGTH (type1) != TYPE_LENGTH (type2))
return 0;
- return (memcmp (value_contents (val1), value_contents (val2), len) == 0);
+ return (memcmp (value_contents (val1), value_contents (val2),
+ TYPE_LENGTH (type1)) == 0);
}
int

View File

@ -0,0 +1,45 @@
http://sourceware.org/ml/gdb-cvs/2012-09/msg00145.html
### src/gdb/ChangeLog 2012/09/25 12:48:52 1.14697
### src/gdb/ChangeLog 2012/09/26 02:06:51 1.14698
## -1,3 +1,8 @@
+2012-09-26 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * breakpoint.c (invalidate_bp_value_on_memory_change): Expand
+ parameter LEN to ssize_t.
+
2012-09-25 Siddhesh Poyarekar <siddhesh@redhat.com>
* ada-valprint.c (ada_val_print_1): Eliminate single-use
--- src/gdb/breakpoint.c 2012/09/25 12:48:52 1.705
+++ src/gdb/breakpoint.c 2012/09/26 02:06:54 1.706
@@ -14718,7 +14718,7 @@
GDB itself. */
static void
-invalidate_bp_value_on_memory_change (CORE_ADDR addr, int len,
+invalidate_bp_value_on_memory_change (CORE_ADDR addr, ssize_t len,
const bfd_byte *data)
{
struct breakpoint *bp;
### src/gdb/doc/ChangeLog 2012/09/21 01:46:42 1.1370
### src/gdb/doc/ChangeLog 2012/09/26 02:06:55 1.1371
## -1,3 +1,7 @@
+2012-09-26 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * observer.texi (memory_changed): Expand parameter LEN to ssize_t.
+
2012-09-21 Yao Qi <yao@codesourcery.com>
Pedro Alves <palves@redhat.com>
--- src/gdb/doc/observer.texi 2012/09/21 01:46:43 1.40
+++ src/gdb/doc/observer.texi 2012/09/26 02:06:55 1.41
@@ -230,7 +230,7 @@
This method is called immediately before freeing @var{inf}.
@end deftypefun
-@deftypefun void memory_changed (CORE_ADDR @var{addr}, int @var{len}, const bfd_byte *@var{data})
+@deftypefun void memory_changed (CORE_ADDR @var{addr}, ssize_t @var{len}, const bfd_byte *@var{data})
Bytes from @var{data} to @var{data} + @var{len} have been written
to the current inferior at @var{addr}.
@end deftypefun

View File

@ -0,0 +1,260 @@
http://sourceware.org/ml/gdb-cvs/2012-09/msg00147.html
### src/gdb/ChangeLog 2012/09/26 02:06:51 1.14698
### src/gdb/ChangeLog 2012/09/26 07:52:44 1.14699
## -1,5 +1,19 @@
2012-09-26 Siddhesh Poyarekar <siddhesh@redhat.com>
+ * amd64-tdep.c (amd64_return_value): Use TYPE_LENGTH directly.
+ * bfin-tdep.c (bfin_extract_return_value): Likewise.
+ (bfin_store_return_value): Likewise.
+ * cris-tdep.c (cris_store_return_value): Likewise.
+ (cris_extract_return_value): Likewise.
+ * h8300-tdep.c (h8300_extract_return_value): Likewise.
+ * hppa-tdep.c (hppa64_return_value): Likewise.
+ * lm32-tdep.c (lm32_store_return_value): Likewise.
+ * microblaze-tdep.c (microblaze_store_return_value): Likewise.
+ * spu-tdep.c (spu_value_from_register): Likewise.
+ * vax-tdep.c (vax_return_value): Likewise.
+
+2012-09-26 Siddhesh Poyarekar <siddhesh@redhat.com>
+
* breakpoint.c (invalidate_bp_value_on_memory_change): Expand
parameter LEN to ssize_t.
--- src/gdb/amd64-tdep.c 2012/09/25 12:48:52 1.110
+++ src/gdb/amd64-tdep.c 2012/09/26 07:52:47 1.111
@@ -637,7 +637,7 @@
}
gdb_assert (class[1] != AMD64_MEMORY);
- gdb_assert (len <= 16);
+ gdb_assert (TYPE_LENGTH (type) <= 16);
for (i = 0; len > 0; i++, len -= 8)
{
--- src/gdb/bfin-tdep.c 2012/09/25 12:48:52 1.11
+++ src/gdb/bfin-tdep.c 2012/09/26 07:52:47 1.12
@@ -615,7 +615,7 @@
ULONGEST tmp;
int regno = BFIN_R0_REGNUM;
- gdb_assert (len <= 8);
+ gdb_assert (TYPE_LENGTH (type) <= 8);
while (len > 0)
{
@@ -643,7 +643,7 @@
int len = TYPE_LENGTH (type);
int regno = BFIN_R0_REGNUM;
- gdb_assert (len <= 8);
+ gdb_assert (TYPE_LENGTH (type) <= 8);
while (len > 0)
{
--- src/gdb/cris-tdep.c 2012/05/18 21:02:47 1.185
+++ src/gdb/cris-tdep.c 2012/09/26 07:52:47 1.186
@@ -1662,20 +1662,20 @@
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val;
- int len = TYPE_LENGTH (type);
- if (len <= 4)
+ if (TYPE_LENGTH (type) <= 4)
{
/* Put the return value in R10. */
- val = extract_unsigned_integer (valbuf, len, byte_order);
+ val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
regcache_cooked_write_unsigned (regcache, ARG1_REGNUM, val);
}
- else if (len <= 8)
+ else if (TYPE_LENGTH (type) <= 8)
{
/* Put the return value in R10 and R11. */
val = extract_unsigned_integer (valbuf, 4, byte_order);
regcache_cooked_write_unsigned (regcache, ARG1_REGNUM, val);
- val = extract_unsigned_integer ((char *)valbuf + 4, len - 4, byte_order);
+ val = extract_unsigned_integer ((char *)valbuf + 4,
+ TYPE_LENGTH (type) - 4, byte_order);
regcache_cooked_write_unsigned (regcache, ARG2_REGNUM, val);
}
else
@@ -1833,21 +1833,21 @@
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val;
- int len = TYPE_LENGTH (type);
- if (len <= 4)
+ if (TYPE_LENGTH (type) <= 4)
{
/* Get the return value from R10. */
regcache_cooked_read_unsigned (regcache, ARG1_REGNUM, &val);
- store_unsigned_integer (valbuf, len, byte_order, val);
+ store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, val);
}
- else if (len <= 8)
+ else if (TYPE_LENGTH (type) <= 8)
{
/* Get the return value from R10 and R11. */
regcache_cooked_read_unsigned (regcache, ARG1_REGNUM, &val);
store_unsigned_integer (valbuf, 4, byte_order, val);
regcache_cooked_read_unsigned (regcache, ARG2_REGNUM, &val);
- store_unsigned_integer ((char *)valbuf + 4, len - 4, byte_order, val);
+ store_unsigned_integer ((char *)valbuf + 4, TYPE_LENGTH (type) - 4,
+ byte_order, val);
}
else
error (_("cris_extract_return_value: type length too large"));
--- src/gdb/h8300-tdep.c 2012/09/25 12:48:53 1.136
+++ src/gdb/h8300-tdep.c 2012/09/26 07:52:48 1.137
@@ -751,12 +751,12 @@
int len = TYPE_LENGTH (type);
ULONGEST c, addr;
- switch (len)
+ switch (TYPE_LENGTH (type))
{
case 1:
case 2:
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
- store_unsigned_integer (valbuf, len, byte_order, c);
+ store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, c);
break;
case 4: /* Needs two registers on plain H8/300 */
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
@@ -768,8 +768,9 @@
if (TYPE_CODE (type) == TYPE_CODE_INT)
{
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &addr);
- c = read_memory_unsigned_integer ((CORE_ADDR) addr, len, byte_order);
- store_unsigned_integer (valbuf, len, byte_order, c);
+ c = read_memory_unsigned_integer ((CORE_ADDR) addr,
+ TYPE_LENGTH (type), byte_order);
+ store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, c);
}
else
{
--- src/gdb/hppa-tdep.c 2012/05/18 21:02:48 1.281
+++ src/gdb/hppa-tdep.c 2012/09/26 07:52:48 1.282
@@ -1160,7 +1160,7 @@
int len = TYPE_LENGTH (type);
int regnum, offset;
- if (len > 16)
+ if (TYPE_LENGTH (type) > 16)
{
/* All return values larget than 128 bits must be aggregate
return values. */
--- src/gdb/lm32-tdep.c 2012/09/25 12:48:53 1.13
+++ src/gdb/lm32-tdep.c 2012/09/26 07:52:48 1.14
@@ -349,18 +349,18 @@
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val;
- int len = TYPE_LENGTH (type);
- if (len <= 4)
+ if (TYPE_LENGTH (type) <= 4)
{
- val = extract_unsigned_integer (valbuf, len, byte_order);
+ val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
regcache_cooked_write_unsigned (regcache, SIM_LM32_R1_REGNUM, val);
}
- else if (len <= 8)
+ else if (TYPE_LENGTH (type) <= 8)
{
val = extract_unsigned_integer (valbuf, 4, byte_order);
regcache_cooked_write_unsigned (regcache, SIM_LM32_R1_REGNUM, val);
- val = extract_unsigned_integer (valbuf + 4, len - 4, byte_order);
+ val = extract_unsigned_integer (valbuf + 4, TYPE_LENGTH (type) - 4,
+ byte_order);
regcache_cooked_write_unsigned (regcache, SIM_LM32_R2_REGNUM, val);
}
else
--- src/gdb/microblaze-tdep.c 2012/08/02 09:36:39 1.13
+++ src/gdb/microblaze-tdep.c 2012/09/26 07:52:48 1.14
@@ -590,22 +590,21 @@
microblaze_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf)
{
- int len = TYPE_LENGTH (type);
gdb_byte buf[8];
memset (buf, 0, sizeof(buf));
/* Integral and pointer return values. */
- if (len > 4)
+ if (TYPE_LENGTH (type) > 4)
{
- gdb_assert (len == 8);
+ gdb_assert (TYPE_LENGTH (type) == 8);
memcpy (buf, valbuf, 8);
regcache_cooked_write (regcache, MICROBLAZE_RETVAL_REGNUM+1, buf + 4);
}
else
/* ??? Do we need to do any sign-extension here? */
- memcpy (buf + 4 - len, valbuf, len);
+ memcpy (buf + 4 - TYPE_LENGTH (type), valbuf, TYPE_LENGTH (type));
regcache_cooked_write (regcache, MICROBLAZE_RETVAL_REGNUM, buf);
}
--- src/gdb/spu-tdep.c 2012/09/17 08:52:18 1.82
+++ src/gdb/spu-tdep.c 2012/09/26 07:52:48 1.83
@@ -316,11 +316,10 @@
struct frame_info *frame)
{
struct value *value = default_value_from_register (type, regnum, frame);
- int len = TYPE_LENGTH (type);
- if (regnum < SPU_NUM_GPRS && len < 16)
+ if (regnum < SPU_NUM_GPRS && TYPE_LENGTH (type) < 16)
{
- int preferred_slot = len < 4 ? 4 - len : 0;
+ int preferred_slot = TYPE_LENGTH (type) < 4 ? 4 - TYPE_LENGTH (type) : 0;
set_value_offset (value, preferred_slot);
}
--- src/gdb/vax-tdep.c 2012/05/16 14:35:08 1.112
+++ src/gdb/vax-tdep.c 2012/09/26 07:52:48 1.113
@@ -208,7 +208,6 @@
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- int len = TYPE_LENGTH (type);
gdb_byte buf[8];
if (TYPE_CODE (type) == TYPE_CODE_STRUCT
@@ -224,7 +223,7 @@
ULONGEST addr;
regcache_raw_read_unsigned (regcache, VAX_R0_REGNUM, &addr);
- read_memory (addr, readbuf, len);
+ read_memory (addr, readbuf, TYPE_LENGTH (type));
}
return RETURN_VALUE_ABI_RETURNS_ADDRESS;
@@ -234,16 +233,16 @@
{
/* Read the contents of R0 and (if necessary) R1. */
regcache_cooked_read (regcache, VAX_R0_REGNUM, buf);
- if (len > 4)
+ if (TYPE_LENGTH (type) > 4)
regcache_cooked_read (regcache, VAX_R1_REGNUM, buf + 4);
- memcpy (readbuf, buf, len);
+ memcpy (readbuf, buf, TYPE_LENGTH (type));
}
if (writebuf)
{
/* Read the contents to R0 and (if necessary) R1. */
- memcpy (buf, writebuf, len);
+ memcpy (buf, writebuf, TYPE_LENGTH (type));
regcache_cooked_write (regcache, VAX_R0_REGNUM, buf);
- if (len > 4)
+ if (TYPE_LENGTH (type) > 4)
regcache_cooked_write (regcache, VAX_R1_REGNUM, buf + 4);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,224 @@
http://sourceware.org/ml/gdb-patches/2012-09/msg00632.html
Subject: [PATCH 2/4] Add a check to ensure that a type may fit into host memory
--MP_/PnL6l3LUsXWpZ/olqawWlzb
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi,
This is part two of the bitpos expansion patch. This implements checks
in some places in the code to ensure that a type size in ULONGEST is
small enough to fit into host memory. Tested for regressions on x86_64
Fedora 16.
Regards,
Siddhesh
--MP_/PnL6l3LUsXWpZ/olqawWlzb
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename=ChangeLog-ensure_sizet
gdb/ChangeLog
* alpha-tdep.c (alpha_push_dummy_call) Check for underflow in
SP.
* cp-valprint (cp_print_value): Ensure BASECLASS fits into
size_t.
* dwarf2loc.c (read_pieced_value): Ensure that THIS_SIZE fits
into size_t.
(write_pieced_value): Likewise.
* findcmd.c (parse_find_args): Ensure PATTERN_BUF_SIZE fits into
size_t.
* p-valprint (pascal_object_print_value): Ensure BASECLASS fits
into size_t.
* utils.c (ulongest_fits_host_or_error): New function to find if
a ULONGEST number fits into size_t.
* utils.h: Declare ulongest_fits_host_or_error.
* valops.c (search_struct_method): Ensure BASECLASS fits into
size_t.
* value.c (allocate_value_lazy): Ensure TYPE fits into size_t.
(allocate_value_contents): Likewise.
(set_value_enclosing_type): Ensure NEW_ENCL_TYPE fits into
size_t.
* vax-tdep.c (vax_return_value): Ensure that TYPE fits into
size_t.
--MP_/PnL6l3LUsXWpZ/olqawWlzb
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=bitpos-ensure-size_t.patch
Index: gdb-7.5.0.20120926/gdb/alpha-tdep.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/alpha-tdep.c 2012-11-07 22:03:57.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/alpha-tdep.c 2012-11-07 22:46:00.042902382 +0100
@@ -414,6 +414,13 @@ alpha_push_dummy_call (struct gdbarch *g
accumulate_size = 0;
else
accumulate_size -= sizeof(arg_reg_buffer);
+
+ /* Check for underflow. */
+ if (sp - accumulate_size > sp)
+ error (_("Insufficient memory in GDB host for arguments, "
+ "need %s bytes, but less than %s bytes available."),
+ plongest (accumulate_size), plongest (CORE_ADDR_MAX - sp));
+
sp -= accumulate_size;
/* Keep sp aligned to a multiple of 16 as the ABI requires. */
Index: gdb-7.5.0.20120926/gdb/cp-valprint.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/cp-valprint.c 2012-11-07 22:12:14.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/cp-valprint.c 2012-11-07 22:46:00.043902381 +0100
@@ -561,6 +561,8 @@ cp_print_value (struct type *type, struc
gdb_byte *buf;
struct cleanup *back_to;
+ ulongest_fits_host_or_error (TYPE_LENGTH (baseclass));
+
buf = xmalloc (TYPE_LENGTH (baseclass));
back_to = make_cleanup (xfree, buf);
Index: gdb-7.5.0.20120926/gdb/dwarf2loc.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/dwarf2loc.c 2012-11-07 22:09:29.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/dwarf2loc.c 2012-11-07 22:46:00.070902342 +0100
@@ -1784,6 +1784,8 @@ read_pieced_value (struct value *v)
this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
source_offset = source_offset_bits / 8;
+ ulongest_fits_host_or_error (this_size);
+
if (buffer_size < this_size)
{
buffer_size = this_size;
@@ -1975,6 +1977,7 @@ write_pieced_value (struct value *to, st
}
else
{
+ ulongest_fits_host_or_error (this_size);
if (buffer_size < this_size)
{
buffer_size = this_size;
Index: gdb-7.5.0.20120926/gdb/findcmd.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/findcmd.c 2012-11-07 22:03:57.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/findcmd.c 2012-11-07 22:46:00.153902249 +0100
@@ -187,6 +187,7 @@ parse_find_args (char *args, ULONGEST *m
size_t current_offset = pattern_buf_end - pattern_buf;
pattern_buf_size = pattern_buf_size_need * 2;
+ ulongest_fits_host_or_error (pattern_buf_size);
pattern_buf = xrealloc (pattern_buf, pattern_buf_size);
pattern_buf_end = pattern_buf + current_offset;
}
Index: gdb-7.5.0.20120926/gdb/p-valprint.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/p-valprint.c 2012-11-07 22:09:29.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/p-valprint.c 2012-11-07 22:46:00.163902208 +0100
@@ -827,6 +827,7 @@ pascal_object_print_value (struct type *
gdb_byte *buf;
struct cleanup *back_to;
+ ulongest_fits_host_or_error (TYPE_LENGTH (baseclass));
buf = xmalloc (TYPE_LENGTH (baseclass));
back_to = make_cleanup (xfree, buf);
Index: gdb-7.5.0.20120926/gdb/utils.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/utils.c 2012-11-07 22:00:43.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/utils.c 2012-11-07 22:46:00.166902202 +0100
@@ -3135,6 +3135,18 @@ host_address_to_string (const void *addr
return str;
}
+/* Ensure that the input NUM is not larger than the maximum capacity of the
+ host system. We choose SIZE_MAX / 8 as a conservative estimate of the size
+ of a resource that a system may allocate. */
+void
+ulongest_fits_host_or_error (ULONGEST num)
+{
+ if (num > SIZE_MAX / 8)
+ error (_("Insufficient memory in host GDB for object of size %s bytes, "
+ "maximum allowed %s bytes."), pulongest (num),
+ pulongest (SIZE_MAX / 8));
+}
+
char *
gdb_realpath (const char *filename)
{
Index: gdb-7.5.0.20120926/gdb/valops.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/valops.c 2012-11-07 22:09:30.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/valops.c 2012-11-07 22:46:00.181902181 +0100
@@ -2383,6 +2383,7 @@ search_struct_method (const char *name,
struct cleanup *back_to;
CORE_ADDR address;
+ ulongest_fits_host_or_error (TYPE_LENGTH (baseclass));
tmp = xmalloc (TYPE_LENGTH (baseclass));
back_to = make_cleanup (xfree, tmp);
address = value_address (*arg1p);
Index: gdb-7.5.0.20120926/gdb/value.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/value.c 2012-11-07 22:09:30.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/value.c 2012-11-07 22:46:00.184902176 +0100
@@ -663,6 +663,7 @@ allocate_value_lazy (struct type *type)
description correctly. */
check_typedef (type);
+ ulongest_fits_host_or_error (TYPE_LENGTH (type));
val = (struct value *) xzalloc (sizeof (struct value));
val->contents = NULL;
val->next = all_values;
@@ -694,6 +695,8 @@ allocate_value_lazy (struct type *type)
void
allocate_value_contents (struct value *val)
{
+ ulongest_fits_host_or_error (TYPE_LENGTH (val->enclosing_type));
+
if (!val->contents)
val->contents = (gdb_byte *) xzalloc (TYPE_LENGTH (val->enclosing_type));
}
@@ -2662,8 +2665,12 @@ void
set_value_enclosing_type (struct value *val, struct type *new_encl_type)
{
if (TYPE_LENGTH (new_encl_type) > TYPE_LENGTH (value_enclosing_type (val)))
- val->contents =
- (gdb_byte *) xrealloc (val->contents, TYPE_LENGTH (new_encl_type));
+ {
+ ulongest_fits_host_or_error (TYPE_LENGTH (new_encl_type));
+
+ val->contents =
+ (gdb_byte *) xrealloc (val->contents, TYPE_LENGTH (new_encl_type));
+ }
val->enclosing_type = new_encl_type;
}
Index: gdb-7.5.0.20120926/gdb/vax-tdep.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/vax-tdep.c 2012-11-07 22:09:24.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/vax-tdep.c 2012-11-07 22:46:56.810819878 +0100
@@ -223,6 +223,7 @@ vax_return_value (struct gdbarch *gdbarc
ULONGEST addr;
regcache_raw_read_unsigned (regcache, VAX_R0_REGNUM, &addr);
+ ulongest_fits_host_or_error (TYPE_LENGTH (type));
read_memory (addr, readbuf, TYPE_LENGTH (type));
}
Index: gdb-7.5.0.20120926/gdb/defs.h
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/defs.h 2012-11-07 22:00:43.111906109 +0100
+++ gdb-7.5.0.20120926/gdb/defs.h 2012-11-07 22:47:46.001001239 +0100
@@ -1170,4 +1170,6 @@ enum block_enum
FIRST_LOCAL_BLOCK = 2
};
+extern void ulongest_fits_host_or_error (ULONGEST num);
+
#endif /* #ifndef DEFS_H */

View File

@ -0,0 +1,701 @@
http://sourceware.org/ml/gdb-patches/2012-09/msg00629.html
Subject: [PATCH 3/4] Expand watchpoint lengths to LONGEST
--MP_/6HRlH6vpyqtSy4CYyMrX6b2
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi,
This is part three of the bitpos expansion change. Some architectures
allow arbitrary length watchpoints and combined with the fact that type
lengths could be large enough, we need LONGEST for watchpoint lengths.
It is architecture dependent however, whether the LONGEST is needed or
not. This patch updates the signatures of watchpoint insertion and
removal functions of all architectures (to comply with the function
signatures in the callback struct), but expands types only in
architectures that need it. Tested on Fedora 16 x86_64.
Regards,
Siddhesh
--MP_/6HRlH6vpyqtSy4CYyMrX6b2
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename=ChangeLog-wp
gdb/ChangeLog:
* arm-linux-nat.c (arm_linux_insert_watchpoint): Expand
parameter LEN to LONGEST.
(arm_linux_remove_watchpoint): Likewise.
(arm_linux_watchpoint_addr_within_range): Expand parameter
LENGTH to LONGEST.
* i386-nat.c (i386_insert_watchpoint): Expand parameter LEN to
LONGEST.
(i386_remove_watchpoint): Likewise.
* ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise.
(ia64_linux_remove_watchpoint): Likewise.
* inf-ttrace.c (inf_ttrace_insert_watchpoint): Likewise.
Expand NUM_PAGES, PAGE to LONGEST.
(inf_ttrace_remove_watchpoint): Likewise.
* mips-linux-nat.c (mips_linux_insert_watchpoint): Expand
parameter LEN to LONGEST.
(mips_linux_remove_watchpoint): Likewise.
* nto-procfs.c (procfs_remove_hw_watchpoint): Likewise.
(procfs_insert_hw_watchpoint): Likewise.
* ppc-linux-nat.c (calculate_dvc): Likewise. Expand I,
NUM_BYTE_ENABLE to LONGEST.
(check_condition): Expand parameter LEN to point to LONGEST.
(ppc_linux_can_accel_watchpoint_condition): Expand parameter
LEN to LONGEST.
(create_watchpoint_request): Likewise.
(ppc_linux_insert_watchpoint): Likewise.
(ppc_linux_remove_watchpoint): Likewise.
(ppc_linux_watchpoint_addr_within_range): Expand parameter
LENGTH to LONGEST.
* procfs.c (proc_set_watchpoint): Expand parameter LEN to
LONGEST.
(procfs_set_watchpoint): Likewise.
(procfs_insert_watchpoint): Likewise.
(procfs_remove_watchpoint): Likewise.
* remote-m32r-sdi.c (m32r_insert_watchpoint): Likewise. Use
plongest to format print LEN.
(m32r_remove_watchpoint): Likewise.
* remote-mips.c (mips_insert_watchpoint): Expand parameter LEN
to LONGEST.
(mips_remove_watchpoint): Likewise.
* remote.c (remote_insert_watchpoint): Likewise.
Use phex_nz to format print LEN.
(remote_remove_watchpoint): Likewise.
(remote_watchpoint_addr_within_range): Expand parameter LENGTH
to LONGEST.
* s390-nat.c (s390_insert_watchpoint): Expand parameter LEN to
LONGEST.
(s390_remove_watchpoint): Likewise.
* target.c (update_current_target): Expand parameter LEN for
callbacks to TO_INSERT_WATCHPOINT, TO_REMOVE_WATCHPOINT,
TO_CAN_ACCEL_WATCHPOINT_CONDITION, to LONGEST.
(default_watchpoint_addr_within_range): Expand parameter
LENGTH to LONGEST.
(debug_to_can_accel_watchpoint_condition): Expand parameter LEN
to LONGEST. Use plongest to format print LEN.
(debug_to_watchpoint_addr_within_range): Expand parameter LENGTH
to LONGEST. Use plongest to format print LENGTH.
(debug_to_insert_watchpoint): Expand parameter LEN to LONGEST.
Use plongest to format print LEN.
(debug_to_remove_watchpoint): Likewise.
* target.h (struct target_ops): Expand parameter LEN of
TO_REMOVE_WATCHPOINT, TO_INSERT_WATCHPOINT,
TO_WATCHPOINT_ADDR_WITHIN_RANGE and
TO_CAN_ACCEL_WATCHPOINT_CONDITION to LONGEST.
--MP_/6HRlH6vpyqtSy4CYyMrX6b2
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=bitpos-wp.patch
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 231b008..6deb23d 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -1105,7 +1105,7 @@ arm_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len)
/* Insert a Hardware breakpoint. */
static int
-arm_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
+arm_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int rw,
struct expression *cond)
{
struct lwp_info *lp;
@@ -1123,7 +1123,7 @@ arm_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
/* Remove a hardware breakpoint. */
static int
-arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
+arm_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int rw,
struct expression *cond)
{
struct lwp_info *lp;
@@ -1180,7 +1180,7 @@ arm_linux_stopped_by_watchpoint (void)
static int
arm_linux_watchpoint_addr_within_range (struct target_ops *target,
CORE_ADDR addr,
- CORE_ADDR start, int length)
+ CORE_ADDR start, LONGEST length)
{
return start <= addr && start + length - 1 >= addr;
}
diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c
index 76c51a8..9e293fe 100644
--- a/gdb/i386-nat.c
+++ b/gdb/i386-nat.c
@@ -592,7 +592,7 @@ i386_update_inferior_debug_regs (struct i386_debug_reg_state *new_state)
of the type TYPE. Return 0 on success, -1 on failure. */
static int
-i386_insert_watchpoint (CORE_ADDR addr, int len, int type,
+i386_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
struct i386_debug_reg_state *state = i386_debug_reg_state ();
@@ -629,7 +629,7 @@ i386_insert_watchpoint (CORE_ADDR addr, int len, int type,
address ADDR, whose length is LEN bytes, and for accesses of the
type TYPE. Return 0 on success, -1 on failure. */
static int
-i386_remove_watchpoint (CORE_ADDR addr, int len, int type,
+i386_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
struct i386_debug_reg_state *state = i386_debug_reg_state ();
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index 9b5fbf3..6061eae 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -542,7 +542,7 @@ is_power_of_2 (int val)
}
static int
-ia64_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
+ia64_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int rw,
struct expression *cond)
{
struct lwp_info *lp;
@@ -596,7 +596,7 @@ ia64_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
}
static int
-ia64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type,
+ia64_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
int idx;
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index d60eddb..c33db45 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -313,14 +313,14 @@ inf_ttrace_disable_page_protections (pid_t pid)
type TYPE. */
static int
-inf_ttrace_insert_watchpoint (CORE_ADDR addr, int len, int type,
+inf_ttrace_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
const int pagesize = inf_ttrace_page_dict.pagesize;
pid_t pid = ptid_get_pid (inferior_ptid);
CORE_ADDR page_addr;
- int num_pages;
- int page;
+ LONGEST num_pages;
+ LONGEST page;
gdb_assert (type == hw_write);
@@ -337,14 +337,14 @@ inf_ttrace_insert_watchpoint (CORE_ADDR addr, int len, int type,
type TYPE. */
static int
-inf_ttrace_remove_watchpoint (CORE_ADDR addr, int len, int type,
+inf_ttrace_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
const int pagesize = inf_ttrace_page_dict.pagesize;
pid_t pid = ptid_get_pid (inferior_ptid);
CORE_ADDR page_addr;
- int num_pages;
- int page;
+ LONGEST num_pages;
+ LONGEST page;
gdb_assert (type == hw_write);
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index 5566d0c..7467d11 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -1017,7 +1017,7 @@ populate_regs_from_watches (struct pt_watch_regs *regs)
watch. Return zero on success. */
static int
-mips_linux_insert_watchpoint (CORE_ADDR addr, int len, int type,
+mips_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
struct pt_watch_regs regs;
@@ -1067,7 +1067,7 @@ mips_linux_insert_watchpoint (CORE_ADDR addr, int len, int type,
Return zero on success. */
static int
-mips_linux_remove_watchpoint (CORE_ADDR addr, int len, int type,
+mips_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
int retval;
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index b58f318..25fecf3 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -69,10 +69,10 @@ static ptid_t do_attach (ptid_t ptid);
static int procfs_can_use_hw_breakpoint (int, int, int);
-static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type,
+static int procfs_insert_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond);
-static int procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type,
+static int procfs_remove_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond);
static int procfs_stopped_by_watchpoint (void);
@@ -1493,14 +1493,14 @@ procfs_can_use_hw_breakpoint (int type, int cnt, int othertype)
}
static int
-procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type,
+procfs_remove_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
return procfs_hw_watchpoint (addr, -1, type);
}
static int
-procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type,
+procfs_insert_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
return procfs_hw_watchpoint (addr, len, type);
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 67e1cac..abfb2fc 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1839,11 +1839,11 @@ can_use_watchpoint_cond_accel (void)
CONDITION_VALUE will hold the value which should be put in the
DVC register. */
static void
-calculate_dvc (CORE_ADDR addr, int len, CORE_ADDR data_value,
+calculate_dvc (CORE_ADDR addr, LONGEST len, CORE_ADDR data_value,
uint32_t *condition_mode, uint64_t *condition_value)
{
- int i, num_byte_enable, align_offset, num_bytes_off_dvc,
- rightmost_enabled_byte;
+ LONGEST i, num_byte_enable;
+ int align_offset, num_bytes_off_dvc, rightmost_enabled_byte;
CORE_ADDR addr_end_data, addr_end_dvc;
/* The DVC register compares bytes within fixed-length windows which
@@ -1930,7 +1930,7 @@ num_memory_accesses (struct value *v)
of the constant. */
static int
check_condition (CORE_ADDR watch_addr, struct expression *cond,
- CORE_ADDR *data_value, int *len)
+ CORE_ADDR *data_value, LONGEST *len)
{
int pc = 1, num_accesses_left, num_accesses_right;
struct value *left_val, *right_val, *left_chain, *right_chain;
@@ -1997,7 +1997,7 @@ check_condition (CORE_ADDR watch_addr, struct expression *cond,
the condition expression, thus only triggering the watchpoint when it is
true. */
static int
-ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw,
+ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, LONGEST len, int rw,
struct expression *cond)
{
CORE_ADDR data_value;
@@ -2014,7 +2014,7 @@ ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw,
static void
create_watchpoint_request (struct ppc_hw_breakpoint *p, CORE_ADDR addr,
- int len, int rw, struct expression *cond,
+ LONGEST len, int rw, struct expression *cond,
int insert)
{
if (len == 1
@@ -2059,7 +2059,7 @@ create_watchpoint_request (struct ppc_hw_breakpoint *p, CORE_ADDR addr,
}
static int
-ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
+ppc_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int rw,
struct expression *cond)
{
struct lwp_info *lp;
@@ -2127,7 +2127,7 @@ ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
}
static int
-ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
+ppc_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int rw,
struct expression *cond)
{
struct lwp_info *lp;
@@ -2267,7 +2267,7 @@ ppc_linux_stopped_by_watchpoint (void)
static int
ppc_linux_watchpoint_addr_within_range (struct target_ops *target,
CORE_ADDR addr,
- CORE_ADDR start, int length)
+ CORE_ADDR start, LONGEST length)
{
int mask;
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 4a9336f..26accd8 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -2470,7 +2470,7 @@ procfs_address_to_host_pointer (CORE_ADDR addr)
#endif
static int
-proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, int len, int wflags)
+proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, LONGEST len, int wflags)
{
#if !defined (PCWATCH) && !defined (PIOCSWATCH)
/* If neither or these is defined, we can't support watchpoints.
@@ -4816,7 +4816,7 @@ procfs_pid_to_str (struct target_ops *ops, ptid_t ptid)
/* Insert a watchpoint. */
static int
-procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag,
+procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, LONGEST len, int rwflag,
int after)
{
#ifndef UNIXWARE
@@ -4938,7 +4938,7 @@ procfs_stopped_data_address (struct target_ops *targ, CORE_ADDR *addr)
}
static int
-procfs_insert_watchpoint (CORE_ADDR addr, int len, int type,
+procfs_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
if (!target_have_steppable_watchpoint
@@ -4960,7 +4960,7 @@ procfs_insert_watchpoint (CORE_ADDR addr, int len, int type,
}
static int
-procfs_remove_watchpoint (CORE_ADDR addr, int len, int type,
+procfs_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
return procfs_set_watchpoint (inferior_ptid, addr, 0, 0, 0);
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index 748aeba..b385c3f 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -1417,14 +1417,14 @@ m32r_can_use_hw_watchpoint (int type, int cnt, int othertype)
watchpoint. */
static int
-m32r_insert_watchpoint (CORE_ADDR addr, int len, int type,
+m32r_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
int i;
if (remote_debug)
- fprintf_unfiltered (gdb_stdlog, "m32r_insert_watchpoint(%s,%d,%d)\n",
- paddress (target_gdbarch, addr), len, type);
+ fprintf_unfiltered (gdb_stdlog, "m32r_insert_watchpoint(%s,%s,%d)\n",
+ paddress (target_gdbarch, addr), plongest (len), type);
for (i = 0; i < MAX_ACCESS_BREAKS; i++)
{
@@ -1442,14 +1442,14 @@ m32r_insert_watchpoint (CORE_ADDR addr, int len, int type,
}
static int
-m32r_remove_watchpoint (CORE_ADDR addr, int len, int type,
+m32r_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
int i;
if (remote_debug)
- fprintf_unfiltered (gdb_stdlog, "m32r_remove_watchpoint(%s,%d,%d)\n",
- paddress (target_gdbarch, addr), len, type);
+ fprintf_unfiltered (gdb_stdlog, "m32r_remove_watchpoint(%s,%s,%d)\n",
+ paddress (target_gdbarch, addr), plongest (len), type);
for (i = 0; i < MAX_ACCESS_BREAKS; i++)
{
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index eee2460..9a9265a 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -2419,7 +2419,7 @@ calculate_mask (CORE_ADDR addr, int len)
watchpoint. */
static int
-mips_insert_watchpoint (CORE_ADDR addr, int len, int type,
+mips_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
if (mips_set_breakpoint (addr, len, type))
@@ -2431,7 +2431,7 @@ mips_insert_watchpoint (CORE_ADDR addr, int len, int type,
/* Remove a watchpoint. */
static int
-mips_remove_watchpoint (CORE_ADDR addr, int len, int type,
+mips_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
if (mips_clear_breakpoint (addr, len, type))
diff --git a/gdb/remote.c b/gdb/remote.c
index 8c27390..bcec331 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -8035,7 +8035,7 @@ watchpoint_to_Z_packet (int type)
}
static int
-remote_insert_watchpoint (CORE_ADDR addr, int len, int type,
+remote_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
struct remote_state *rs = get_remote_state ();
@@ -8050,7 +8050,7 @@ remote_insert_watchpoint (CORE_ADDR addr, int len, int type,
p = strchr (rs->buf, '\0');
addr = remote_address_masked (addr);
p += hexnumstr (p, (ULONGEST) addr);
- xsnprintf (p, endbuf - p, ",%x", len);
+ xsnprintf (p, endbuf - p, ",%s", phex_nz (len, sizeof (len)));
putpkt (rs->buf);
getpkt (&rs->buf, &rs->buf_size, 0);
@@ -8070,7 +8070,7 @@ remote_insert_watchpoint (CORE_ADDR addr, int len, int type,
static int
remote_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr,
- CORE_ADDR start, int length)
+ CORE_ADDR start, LONGEST length)
{
CORE_ADDR diff = remote_address_masked (addr - start);
@@ -8079,7 +8079,7 @@ remote_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr,
static int
-remote_remove_watchpoint (CORE_ADDR addr, int len, int type,
+remote_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
struct remote_state *rs = get_remote_state ();
@@ -8094,7 +8094,7 @@ remote_remove_watchpoint (CORE_ADDR addr, int len, int type,
p = strchr (rs->buf, '\0');
addr = remote_address_masked (addr);
p += hexnumstr (p, (ULONGEST) addr);
- xsnprintf (p, endbuf - p, ",%x", len);
+ xsnprintf (p, endbuf - p, ",%s", phex_nz (len, sizeof (len)));
putpkt (rs->buf);
getpkt (&rs->buf, &rs->buf_size, 0);
diff --git a/gdb/s390-nat.c b/gdb/s390-nat.c
index 4974bad..3f41519 100644
--- a/gdb/s390-nat.c
+++ b/gdb/s390-nat.c
@@ -517,7 +517,7 @@ s390_fix_watch_points (struct lwp_info *lp)
}
static int
-s390_insert_watchpoint (CORE_ADDR addr, int len, int type,
+s390_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
struct lwp_info *lp;
@@ -538,7 +538,7 @@ s390_insert_watchpoint (CORE_ADDR addr, int len, int type,
}
static int
-s390_remove_watchpoint (CORE_ADDR addr, int len, int type,
+s390_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
struct lwp_info *lp;
diff --git a/gdb/target.c b/gdb/target.c
index f7207c0..a69fb06 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -49,7 +49,8 @@ static void target_info (char *, int);
static void default_terminal_info (char *, int);
static int default_watchpoint_addr_within_range (struct target_ops *,
- CORE_ADDR, CORE_ADDR, int);
+ CORE_ADDR, CORE_ADDR,
+ LONGEST);
static int default_region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST);
@@ -114,10 +115,10 @@ static int debug_to_insert_hw_breakpoint (struct gdbarch *,
static int debug_to_remove_hw_breakpoint (struct gdbarch *,
struct bp_target_info *);
-static int debug_to_insert_watchpoint (CORE_ADDR, int, int,
+static int debug_to_insert_watchpoint (CORE_ADDR, LONGEST, int,
struct expression *);
-static int debug_to_remove_watchpoint (CORE_ADDR, int, int,
+static int debug_to_remove_watchpoint (CORE_ADDR, LONGEST, int,
struct expression *);
static int debug_to_stopped_by_watchpoint (void);
@@ -125,11 +126,12 @@ static int debug_to_stopped_by_watchpoint (void);
static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *);
static int debug_to_watchpoint_addr_within_range (struct target_ops *,
- CORE_ADDR, CORE_ADDR, int);
+ CORE_ADDR, CORE_ADDR,
+ LONGEST);
static int debug_to_region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST);
-static int debug_to_can_accel_watchpoint_condition (CORE_ADDR, int, int,
+static int debug_to_can_accel_watchpoint_condition (CORE_ADDR, LONGEST, int,
struct expression *);
static void debug_to_terminal_init (void);
@@ -751,10 +753,10 @@ update_current_target (void)
(int (*) (struct gdbarch *, struct bp_target_info *))
return_minus_one);
de_fault (to_insert_watchpoint,
- (int (*) (CORE_ADDR, int, int, struct expression *))
+ (int (*) (CORE_ADDR, LONGEST, int, struct expression *))
return_minus_one);
de_fault (to_remove_watchpoint,
- (int (*) (CORE_ADDR, int, int, struct expression *))
+ (int (*) (CORE_ADDR, LONGEST, int, struct expression *))
return_minus_one);
de_fault (to_stopped_by_watchpoint,
(int (*) (void))
@@ -767,7 +769,7 @@ update_current_target (void)
de_fault (to_region_ok_for_hw_watchpoint,
default_region_ok_for_hw_watchpoint);
de_fault (to_can_accel_watchpoint_condition,
- (int (*) (CORE_ADDR, int, int, struct expression *))
+ (int (*) (CORE_ADDR, LONGEST, int, struct expression *))
return_zero);
de_fault (to_terminal_init,
(void (*) (void))
@@ -3558,7 +3560,7 @@ default_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len)
static int
default_watchpoint_addr_within_range (struct target_ops *target,
CORE_ADDR addr,
- CORE_ADDR start, int length)
+ CORE_ADDR start, LONGEST length)
{
return addr >= start && addr < start + length;
}
@@ -4263,7 +4265,7 @@ debug_to_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len)
}
static int
-debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw,
+debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, LONGEST len, int rw,
struct expression *cond)
{
int retval;
@@ -4273,8 +4275,8 @@ debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw,
fprintf_unfiltered (gdb_stdlog,
"target_can_accel_watchpoint_condition "
- "(%s, %d, %d, %s) = %ld\n",
- core_addr_to_string (addr), len, rw,
+ "(%s, %s, %d, %s) = %ld\n",
+ core_addr_to_string (addr), plongest (len), rw,
host_address_to_string (cond), (unsigned long) retval);
return retval;
}
@@ -4309,7 +4311,7 @@ debug_to_stopped_data_address (struct target_ops *target, CORE_ADDR *addr)
static int
debug_to_watchpoint_addr_within_range (struct target_ops *target,
CORE_ADDR addr,
- CORE_ADDR start, int length)
+ CORE_ADDR start, LONGEST length)
{
int retval;
@@ -4317,9 +4319,9 @@ debug_to_watchpoint_addr_within_range (struct target_ops *target,
start, length);
fprintf_filtered (gdb_stdlog,
- "target_watchpoint_addr_within_range (%s, %s, %d) = %d\n",
+ "target_watchpoint_addr_within_range (%s, %s, %s) = %d\n",
core_addr_to_string (addr), core_addr_to_string (start),
- length, retval);
+ plongest (length), retval);
return retval;
}
@@ -4354,7 +4356,7 @@ debug_to_remove_hw_breakpoint (struct gdbarch *gdbarch,
}
static int
-debug_to_insert_watchpoint (CORE_ADDR addr, int len, int type,
+debug_to_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
int retval;
@@ -4362,14 +4364,14 @@ debug_to_insert_watchpoint (CORE_ADDR addr, int len, int type,
retval = debug_target.to_insert_watchpoint (addr, len, type, cond);
fprintf_unfiltered (gdb_stdlog,
- "target_insert_watchpoint (%s, %d, %d, %s) = %ld\n",
- core_addr_to_string (addr), len, type,
+ "target_insert_watchpoint (%s, %s, %d, %s) = %ld\n",
+ core_addr_to_string (addr), plongest (len), type,
host_address_to_string (cond), (unsigned long) retval);
return retval;
}
static int
-debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type,
+debug_to_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type,
struct expression *cond)
{
int retval;
@@ -4377,8 +4379,8 @@ debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type,
retval = debug_target.to_remove_watchpoint (addr, len, type, cond);
fprintf_unfiltered (gdb_stdlog,
- "target_remove_watchpoint (%s, %d, %d, %s) = %ld\n",
- core_addr_to_string (addr), len, type,
+ "target_remove_watchpoint (%s, %s, %d, %s) = %ld\n",
+ core_addr_to_string (addr), plongest (len), type,
host_address_to_string (cond), (unsigned long) retval);
return retval;
}
diff --git a/gdb/target.h b/gdb/target.h
index 69228e1..4b52d53 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -466,8 +466,8 @@ struct target_ops
/* Documentation of what the two routines below are expected to do is
provided with the corresponding target_* macros. */
- int (*to_remove_watchpoint) (CORE_ADDR, int, int, struct expression *);
- int (*to_insert_watchpoint) (CORE_ADDR, int, int, struct expression *);
+ int (*to_remove_watchpoint) (CORE_ADDR, LONGEST, int, struct expression *);
+ int (*to_insert_watchpoint) (CORE_ADDR, LONGEST, int, struct expression *);
int (*to_insert_mask_watchpoint) (struct target_ops *,
CORE_ADDR, CORE_ADDR, int);
@@ -478,13 +478,13 @@ struct target_ops
int to_have_continuable_watchpoint;
int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *);
int (*to_watchpoint_addr_within_range) (struct target_ops *,
- CORE_ADDR, CORE_ADDR, int);
+ CORE_ADDR, CORE_ADDR, LONGEST);
/* Documentation of this routine is provided with the corresponding
target_* macro. */
int (*to_region_ok_for_hw_watchpoint) (CORE_ADDR, LONGEST);
- int (*to_can_accel_watchpoint_condition) (CORE_ADDR, int, int,
+ int (*to_can_accel_watchpoint_condition) (CORE_ADDR, LONGEST, int,
struct expression *);
int (*to_masked_watch_num_registers) (struct target_ops *,
CORE_ADDR, CORE_ADDR);
--MP_/6HRlH6vpyqtSy4CYyMrX6b2--

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,113 @@
http://sourceware.org/ml/gdb-cvs/2012-09/msg00160.html
### src/gdb/ChangeLog 2012/09/26 23:53:53 1.14709
### src/gdb/ChangeLog 2012/09/27 08:57:14 1.14710
## -1,3 +1,16 @@
+2012-09-27 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * gdbtypes.c (lookup_array_range_type): Expand parameters
+ LOW_BOUND and HIGH_BOUND to LONGEST.
+ (lookup_string_range_type): Likewise.
+ * gdbtypes.h (lookup_array_range_type): Likewise.
+ (lookup_string_range_type): Likewise.
+ * valops.c (value_cstring): Expand parameter LEN to ssize_t.
+ Expand HIGHBOUND to ssize_t.
+ (value_string): Likewise.
+ * value.h (value_cstring): Expand parameter LEN to ssize_t.
+ (value_string): Likewise.
+
2012-09-27 Yao Qi <yao@codesourcery.com>
PR breakpoints/13898
Index: gdb-7.5.0.20120926/gdb/gdbtypes.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/gdbtypes.c 2012-11-07 22:09:57.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/gdbtypes.c 2012-11-07 22:50:47.048741164 +0100
@@ -1022,7 +1022,7 @@ create_array_type (struct type *result_t
struct type *
lookup_array_range_type (struct type *element_type,
- int low_bound, int high_bound)
+ LONGEST low_bound, LONGEST high_bound)
{
struct gdbarch *gdbarch = get_type_arch (element_type);
struct type *index_type = builtin_type (gdbarch)->builtin_int;
@@ -1058,7 +1058,7 @@ create_string_type (struct type *result_
struct type *
lookup_string_range_type (struct type *string_char_type,
- int low_bound, int high_bound)
+ LONGEST low_bound, LONGEST high_bound)
{
struct type *result_type;
Index: gdb-7.5.0.20120926/gdb/gdbtypes.h
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/gdbtypes.h 2012-11-07 22:09:29.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/gdbtypes.h 2012-11-07 22:51:46.440655817 +0100
@@ -1640,7 +1640,7 @@ extern struct type *create_range_type (s
extern struct type *create_array_type (struct type *, struct type *,
struct type *);
-extern struct type *lookup_array_range_type (struct type *, int, int);
+extern struct type *lookup_array_range_type (struct type *, LONGEST, LONGEST);
extern CORE_ADDR type_range_any_field_internal (struct type *range_type,
int fieldno);
@@ -1656,7 +1656,7 @@ extern void finalize_type (struct type *
extern struct type *create_string_type (struct type *, struct type *,
struct type *);
-extern struct type *lookup_string_range_type (struct type *, int, int);
+extern struct type *lookup_string_range_type (struct type *, LONGEST, LONGEST);
extern struct type *create_set_type (struct type *, struct type *);
Index: gdb-7.5.0.20120926/gdb/valops.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/valops.c 2012-11-07 22:46:00.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/valops.c 2012-11-07 22:50:47.091741104 +0100
@@ -1937,11 +1937,11 @@ value_array (int lowbound, int highbound
}
struct value *
-value_cstring (char *ptr, int len, struct type *char_type)
+value_cstring (char *ptr, ssize_t len, struct type *char_type)
{
struct value *val;
int lowbound = current_language->string_lower_bound;
- int highbound = len / TYPE_LENGTH (char_type);
+ ssize_t highbound = len / TYPE_LENGTH (char_type);
struct type *stringtype
= lookup_array_range_type (char_type, lowbound, highbound + lowbound - 1);
@@ -1960,11 +1960,11 @@ value_cstring (char *ptr, int len, struc
string may contain embedded null bytes. */
struct value *
-value_string (char *ptr, int len, struct type *char_type)
+value_string (char *ptr, ssize_t len, struct type *char_type)
{
struct value *val;
int lowbound = current_language->string_lower_bound;
- int highbound = len / TYPE_LENGTH (char_type);
+ ssize_t highbound = len / TYPE_LENGTH (char_type);
struct type *stringtype
= lookup_string_range_type (char_type, lowbound, highbound + lowbound - 1);
Index: gdb-7.5.0.20120926/gdb/value.h
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/value.h 2012-11-07 22:09:30.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/value.h 2012-11-07 22:51:11.744705614 +0100
@@ -593,9 +593,9 @@ extern struct value *value_mark (void);
extern void value_free_to_mark (struct value *mark);
-extern struct value *value_cstring (char *ptr, int len,
+extern struct value *value_cstring (char *ptr, ssize_t len,
struct type *char_type);
-extern struct value *value_string (char *ptr, int len,
+extern struct value *value_string (char *ptr, ssize_t len,
struct type *char_type);
extern struct value *value_bitstring (char *ptr, int len,
struct type *index_type);

View File

@ -0,0 +1,627 @@
http://sourceware.org/ml/gdb-patches/2012-10/msg00231.html
Subject: Re: [PATCH] Expand fortran array bounds sizes to LONGEST
On Mon, 15 Oct 2012 15:25:55 +0200, Jan Kratochvil wrote:
> I have filed for it now:
> Invalid debug/ array bounds w/-fno-range-check and 32-bit target
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54934
Therefore it looks as a valid gfortran FSF GCC HEAD bug so provided
a hand-patched .S file for i386; patched GDB PASSes with it.
Thanks,
Jan
2012-10-15 Siddhesh Poyarekar <siddhesh@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.fortran/array-bounds.exp: New test file.
* gdb.fortran/array-bounds.f: New test file.
* gdb.fortran/array-bounds.S: New test file.
--- /dev/null 2012-09-26 15:32:16.098506310 +0200
+++ gdb-7.2/gdb/testsuite/gdb.fortran/array-bounds.exp 2012-10-15 20:53:26.427072583 +0200
@@ -0,0 +1,43 @@
+# Copyright 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the gdb testsuite. It contains test to ensure that
+# array bounds accept LONGEST.
+
+if { [skip_fortran_tests] } { return -1 }
+
+set testfile "array-bounds"
+
+if { [is_ilp32_target] && ([istarget "i\[34567\]86-*-linux*"]
+ || [istarget "x86_64-*-linux*"]) } {
+ set srcfile ${testfile}.S
+ set opts {nodebug f90}
+} else {
+ set srcfile ${testfile}.f
+ set opts {debug f90}
+}
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile $opts]} {
+ print "compile failed"
+ return -1
+}
+
+if { ![runto MAIN__] } {
+ perror "Could not run to breakpoint `MAIN__'."
+ continue
+}
+
+gdb_test "print &foo" {.*\(4294967296:4294967297\).*}
+gdb_test "print &bar" {.*\(-4294967297:-4294967296\).*}
--- /dev/null 2012-09-26 15:32:16.098506310 +0200
+++ gdb-7.2/gdb/testsuite/gdb.fortran/array-bounds.f 2012-10-15 19:35:12.500254261 +0200
@@ -0,0 +1,22 @@
+c Copyright 2012 Free Software Foundation, Inc.
+
+c This program is free software; you can redistribute it and/or modify
+c it under the terms of the GNU General Public License as published by
+c the Free Software Foundation; either version 3 of the License, or
+c (at your option) any later version.
+c
+c This program is distributed in the hope that it will be useful,
+c but WITHOUT ANY WARRANTY; without even the implied warranty of
+c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+c GNU General Public License for more details.
+c
+c You should have received a copy of the GNU General Public License
+c along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ dimension foo(4294967296_8:4294967297_8)
+ dimension bar(-4294967297_8:-4294967296_8)
+ bar = 42
+ foo=bar
+ stop
+ end
+
--- /dev/null 2012-09-26 15:32:16.098506310 +0200
+++ gdb-7.2/gdb/testsuite/gdb.fortran/array-bounds.S 2012-10-15 20:52:36.851118215 +0200
@@ -0,0 +1,529 @@
+/* Copyright 2012 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ This file is part of the gdb testsuite. */
+
+ .file "array-bounds.f"
+ .text
+.Ltext0:
+ .type MAIN__, @function
+MAIN__:
+.LFB0:
+ .file 1 "gdb.fortran/array-bounds.f"
+ # gdb.fortran/array-bounds.f:16
+ .loc 1 16 0
+ .cfi_startproc
+# BLOCK 2 seq:0
+# PRED: ENTRY (FALLTHRU)
+ pushl %ebp
+.LCFI0:
+ .cfi_def_cfa_offset 8
+ .cfi_offset 5, -8
+ movl %esp, %ebp
+.LCFI1:
+ .cfi_def_cfa_register 5
+ subl $40, %esp
+.LBB2:
+# SUCC: 3 (FALLTHRU)
+ # gdb.fortran/array-bounds.f:18
+ .loc 1 18 0
+ movl $-1, %eax
+# BLOCK 3 seq:1
+# PRED: 2 (FALLTHRU) 4 [100.0%]
+.L3:
+ # gdb.fortran/array-bounds.f:18
+ .loc 1 18 0 is_stmt 0 discriminator 1
+ testl %eax, %eax
+# SUCC: 5 4 (FALLTHRU)
+ jg .L2
+# BLOCK 4 seq:2
+# PRED: 3 (FALLTHRU)
+ # gdb.fortran/array-bounds.f:18
+ .loc 1 18 0 discriminator 2
+ leal 1(%eax), %ecx
+ movl .LC0, %edx
+ movl %edx, -16(%ebp,%ecx,4)
+ addl $1, %eax
+# SUCC: 3 [100.0%]
+ jmp .L3
+# BLOCK 5 seq:3
+# PRED: 3
+.L2:
+.LBE2:
+ # gdb.fortran/array-bounds.f:19
+ .loc 1 19 0 is_stmt 1
+ movl -16(%ebp), %eax
+ movl -12(%ebp), %edx
+ movl %eax, -24(%ebp)
+ movl %edx, -20(%ebp)
+ # gdb.fortran/array-bounds.f:20
+ .loc 1 20 0
+ movl $0, 4(%esp)
+ movl $0, (%esp)
+# SUCC:
+ call _gfortran_stop_string
+ .cfi_endproc
+.LFE0:
+ .size MAIN__, .-MAIN__
+ .globl main
+ .type main, @function
+main:
+.LFB1:
+ # gdb.fortran/array-bounds.f:21
+ .loc 1 21 0
+ .cfi_startproc
+# BLOCK 2 seq:0
+# PRED: ENTRY (FALLTHRU)
+ pushl %ebp
+.LCFI2:
+ .cfi_def_cfa_offset 8
+ .cfi_offset 5, -8
+ movl %esp, %ebp
+.LCFI3:
+ .cfi_def_cfa_register 5
+ andl $-16, %esp
+ subl $16, %esp
+ # gdb.fortran/array-bounds.f:21
+ .loc 1 21 0
+ movl 12(%ebp), %eax
+ movl %eax, 4(%esp)
+ movl 8(%ebp), %eax
+ movl %eax, (%esp)
+ call _gfortran_set_args
+ movl $options.1.1824, 4(%esp)
+ movl $7, (%esp)
+ call _gfortran_set_options
+ call MAIN__
+ movl $0, %eax
+ leave
+.LCFI4:
+ .cfi_restore 5
+ .cfi_def_cfa 4, 4
+# SUCC: EXIT [100.0%]
+ ret
+ .cfi_endproc
+.LFE1:
+ .size main, .-main
+ .section .rodata
+ .align 4
+ .type options.1.1824, @object
+ .size options.1.1824, 28
+options.1.1824:
+ .long 68
+ .long 1023
+ .long 0
+ .long 0
+ .long 1
+ .long 1
+ .long 0
+ .align 4
+.LC0:
+ .long 1109917696
+ .text
+.Letext0:
+ .section .debug_info,"",@progbits
+.Ldebug_info0:
+ .long 2f - 1f # Length of Compilation Unit Info
+1:
+ .value 0x2 # DWARF version number
+ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section
+ .byte 0x4 # Pointer Size (in bytes)
+dieb: .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit)
+ .long .LASF5 # DW_AT_producer: "GNU Fortran 4.8.0 20121015 (experimental) -ffixed-form -m32 -mtune=generic -march=x86-64 -g -gdwarf-2 -fintrinsic-modules-path .../gcchead-root/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/finclude"
+ .byte 0xe # DW_AT_language
+ .byte 0x2 # DW_AT_identifier_case
+ .long .LASF6 # DW_AT_name: "gdb.fortran/array-bounds.f"
+ .long .LASF7 # DW_AT_comp_dir: ""
+ .long .Ltext0 # DW_AT_low_pc
+ .long .Letext0 # DW_AT_high_pc
+ .long .Ldebug_line0 # DW_AT_stmt_list
+die26: .uleb128 0x2 # (DIE (0x26) DW_TAG_subprogram)
+ .long .LASF8 # DW_AT_name: "MAIN__"
+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f)
+ .byte 0x10 # DW_AT_decl_line
+ .long .LFB0 # DW_AT_low_pc
+ .long .LFE0 # DW_AT_high_pc
+ .long .LLST0 # DW_AT_frame_base
+ .byte 0x1 # DW_AT_GNU_all_tail_call_sites
+ .byte 0x1 # DW_AT_main_subprogram
+ .byte 0x2 # DW_AT_calling_convention
+ .long die66 - .Ldebug_info0 # DW_AT_sibling
+die40: .uleb128 0x3 # (DIE (0x40) DW_TAG_variable)
+ .ascii "bar\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f)
+ .byte 0x11 # DW_AT_decl_line
+ .long die66 - .Ldebug_info0 # DW_AT_type
+ .byte 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 -24
+die4e: .uleb128 0x3 # (DIE (0x4e) DW_TAG_variable)
+ .ascii "foo\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f)
+ .byte 0x10 # DW_AT_decl_line
+ .long die88 - .Ldebug_info0 # DW_AT_type
+ .byte 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 -32
+die5c: .uleb128 0x4 # (DIE (0x5c) DW_TAG_lexical_block)
+ .long .LBB2 # DW_AT_low_pc
+ .long .LBE2 # DW_AT_high_pc
+ .byte 0 # end of children of DIE 0x26
+die66: .uleb128 0x5 # (DIE (0x66) DW_TAG_array_type)
+ .long die81 - .Ldebug_info0 # DW_AT_type
+ .long die7a - .Ldebug_info0 # DW_AT_sibling
+die6f: .uleb128 0x6 # (DIE (0x6f) DW_TAG_subrange_type)
+ .long die7a - .Ldebug_info0 # DW_AT_type
+#if 0
+ .long 0xffffffff # DW_AT_lower_bound
+ .byte 0 # DW_AT_upper_bound
+#else
+ .quad 0xfffffffeffffffff # DW_AT_lower_bound
+ .quad 0xffffffff00000000 # DW_AT_upper_bound
+#endif
+ .byte 0 # end of children of DIE 0x66
+die7a: .uleb128 0x7 # (DIE (0x7a) DW_TAG_base_type)
+#if 0
+ .byte 0x4 # DW_AT_byte_size
+#else
+ .byte 0x8 # DW_AT_byte_size
+#endif
+ .byte 0x5 # DW_AT_encoding
+ .long .LASF0 # DW_AT_name: "integer(kind=4)"
+die81: .uleb128 0x7 # (DIE (0x81) DW_TAG_base_type)
+ .byte 0x4 # DW_AT_byte_size
+ .byte 0x4 # DW_AT_encoding
+ .long .LASF1 # DW_AT_name: "real(kind=4)"
+die88: .uleb128 0x5 # (DIE (0x88) DW_TAG_array_type)
+ .long die81 - .Ldebug_info0 # DW_AT_type
+ .long die99 - .Ldebug_info0 # DW_AT_sibling
+die91: .uleb128 0x8 # (DIE (0x91) DW_TAG_subrange_type)
+ .long die7a - .Ldebug_info0 # DW_AT_type
+#if 0
+ .byte 0 # DW_AT_lower_bound
+ .byte 0x1 # DW_AT_upper_bound
+#else
+ .quad 0x100000000 # DW_AT_lower_bound
+ .quad 0x100000001 # DW_AT_upper_bound
+#endif
+ .byte 0 # end of children of DIE 0x88
+die99: .uleb128 0x9 # (DIE (0x99) DW_TAG_subprogram)
+ .byte 0x1 # DW_AT_external
+ .long .LASF9 # DW_AT_name: "main"
+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f)
+ .byte 0x15 # DW_AT_decl_line
+ .long die7a - .Ldebug_info0 # DW_AT_type
+ .long .LFB1 # DW_AT_low_pc
+ .long .LFE1 # DW_AT_high_pc
+ .long .LLST1 # DW_AT_frame_base
+ .byte 0x1 # DW_AT_GNU_all_tail_call_sites
+ .long died4 - .Ldebug_info0 # DW_AT_sibling
+dieb6: .uleb128 0xa # (DIE (0xb6) DW_TAG_formal_parameter)
+ .long .LASF2 # DW_AT_name: "argc"
+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f)
+ .byte 0x15 # DW_AT_decl_line
+ .long died4 - .Ldebug_info0 # DW_AT_type
+ .byte 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 0
+diec4: .uleb128 0xa # (DIE (0xc4) DW_TAG_formal_parameter)
+ .long .LASF3 # DW_AT_name: "argv"
+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f)
+ .byte 0x15 # DW_AT_decl_line
+ .long died9 - .Ldebug_info0 # DW_AT_type
+ .byte 0x3 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 4
+ .byte 0x6 # DW_OP_deref
+ .byte 0 # end of children of DIE 0x99
+died4: .uleb128 0xb # (DIE (0xd4) DW_TAG_const_type)
+ .long die7a - .Ldebug_info0 # DW_AT_type
+died9: .uleb128 0xc # (DIE (0xd9) DW_TAG_pointer_type)
+ .byte 0x4 # DW_AT_byte_size
+ .long diedf - .Ldebug_info0 # DW_AT_type
+diedf: .uleb128 0x7 # (DIE (0xdf) DW_TAG_base_type)
+ .byte 0x1 # DW_AT_byte_size
+ .byte 0x8 # DW_AT_encoding
+ .long .LASF4 # DW_AT_name: "character(kind=1)"
+ .byte 0 # end of children of DIE 0xb
+2:
+ .section .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+ .uleb128 0x1 # (abbrev code)
+ .uleb128 0x11 # (TAG: DW_TAG_compile_unit)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x25 # (DW_AT_producer)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x13 # (DW_AT_language)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x42 # (DW_AT_identifier_case)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x1b # (DW_AT_comp_dir)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x10 # (DW_AT_stmt_list)
+ .uleb128 0x6 # (DW_FORM_data4)
+ .byte 0
+ .byte 0
+ .uleb128 0x2 # (abbrev code)
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x40 # (DW_AT_frame_base)
+ .uleb128 0x6 # (DW_FORM_data4)
+ .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x6a # (DW_AT_main_subprogram)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x36 # (DW_AT_calling_convention)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x1 # (DW_AT_sibling)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .uleb128 0x3 # (abbrev code)
+ .uleb128 0x34 # (TAG: DW_TAG_variable)
+ .byte 0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2 # (DW_AT_location)
+ .uleb128 0xa # (DW_FORM_block1)
+ .byte 0
+ .byte 0
+ .uleb128 0x4 # (abbrev code)
+ .uleb128 0xb # (TAG: DW_TAG_lexical_block)
+ .byte 0 # DW_children_no
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .byte 0
+ .byte 0
+ .uleb128 0x5 # (abbrev code)
+ .uleb128 0x1 # (TAG: DW_TAG_array_type)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x1 # (DW_AT_sibling)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .uleb128 0x6 # (abbrev code)
+ .uleb128 0x21 # (TAG: DW_TAG_subrange_type)
+ .byte 0 # DW_children_no
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+#if 0
+ .uleb128 0x22 # (DW_AT_lower_bound)
+ .uleb128 0x6 # (DW_FORM_data4)
+ .uleb128 0x2f # (DW_AT_upper_bound)
+ .uleb128 0xb # (DW_FORM_data1)
+#else
+ .uleb128 0x22 # (DW_AT_lower_bound)
+ .uleb128 0x7 # (DW_FORM_data8)
+ .uleb128 0x2f # (DW_AT_upper_bound)
+ .uleb128 0x7 # (DW_FORM_data8)
+#endif
+ .byte 0
+ .byte 0
+ .uleb128 0x7 # (abbrev code)
+ .uleb128 0x24 # (TAG: DW_TAG_base_type)
+ .byte 0 # DW_children_no
+ .uleb128 0xb # (DW_AT_byte_size)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3e # (DW_AT_encoding)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .byte 0
+ .byte 0
+ .uleb128 0x8 # (abbrev code)
+ .uleb128 0x21 # (TAG: DW_TAG_subrange_type)
+ .byte 0 # DW_children_no
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+#if 0
+ .uleb128 0x22 # (DW_AT_lower_bound)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x2f # (DW_AT_upper_bound)
+ .uleb128 0xb # (DW_FORM_data1)
+#else
+ .uleb128 0x22 # (DW_AT_lower_bound)
+ .uleb128 0x7 # (DW_FORM_data8)
+ .uleb128 0x2f # (DW_AT_upper_bound)
+ .uleb128 0x7 # (DW_FORM_data8)
+#endif
+ .byte 0
+ .byte 0
+ .uleb128 0x9 # (abbrev code)
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x3f # (DW_AT_external)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x40 # (DW_AT_frame_base)
+ .uleb128 0x6 # (DW_FORM_data4)
+ .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x1 # (DW_AT_sibling)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .uleb128 0xa # (abbrev code)
+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter)
+ .byte 0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2 # (DW_AT_location)
+ .uleb128 0xa # (DW_FORM_block1)
+ .byte 0
+ .byte 0
+ .uleb128 0xb # (abbrev code)
+ .uleb128 0x26 # (TAG: DW_TAG_const_type)
+ .byte 0 # DW_children_no
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .uleb128 0xc # (abbrev code)
+ .uleb128 0xf # (TAG: DW_TAG_pointer_type)
+ .byte 0 # DW_children_no
+ .uleb128 0xb # (DW_AT_byte_size)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .byte 0
+ .section .debug_loc,"",@progbits
+.Ldebug_loc0:
+.LLST0:
+ .long .LFB0-.Ltext0 # Location list begin address (*.LLST0)
+ .long .LCFI0-.Ltext0 # Location list end address (*.LLST0)
+ .value 0x2 # Location expression size
+ .byte 0x74 # DW_OP_breg4
+ .sleb128 4
+ .long .LCFI0-.Ltext0 # Location list begin address (*.LLST0)
+ .long .LCFI1-.Ltext0 # Location list end address (*.LLST0)
+ .value 0x2 # Location expression size
+ .byte 0x74 # DW_OP_breg4
+ .sleb128 8
+ .long .LCFI1-.Ltext0 # Location list begin address (*.LLST0)
+ .long .LFE0-.Ltext0 # Location list end address (*.LLST0)
+ .value 0x2 # Location expression size
+ .byte 0x75 # DW_OP_breg5
+ .sleb128 8
+ .long 0 # Location list terminator begin (*.LLST0)
+ .long 0 # Location list terminator end (*.LLST0)
+.LLST1:
+ .long .LFB1-.Ltext0 # Location list begin address (*.LLST1)
+ .long .LCFI2-.Ltext0 # Location list end address (*.LLST1)
+ .value 0x2 # Location expression size
+ .byte 0x74 # DW_OP_breg4
+ .sleb128 4
+ .long .LCFI2-.Ltext0 # Location list begin address (*.LLST1)
+ .long .LCFI3-.Ltext0 # Location list end address (*.LLST1)
+ .value 0x2 # Location expression size
+ .byte 0x74 # DW_OP_breg4
+ .sleb128 8
+ .long .LCFI3-.Ltext0 # Location list begin address (*.LLST1)
+ .long .LCFI4-.Ltext0 # Location list end address (*.LLST1)
+ .value 0x2 # Location expression size
+ .byte 0x75 # DW_OP_breg5
+ .sleb128 8
+ .long .LCFI4-.Ltext0 # Location list begin address (*.LLST1)
+ .long .LFE1-.Ltext0 # Location list end address (*.LLST1)
+ .value 0x2 # Location expression size
+ .byte 0x74 # DW_OP_breg4
+ .sleb128 4
+ .long 0 # Location list terminator begin (*.LLST1)
+ .long 0 # Location list terminator end (*.LLST1)
+ .section .debug_aranges,"",@progbits
+ .long 0x1c # Length of Address Ranges Info
+ .value 0x2 # DWARF Version
+ .long .Ldebug_info0 # Offset of Compilation Unit Info
+ .byte 0x4 # Size of Address
+ .byte 0 # Size of Segment Descriptor
+ .value 0 # Pad to 8 byte boundary
+ .value 0
+ .long .Ltext0 # Address
+ .long .Letext0-.Ltext0 # Length
+ .long 0
+ .long 0
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .section .debug_str,"MS",@progbits,1
+.LASF4:
+ .string "character(kind=1)"
+.LASF5:
+ .string "GNU Fortran 4.8.0 20121015 (experimental) -ffixed-form -m32 -mtune=generic -march=x86-64 -g -gdwarf-2 -fintrinsic-modules-path .../gcchead-root/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/finclude"
+.LASF7:
+ .string ""
+.LASF0:
+#if 0
+ .string "integer(kind=4)"
+#else
+ .string "integer(kind=8)"
+#endif
+.LASF9:
+ .string "main"
+.LASF8:
+ .string "MAIN__"
+.LASF6:
+ .string "gdb.fortran/array-bounds.f"
+.LASF2:
+ .string "argc"
+.LASF1:
+ .string "real(kind=4)"
+.LASF3:
+ .string "argv"
+ .ident "GCC: (GNU) 4.8.0 20121015 (experimental)"
+ .section .note.GNU-stack,"",@progbits

View File

@ -0,0 +1,156 @@
http://sourceware.org/ml/gdb-patches/2012-08/msg00562.html
Subject: [PATCH] Expand fortran array bounds sizes to LONGEST
--MP_/90J7bck2fqDySEX9JkZtaqL
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi,
Range bounds for a gdb type can have LONGEST values for low and high
bounds. Fortran range bounds functions however use only int. The larger
ranges don't compile by default on gcc, but it is possible to override
the check in the compiler by using -fno-range-check. As a result, this
check is necessary so that we don't print junk in case of an overflow.
Attached patch does this expansion and also includes a test case that
verifies that the problem is fixed. I have also verified on x86_64 that
this patch does not cause any regressions.
Regards,
Siddhesh
gdb/ChangeLog:
* f-lang.h (f77_get_upperbound): Return LONGEST.
(f77_get_lowerbound): Likewise.
* f-typeprint.c (f_type_print_varspec_suffix): Expand
UPPER_BOUND and LOWER_BOUND to LONGEST. Use plongest to format
print them.
(f_type_print_base): Expand UPPER_BOUND to LONGEST. Use
plongest to format print it.
* f-valprint.c (f77_get_lowerbound): Return LONGEST.
(f77_get_upperbound): Likewise.
(f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND,
LOWER_BOUND to LONGEST.
(f77_create_arrayprint_offset_tbl): Likewise.
testsuite/ChangeLog:
* gdb.fortran/array-bounds.exp: New test case.
* gdb.fortran/array-bounds.f: New test case.
--MP_/90J7bck2fqDySEX9JkZtaqL
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=f77-bounds.patch
Index: gdb-7.5.0.20120926/gdb/f-lang.h
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/f-lang.h 2012-11-07 22:12:39.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/f-lang.h 2012-11-07 22:52:02.688632498 +0100
@@ -66,9 +66,9 @@ enum f90_range_type
extern char *real_main_name; /* Name of main function. */
extern int real_main_c_value; /* C_value field of main function. */
-extern int f77_get_upperbound (struct type *);
+extern LONGEST f77_get_upperbound (struct type *);
-extern int f77_get_lowerbound (struct type *);
+extern LONGEST f77_get_lowerbound (struct type *);
extern void f77_get_dynamic_array_length (struct type *);
Index: gdb-7.5.0.20120926/gdb/f-typeprint.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/f-typeprint.c 2012-11-07 22:00:41.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/f-typeprint.c 2012-11-07 22:52:02.689632497 +0100
@@ -182,7 +182,7 @@ f_type_print_varspec_suffix (struct type
int show, int passed_a_ptr, int demangled_args,
int arrayprint_recurse_level)
{
- int upper_bound, lower_bound;
+ LONGEST upper_bound, lower_bound;
/* No static variables are permitted as an error call may occur during
execution of this function. */
@@ -212,7 +212,7 @@ f_type_print_varspec_suffix (struct type
lower_bound = f77_get_lowerbound (type);
if (lower_bound != 1) /* Not the default. */
- fprintf_filtered (stream, "%d:", lower_bound);
+ fprintf_filtered (stream, "%s:", plongest (lower_bound));
/* Make sure that, if we have an assumed size array, we
print out a warning and print the upperbound as '*'. */
@@ -222,7 +222,7 @@ f_type_print_varspec_suffix (struct type
else
{
upper_bound = f77_get_upperbound (type);
- fprintf_filtered (stream, "%d", upper_bound);
+ fprintf_filtered (stream, "%s", plongest (upper_bound));
}
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
@@ -291,7 +291,7 @@ void
f_type_print_base (struct type *type, struct ui_file *stream, int show,
int level)
{
- int upper_bound;
+ LONGEST upper_bound;
int index;
QUIT;
@@ -373,7 +373,7 @@ f_type_print_base (struct type *type, st
else
{
upper_bound = f77_get_upperbound (type);
- fprintf_filtered (stream, "character*%d", upper_bound);
+ fprintf_filtered (stream, "character*%s", plongest (upper_bound));
}
break;
Index: gdb-7.5.0.20120926/gdb/f-valprint.c
===================================================================
--- gdb-7.5.0.20120926.orig/gdb/f-valprint.c 2012-11-07 22:09:29.000000000 +0100
+++ gdb-7.5.0.20120926/gdb/f-valprint.c 2012-11-07 22:52:21.888604907 +0100
@@ -57,7 +57,7 @@ LONGEST f77_array_offset_tbl[MAX_FORTRAN
#define F77_DIM_BYTE_STRIDE(n) (f77_array_offset_tbl[n][0])
-int
+LONGEST
f77_get_lowerbound (struct type *type)
{
f_object_address_data_valid_or_error (type);
@@ -68,7 +68,7 @@ f77_get_lowerbound (struct type *type)
return TYPE_ARRAY_LOWER_BOUND_VALUE (type);
}
-int
+LONGEST
f77_get_upperbound (struct type *type)
{
f_object_address_data_valid_or_error (type);
@@ -92,8 +92,8 @@ f77_get_upperbound (struct type *type)
static void
f77_get_dynamic_length_of_aggregate (struct type *type)
{
- int upper_bound = -1;
- int lower_bound = 1;
+ LONGEST upper_bound = -1;
+ LONGEST lower_bound = 1;
/* Recursively go all the way down into a possibly multi-dimensional
F77 array and get the bounds. For simple arrays, this is pretty
@@ -128,7 +128,7 @@ f77_create_arrayprint_offset_tbl (struct
struct type *tmp_type;
LONGEST eltlen;
int ndimen = 1;
- int upper, lower;
+ LONGEST upper, lower;
tmp_type = type;

View File

@ -0,0 +1,425 @@
--- gdb-7.5.0.20120926-m64/gdb/value.c-orig 2012-11-09 17:08:52.137406118 +0100
+++ gdb-7.5.0.20120926-m64/gdb/value.c 2012-11-09 17:32:38.324199230 +0100
@@ -663,7 +663,6 @@ allocate_value_lazy (struct type *type)
description correctly. */
check_typedef (type);
- ulongest_fits_host_or_error (TYPE_LENGTH (type));
val = (struct value *) xzalloc (sizeof (struct value));
val->contents = NULL;
val->next = all_values;
--- /dev/null 2012-10-18 11:08:13.202328239 +0200
+++ gdb-7.5.0.20120926-m64-test/gdb/testsuite/gdb.base/longest-types.exp 2012-11-09 18:13:56.286587994 +0100
@@ -0,0 +1,59 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile .c longest-types-64bit.S
+
+proc test { name } { with_test_prefix $name {
+ # 64-bit array size should not overflow
+ gdb_test "print &f->buf" {= \(char \(\*\)\[1099494850560\]\) 0x0}
+
+ # The offset should not overflow
+ gdb_test "print &f->buf2" {= \(char \(\*\)\[2\]\) 0xffff000000}
+}}
+
+
+# Test 64-bit file first as it is not compiled so its compilation never fails.
+
+set file64bitbz2uu ${srcdir}/${subdir}/${testfile}-64bit.bz2.uu
+set file64bit ${objdir}/${subdir}/${testfile}-64bit
+
+if {[catch "system \"uudecode -o - ${file64bitbz2uu} | bzip2 -dc >${file64bit}\""] != 0} {
+ untested "failed uudecode or bzip2"
+ return -1
+}
+file stat ${file64bit} file64bitstat
+if {$file64bitstat(size) != 9501} {
+ untested "uudecode or bzip2 produce invalid result"
+ return -1
+}
+
+clean_restart ${file64bit}
+
+#if { [prepare_for_testing ${testfile}.exp ${testfile}-64bit $srcfile2 {nodebug}] } {
+# return -1
+#}
+
+test "64bit"
+
+
+# And here is the native build test.
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {debug quiet}] } {
+ return -1
+}
+
+test "native"
--- /dev/null 2012-10-18 11:08:13.202328239 +0200
+++ ./gdb/testsuite/gdb.base/longest-types.c 2012-11-09 17:08:51.374406344 +0100
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2012 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+struct foo
+{
+ char buf[0xffff000000];
+ char buf2[2];
+} *f;
+
+int
+main (void)
+{
+ return 0;
+}
--- /dev/null 2012-10-18 11:08:13.202328239 +0200
+++ ./gdb/testsuite/gdb.base/longest-types-64bit.S 2012-11-09 17:51:37.597846130 +0100
@@ -0,0 +1,249 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2012 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+ .file "longest-types-64bit.c"
+ .text
+.Ltext0:
+ .globl main
+main:
+ .comm f,8,8
+.Letext0:
+ .file 1 "gdb.base/longest-types-64bit.c"
+ .section .debug_info,"",@progbits
+.Ldebug_info0:
+ .4byte 0x9a /* Length of Compilation Unit Info */
+ .2byte 0x2 /* DWARF version number */
+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
+ .byte 0x8 /* Pointer Size (in bytes) */
+ .uleb128 0x1 /* (DIE (0xb) DW_TAG_compile_unit) */
+ .4byte .LASF3 /* DW_AT_producer: "GNU C 4.7.3 20121109 (prerelease)" */
+ .byte 0x1 /* DW_AT_language */
+ .4byte .LASF4 /* DW_AT_name: "gdb.base/longest-types-64bit.c" */
+ .4byte .LASF5 /* DW_AT_comp_dir: "" */
+ .4byte .Ldebug_line0 /* DW_AT_stmt_list */
+ .uleb128 0x2 /* (DIE (0x1d) DW_TAG_structure_type) */
+ .ascii "foo\0" /* DW_AT_name */
+ .4byte 0xff000002 /* DW_AT_byte_size */
+ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */
+ .byte 0x12 /* DW_AT_decl_line */
+ .4byte 0x4e /* DW_AT_sibling */
+ .uleb128 0x3 /* (DIE (0x2c) DW_TAG_member) */
+ .ascii "buf\0" /* DW_AT_name */
+ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */
+ .byte 0x14 /* DW_AT_decl_line */
+ .4byte 0x4e /* DW_AT_type */
+ .byte 0x2 /* DW_AT_data_member_location */
+ .byte 0x23 /* DW_OP_plus_uconst */
+ .uleb128 0
+ .uleb128 0x4 /* (DIE (0x3a) DW_TAG_member) */
+ .4byte .LASF0 /* DW_AT_name: "buf2" */
+ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */
+ .byte 0x15 /* DW_AT_decl_line */
+ .4byte 0x73 /* DW_AT_type */
+ .byte 0x7 /* DW_AT_data_member_location */
+ .byte 0x23 /* DW_OP_plus_uconst */
+ .uleb128 0xffff000000
+ .byte 0 /* end of children of DIE 0x1d */
+ .uleb128 0x5 /* (DIE (0x4e) DW_TAG_array_type) */
+ .4byte 0x6c /* DW_AT_type */
+ .4byte 0x65 /* DW_AT_sibling */
+ .uleb128 0x6 /* (DIE (0x57) DW_TAG_subrange_type) */
+ .4byte 0x65 /* DW_AT_type */
+ .quad 0xfffeffffff /* DW_AT_upper_bound */
+ .byte 0 /* end of children of DIE 0x4e */
+ .uleb128 0x7 /* (DIE (0x65) DW_TAG_base_type) */
+ .byte 0x8 /* DW_AT_byte_size */
+ .byte 0x7 /* DW_AT_encoding */
+ .4byte .LASF1 /* DW_AT_name: "sizetype" */
+ .uleb128 0x7 /* (DIE (0x6c) DW_TAG_base_type) */
+ .byte 0x1 /* DW_AT_byte_size */
+ .byte 0x6 /* DW_AT_encoding */
+ .4byte .LASF2 /* DW_AT_name: "char" */
+ .uleb128 0x5 /* (DIE (0x73) DW_TAG_array_type) */
+ .4byte 0x6c /* DW_AT_type */
+ .4byte 0x83 /* DW_AT_sibling */
+ .uleb128 0x8 /* (DIE (0x7c) DW_TAG_subrange_type) */
+ .4byte 0x65 /* DW_AT_type */
+ .byte 0x1 /* DW_AT_upper_bound */
+ .byte 0 /* end of children of DIE 0x73 */
+ .uleb128 0x9 /* (DIE (0x83) DW_TAG_variable) */
+ .ascii "f\0" /* DW_AT_name */
+ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */
+ .byte 0x16 /* DW_AT_decl_line */
+ .4byte 0x97 /* DW_AT_type */
+ .byte 0x1 /* DW_AT_external */
+ .byte 0x9 /* DW_AT_location */
+ .byte 0x3 /* DW_OP_addr */
+ .quad f
+ .uleb128 0xa /* (DIE (0x97) DW_TAG_pointer_type) */
+ .byte 0x8 /* DW_AT_byte_size */
+ .4byte 0x1d /* DW_AT_type */
+ .byte 0 /* end of children of DIE 0xb */
+ .section .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+ .uleb128 0x1 /* (abbrev code) */
+ .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x25 /* (DW_AT_producer) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x13 /* (DW_AT_language) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x1b /* (DW_AT_comp_dir) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x10 /* (DW_AT_stmt_list) */
+ .uleb128 0x6 /* (DW_FORM_data4) */
+ .byte 0
+ .byte 0
+ .uleb128 0x2 /* (abbrev code) */
+ .uleb128 0x13 /* (TAG: DW_TAG_structure_type) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0xb /* (DW_AT_byte_size) */
+ .uleb128 0x6 /* (DW_FORM_data4) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x1 /* (DW_AT_sibling) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0
+ .byte 0
+ .uleb128 0x3 /* (abbrev code) */
+ .uleb128 0xd /* (TAG: DW_TAG_member) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x38 /* (DW_AT_data_member_location) */
+ .uleb128 0xa /* (DW_FORM_block1) */
+ .byte 0
+ .byte 0
+ .uleb128 0x4 /* (abbrev code) */
+ .uleb128 0xd /* (TAG: DW_TAG_member) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x38 /* (DW_AT_data_member_location) */
+ .uleb128 0xa /* (DW_FORM_block1) */
+ .byte 0
+ .byte 0
+ .uleb128 0x5 /* (abbrev code) */
+ .uleb128 0x1 /* (TAG: DW_TAG_array_type) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x1 /* (DW_AT_sibling) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0
+ .byte 0
+ .uleb128 0x6 /* (abbrev code) */
+ .uleb128 0x21 /* (TAG: DW_TAG_subrange_type) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x2f /* (DW_AT_upper_bound) */
+ .uleb128 0x7 /* (DW_FORM_data8) */
+ .byte 0
+ .byte 0
+ .uleb128 0x7 /* (abbrev code) */
+ .uleb128 0x24 /* (TAG: DW_TAG_base_type) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0xb /* (DW_AT_byte_size) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3e /* (DW_AT_encoding) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0xe /* (DW_FORM_strp) */
+ .byte 0
+ .byte 0
+ .uleb128 0x8 /* (abbrev code) */
+ .uleb128 0x21 /* (TAG: DW_TAG_subrange_type) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x2f /* (DW_AT_upper_bound) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .byte 0
+ .byte 0
+ .uleb128 0x9 /* (abbrev code) */
+ .uleb128 0x34 /* (TAG: DW_TAG_variable) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x3f /* (DW_AT_external) */
+ .uleb128 0xc /* (DW_FORM_flag) */
+ .uleb128 0x2 /* (DW_AT_location) */
+ .uleb128 0xa /* (DW_FORM_block1) */
+ .byte 0
+ .byte 0
+ .uleb128 0xa /* (abbrev code) */
+ .uleb128 0xf /* (TAG: DW_TAG_pointer_type) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0xb /* (DW_AT_byte_size) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0
+ .byte 0
+ .byte 0
+ .section .debug_aranges,"",@progbits
+ .4byte 0x1c /* Length of Address Ranges Info */
+ .2byte 0x2 /* DWARF Version */
+ .4byte .Ldebug_info0 /* Offset of Compilation Unit Info */
+ .byte 0x8 /* Size of Address */
+ .byte 0 /* Size of Segment Descriptor */
+ .2byte 0 /* Pad to 16 byte boundary */
+ .2byte 0
+ .quad 0
+ .quad 0
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .section .debug_str,"MS",@progbits,1
+.LASF4:
+ .string "gdb.base/longest-types-64bit.c"
+.LASF3:
+ .string "GNU C 4.7.3 20121109 (prerelease)"
+.LASF0:
+ .string "buf2"
+.LASF1:
+ .string "sizetype"
+.LASF5:
+ .string ""
+.LASF2:
+ .string "char"
+ .ident "GCC: (GNU) 4.7.3 20121109 (prerelease)"
+ .section .note.GNU-stack,"",@progbits
--- /dev/null 2012-10-18 11:08:13.202328239 +0200
+++ gdb-7.5.0.20120926-m64-test/gdb/testsuite/gdb.base/longest-types-64bit.bz2.uu 2012-11-09 18:04:52.995692771 +0100
@@ -0,0 +1,67 @@
+begin 755 gdb.base/longest-types-64bit.bz2
+M0EIH.3%!62936<'N#OH`"G/________^______?_Y______//]7SQD5'^/_%
+M=VY7?F_[X`F]]SG7531-==V:Z-.FW;M.U7=';:UH@<&FD31,E3]J'HE-/TR@
+M]4_5/32;%/U3]1--HU/U$#$R'I'J,FC0T-,)B'J#:CU,F@]0`/4:>F@CU/4,
+MA@$S2>IH!H`TR/0-$$:9`C(&FHU3VE-J;4\%,@>4T:#]49-J/4`>HT!H#3)^
+MJ`!H-``T]0&@-```:'J``&@`:9!`R9,@&3(`#3!#0!H``-#$--`,@``T`T#(
+M:`:`&0&@::,0:-```:``-`E-$1#4-3:4]3R9-39(Q/)#3R-30:9#$T!D!H&@
+M,CTGI!H#(#0T`#0``T`T`:``-``T`0,F3(!DR``TP0T`:``#0Q#30#(``-`-
+M`R&@&@!D!H&FC$&C0``&@`#0)%)H32>JGZ&!)Z1B1X@)DTVC4>H`&0:``R&@
+M,C0:``T``,C0``!H``#(`T`:#0U^\?]7K8M.96V/2[?M*DC)>WIUF)H7T\<T
+M[0D)70G25.YB!,:;8Q(;&XPAB4+$Q%:P)PA-;E=!-&$KNR22EM>$:KKRE&\Q
+M..M]L1*,!>D!X)RW,[,1I,9N%X-N&2+*:&)DJY4(VFQG%9K[/?J06WACF6-I
+MJ&JJ9,ZK4;X28M@[==%ME(A54:%>+3->MRK(G!8#TY>@E$6DR&<_5:C&/RZE
+MI<ON+RY5`LA"@DD$$DF!I9O]5X%G985_=V<.;?K9:G2R-#K<CB,1;26A<H4G
+M3R3I!)WX,-%>,!E6#`;*8R*E@++*))U)[6=OKFM%'+$-H5\X@1D)_Y*"NKV.
+M&\F8?SXW^<O]_DW.8WD@HY.NMMIBXFVROM_SKZ#4-`>HQ:Y@(Q[.>PEG=]@^
+M%C"3EZ/1X'H*02ZQH":6"@;8Z0LEW6<OKJ%$`01%`B;O!N*W1V.HC$``,:CS
+M6(/OTI'-:O6=7$/#?0T9Q[GSY1)6V`+CV@#XWMF`<S:AG<!43X"VGD,E=>)>
+M6^V=*`FB'5G4MD8L3J5XT#SW;J1]ZO+"SPIS%J(P46+Q=CC2$H-`-B&TD)M`
+M&A:066DA%AB0C6,460>M8B+$:-BR&@NM()F`S',,F8+#&0.SMOK@.G<'83N.
+MDA"#5-`JVC("1*TA;/M()&8J0+YH%IFV)+OA@4,`E?3M$[$@&Q`3]A!$&A(-
+M$PBT+2,@PU+2H9(T-H3N6'(2;""%2T*1I2P@`L?AG8&A!=31J7)1(9FB'8X=
+MWJ0S#YEG9K$.#.[L.[CNA"4JSJ^GK2*)UH=MC0.R8+E75'.09<NU&R0G1>[G
+MMQ1*[GI:>#>K`_NZS:V6>$K;OX6#!!N'"2413$DTL&]7KY>B<3V5!!C8#X5+
+MF%9<N\]C%B6OS;LH@1LR3R<LS+<]N]9\JZ<LJ#2_S2'UW('DZ!N>X!8NOKM5
+M+"N&P4.75C16!A9Q;:C.6N`WZDV=-]!<BTB<1Q*P(T4'&*2:@$=J@(M8)!5=
+MO;[ECS>,5PG<T[XC594XI0@RVPD86,M11%(T>]SNP[GV^L?YGI]7_'D8N?XV
+M'[7KZJWYVMXGBQS[`!)YI%3:D)I2!;%'R`W&YB<`9O2#F"C/)F;JK9P+@3&(
+MAH31[W)=YCODQDUKNM7A"3.C!2%CHTJNZ"Z\+#F-?(DLE>XAC%07B8;$%J_L
+MJPK48QC&,916=IM+<1&WRKLB6&Q2O79*!7S$,`7J8*!`!=K:5W550[NH9M#_
+MKL!LT,&;59GZW7S"5Z4%`%&!`9"J9`0:IR&H=MTKT=PEYC$,4K90M9AT'%;_
+MB0HVLE)(W&YWF,C:TURXO:`M[RX(A-GT97456Q4Z*HPU*4J:*[WU-4GD.9UV
+MSA#L4X[[*Y+)8IF.EO<.TP4IC2?(4HX)W1#:GOMOD2F;HM1BV#<E%PM+0&N5
+MP@$\$FD4C-Q^L"H^)NP2-.^JTT!8+!;'Z=KM7%'K@\)*PSETF&M6<Q#>;PH[
+M7:PJ-!#,!6N<3')-0C,>15'IZ>@U^CJJJ+>+>%%)%BBATD\)*F6&BLMIR&?\
+MQ2_?33@"NR1/CN\:)>5DG6`>$;$3QA94'-3]*CU6YG])<=2)'GC"RP-RK&-3
+MZDT-M_)R+F06DS?CR>E@^!,33"U6X<@OXO$Q>U$\T@IU<H-42=0YE[$,T`\H
+M('>'@T=>K`G7H8K5GLXMS3*^@JLVBHHE'.&?9RKC?Y`&&3J5!/C$++<@U#Q'
+M9R3I.$+S`%]-.UO>WH^C73F<&;RIJR+(Q@7(3PP*W[-O,,DD3S7BUK^I@D%*
+M`Y<*2TXJ&7;2'6'R.U>]0-="M`K+&N%/==N4U@9%@M1)U&251C($^S"WL"]T
+M-XN'D2[II3-$K%+&`3['O)%,8G*E%_8RV6A5B_4(2/?-AIC.\/>,YFJ<(G.8
+MAVP?UN*=ME:7&T!C%)I:&4H:-5>&^!&0>A.O'0G'/6&ZZ964@04&=#DC`%&:
+MUNLOS?,?'T:T!8L80<H_W1>='M:96K4;JX)6.('1#J$.1/L)$IS<4/*'2D34
+M/@J\BA(I2T40JS%9G8F!7U5_!#'U!+[7$ES&)@:*QAET-IBX6'_N5^7/#>@V
+MN3&,-6(AG[8&!8LV+F_U"W?/)+Y^,;=1K:SW28<0WA2"UPHP^8FG#R$!`Y`,
+MLF<`U*NNU\[6N03"*?I8D=K7.Z*H=A_3<H1Z%.Q8%2SR@I45('.EGR<N^\`Z
+M\[Z\D+/3>7;S=LVC(BQ,5<M0A"#`]7UK7W3%5(:FBMER3XSP15N!)`-^ZJZ%
+M:4)>8Q_\#G`'P*_-]T!G4$`V0BS]'S)D/;V7R?.2F?SF)N+2+#P2_<G#1B)C
+M(8?NF/+?:UMR3B#9$MBDCI2G7&N'T`FV!ERQ[21DOJ_8I73#BILTTSK)B5P<
+MG22S=*7TI>G(49TCE&*UIVT-MP808VTVV-$(*`VT<%>%96AHOL`(7%SI2%-R
+M#G2F02VQQH-7KT3E05I9Z)E\$Y8ED1KU`(4QHT%B]1$F:F1&8DAN.Q4&*?F@
+M.8D965.$PRH<VD+()"8&I%<R"P,Y[A,)^B(O%1(J%,)M(O6)8E%LY?C6X@@K
+M(F!2TA\,RE<O"E2*G?JE2YF\*OJM?$KWXW6R(3LR-)W.[:ZJC?ZE4,("J$()
+M5@U!62M"WBJ=&Q(L$5,4494K=.0B0#,C3$*``XLTF$DN!6P#%,4K%HTIC[*O
+M6"4S,;RN&@=NP7@72:=U#&JPBQ-60OEAWY;CUYF+$73.R>T5HD,G=G!KTF3D
+M94"&ZA-F,.19=8`\(Q;A07Q%!19*3#*F9Q+D(0K@V87@O.=7EJIM6`!4`>D!
+M)49QHA!BV+:4O@K00$$!5*6>A@2@4D)@R\"%$2F"O:24J*L(RP#N;O4K7I&2
+M[#)KR47H-N[<O^S-)"_Q\>VJ%3>$`9,AF8QID&I3G+D`*]BX98B$2K":A7_\
+M_]7LT!4,$NL5)NE>9[:MK2_/'GO:7"P`=<X'"U9""0<PJ`3`.:*(Z]-.GQ,9
+M>P(\L]O?"-APH(834$,W!IJS+U1F1C.!D$!&KS^-6%F90PQ[F]F=$^QE\X+-
+M@.W*LPH_78B>MHH@69RU[*'1J@8QAC\KSV@IG\(;_CUW:ZR2.,0$E3LZ_^P=
+M<_DCP"Q<`;+_;YP#^U%&E^#2M%,T?F3UN^>TSH)GFL"\%RF[KNZ+[R+@<&.$
+MC42)B96\1-.O_I).K7)X]W>EQ):4C(XB*+:S%0_37D^EBP+1HU(D?3"%_O2R
+M6-#X>AU#<$*!/,W6QC^;O^%]LR&_X'<8X$<3CUU_QFAJ;">H)2443GD4W!4#
+?<55!2^6_8J$)-O<>\H0U/6Q^>UG0%W)%.%"0P>X.^@``
+`
+end

View File

@ -34,7 +34,7 @@ Version: 7.5.0.20120926
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 25%{?dist}
Release: 26%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain
Group: Development/Debuggers
@ -577,6 +577,31 @@ Patch728: gdb-check-type.patch
# entry values: Fix resolving in inlined frames.
Patch729: gdb-entryval-inlined.patch
# Fix `GDB cannot access struct member whose offset is larger than 256MB'
# (RH BZ 795424).
Patch797: gdb-rhbz795424-bitpos-06of25.patch
Patch798: gdb-rhbz795424-bitpos-07of25.patch
Patch799: gdb-rhbz795424-bitpos-08of25.patch
Patch800: gdb-rhbz795424-bitpos-09of25.patch
Patch801: gdb-rhbz795424-bitpos-10of25.patch
Patch802: gdb-rhbz795424-bitpos-11of25.patch
Patch803: gdb-rhbz795424-bitpos-12of25.patch
Patch804: gdb-rhbz795424-bitpos-13of25.patch
Patch805: gdb-rhbz795424-bitpos-14of25.patch
Patch806: gdb-rhbz795424-bitpos-15of25.patch
Patch807: gdb-rhbz795424-bitpos-16of25.patch
Patch808: gdb-rhbz795424-bitpos-17of25.patch
Patch809: gdb-rhbz795424-bitpos-18of25.patch
Patch810: gdb-rhbz795424-bitpos-19of25.patch
Patch811: gdb-rhbz795424-bitpos-20of25.patch
Patch812: gdb-rhbz795424-bitpos-21of25.patch
Patch813: gdb-rhbz795424-bitpos-22of25.patch
Patch814: gdb-rhbz795424-bitpos-23of25.patch
Patch815: gdb-rhbz795424-bitpos-24of25.patch
Patch816: gdb-rhbz795424-bitpos-25of25.patch
Patch817: gdb-rhbz795424-bitpos-25of25-test.patch
Patch818: gdb-rhbz795424-bitpos-lazyvalue.patch
%if 0%{!?rhel:1} || 0%{?rhel} > 6
# RL_STATE_FEDORA_GDB would not be found for:
# Patch642: gdb-readline62-ask-more-rh.patch
@ -889,6 +914,28 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c gdb/go-exp.c
%patch726 -p1
%patch728 -p1
%patch729 -p1
%patch797 -p1
%patch798 -p1
%patch799 -p1
%patch800 -p1
%patch801 -p1
%patch802 -p1
%patch803 -p1
%patch804 -p1
%patch805 -p1
%patch806 -p1
%patch807 -p1
%patch808 -p1
%patch809 -p1
%patch810 -p1
%patch811 -p1
%patch812 -p1
%patch813 -p1
%patch814 -p1
%patch815 -p1
%patch816 -p1
%patch817 -p1
%patch818 -p1
%patch393 -p1
%if 0%{!?el5:1} || 0%{?scl:1}
@ -1385,6 +1432,10 @@ fi
%endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch"
%changelog
* Fri Nov 9 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.5.0.20120926-26.fc18
- Fix `GDB cannot access struct member whose offset is larger than 256MB'
(RH BZ 871066).
* Fri Oct 5 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.5.0.20120926-25.fc18
- entry values: Fix resolving in inlined frames.