From 859e1355cfa562d2aaa52c426f1c1b9b69536bb6 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Thu, 11 Jun 2009 21:52:56 +0000 Subject: [PATCH] - Archer update to the snapshot: 30c13da4efe18f43ee34aa4b29bc86e1a53de548 - Archer backport: 30c13da4efe18f43ee34aa4b29bc86e1a53de548 - Fix dereferencing unbound C arrays (BZ 505163). --- gdb-archer.patch | 104 +++++++++++++++++++++++++++++------------------ gdb.spec | 7 +++- 2 files changed, 71 insertions(+), 40 deletions(-) diff --git a/gdb-archer.patch b/gdb-archer.patch index 357c645..5ebfeae 100644 --- a/gdb-archer.patch +++ b/gdb-archer.patch @@ -2,7 +2,7 @@ http://sourceware.org/gdb/wiki/ProjectArcher http://sourceware.org/gdb/wiki/ArcherBranchManagement GIT snapshot: -commit 000db8b7bfef8581ef099ccca8689cfddfea1be8 +commit 30c13da4efe18f43ee34aa4b29bc86e1a53de548 branch `archer' - the merge of branches: archer-jankratochvil-merge-expr @@ -20139,7 +20139,7 @@ index 3a405a8..a2e2636 100644 once for each known thread. */ typedef int (*thread_callback_func) (struct thread_info *, void *); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c -index 8102321..012485c 100644 +index 8102321..9899727 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -38,6 +38,8 @@ @@ -20345,17 +20345,7 @@ index 8102321..012485c 100644 if (low_bound >= 0) TYPE_UNSIGNED (result_type) = 1; -@@ -727,6 +769,9 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp) - switch (TYPE_CODE (type)) - { - case TYPE_CODE_RANGE: -+ if (TYPE_RANGE_UPPER_BOUND_IS_UNDEFINED (type) -+ || TYPE_RANGE_LOWER_BOUND_IS_UNDEFINED (type)) -+ return -1; - *lowp = TYPE_LOW_BOUND (type); - *highp = TYPE_HIGH_BOUND (type); - return 1; -@@ -805,30 +850,56 @@ create_array_type (struct type *result_type, +@@ -805,30 +847,56 @@ create_array_type (struct type *result_type, if (result_type == NULL) { @@ -20426,7 +20416,7 @@ index 8102321..012485c 100644 return (result_type); } -@@ -865,7 +936,12 @@ create_set_type (struct type *result_type, struct type *domain_type) +@@ -865,7 +933,12 @@ create_set_type (struct type *result_type, struct type *domain_type) { if (result_type == NULL) { @@ -20440,7 +20430,7 @@ index 8102321..012485c 100644 } TYPE_CODE (result_type) = TYPE_CODE_SET; TYPE_NFIELDS (result_type) = 1; -@@ -1368,6 +1444,84 @@ stub_noname_complaint (void) +@@ -1368,6 +1441,84 @@ stub_noname_complaint (void) complaint (&symfile_complaints, _("stub type has NULL name")); } @@ -20525,7 +20515,7 @@ index 8102321..012485c 100644 /* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989. If this is a stubbed struct (i.e. declared as struct foo *), see if -@@ -1384,7 +1538,8 @@ stub_noname_complaint (void) +@@ -1384,7 +1535,8 @@ stub_noname_complaint (void) /* Find the real type of TYPE. This function returns the real type, after removing all layers of typedefs and completing opaque or stub types. Completion changes the TYPE argument, but stripping of @@ -20535,7 +20525,7 @@ index 8102321..012485c 100644 struct type * check_typedef (struct type *type) -@@ -1420,7 +1575,7 @@ check_typedef (struct type *type) +@@ -1420,7 +1572,7 @@ check_typedef (struct type *type) if (sym) TYPE_TARGET_TYPE (type) = SYMBOL_TYPE (sym); else /* TYPE_CODE_UNDEF */ @@ -20544,7 +20534,7 @@ index 8102321..012485c 100644 } type = TYPE_TARGET_TYPE (type); } -@@ -1494,34 +1649,37 @@ check_typedef (struct type *type) +@@ -1494,34 +1646,37 @@ check_typedef (struct type *type) } } @@ -20600,7 +20590,7 @@ index 8102321..012485c 100644 TYPE_TARGET_STUB (type) = 0; } else if (TYPE_CODE (type) == TYPE_CODE_RANGE) -@@ -1529,9 +1687,12 @@ check_typedef (struct type *type) +@@ -1529,9 +1684,12 @@ check_typedef (struct type *type) TYPE_LENGTH (type) = TYPE_LENGTH (target_type); TYPE_TARGET_STUB (type) = 0; } @@ -20613,7 +20603,7 @@ index 8102321..012485c 100644 return type; } -@@ -1753,7 +1914,7 @@ init_type (enum type_code code, int length, int flags, +@@ -1753,7 +1911,7 @@ init_type (enum type_code code, int length, int flags, { struct type *type; @@ -20622,7 +20612,7 @@ index 8102321..012485c 100644 TYPE_CODE (type) = code; TYPE_LENGTH (type) = length; -@@ -1783,15 +1944,24 @@ init_type (enum type_code code, int length, int flags, +@@ -1783,15 +1941,24 @@ init_type (enum type_code code, int length, int flags, if (flags & TYPE_FLAG_FIXED_INSTANCE) TYPE_FIXED_INSTANCE (type) = 1; @@ -20656,7 +20646,7 @@ index 8102321..012485c 100644 /* C++ fancies. */ -@@ -1803,6 +1973,10 @@ init_type (enum type_code code, int length, int flags, +@@ -1803,6 +1970,10 @@ init_type (enum type_code code, int length, int flags, { INIT_CPLUS_SPECIFIC (type); } @@ -20667,7 +20657,7 @@ index 8102321..012485c 100644 return (type); } -@@ -2916,33 +3090,47 @@ type_pair_eq (const void *item_lhs, const void *item_rhs) +@@ -2916,33 +3087,47 @@ type_pair_eq (const void *item_lhs, const void *item_rhs) } /* Allocate the hash table used by copy_type_recursive to walk @@ -20730,7 +20720,7 @@ index 8102321..012485c 100644 return type; /* This type shouldn't be pointing to any types in other objfiles; -@@ -2954,11 +3142,15 @@ copy_type_recursive (struct objfile *objfile, +@@ -2954,11 +3139,15 @@ copy_type_recursive (struct objfile *objfile, if (*slot != NULL) return ((struct type_pair *) *slot)->new; @@ -20749,7 +20739,7 @@ index 8102321..012485c 100644 stored->old = type; stored->new = new_type; *slot = stored; -@@ -2968,6 +3160,13 @@ copy_type_recursive (struct objfile *objfile, +@@ -2968,6 +3157,13 @@ copy_type_recursive (struct objfile *objfile, *TYPE_MAIN_TYPE (new_type) = *TYPE_MAIN_TYPE (type); TYPE_OBJFILE (new_type) = NULL; @@ -20763,7 +20753,7 @@ index 8102321..012485c 100644 if (TYPE_NAME (type)) TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type)); if (TYPE_TAG_NAME (type)) -@@ -2976,12 +3175,45 @@ copy_type_recursive (struct objfile *objfile, +@@ -2976,12 +3172,45 @@ copy_type_recursive (struct objfile *objfile, TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type); TYPE_LENGTH (new_type) = TYPE_LENGTH (type); @@ -20809,7 +20799,7 @@ index 8102321..012485c 100644 TYPE_FIELDS (new_type) = XCALLOC (nfields, struct field); for (i = 0; i < nfields; i++) { -@@ -2990,8 +3222,8 @@ copy_type_recursive (struct objfile *objfile, +@@ -2990,8 +3219,8 @@ copy_type_recursive (struct objfile *objfile, TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i); if (TYPE_FIELD_TYPE (type, i)) TYPE_FIELD_TYPE (new_type, i) @@ -20820,7 +20810,7 @@ index 8102321..012485c 100644 if (TYPE_FIELD_NAME (type, i)) TYPE_FIELD_NAME (new_type, i) = xstrdup (TYPE_FIELD_NAME (type, i)); -@@ -3010,6 +3242,16 @@ copy_type_recursive (struct objfile *objfile, +@@ -3010,6 +3239,16 @@ copy_type_recursive (struct objfile *objfile, xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type, i))); break; @@ -20837,7 +20827,7 @@ index 8102321..012485c 100644 default: internal_error (__FILE__, __LINE__, _("Unexpected type field location kind: %d"), -@@ -3018,17 +3260,32 @@ copy_type_recursive (struct objfile *objfile, +@@ -3018,17 +3257,32 @@ copy_type_recursive (struct objfile *objfile, } } @@ -20876,7 +20866,7 @@ index 8102321..012485c 100644 /* Maybe copy the type_specific bits. NOTE drow/2005-12-09: We do not copy the C++-specific bits like -@@ -3046,6 +3303,20 @@ copy_type_recursive (struct objfile *objfile, +@@ -3046,6 +3300,20 @@ copy_type_recursive (struct objfile *objfile, return new_type; } @@ -20897,7 +20887,7 @@ index 8102321..012485c 100644 /* Make a copy of the given TYPE, except that the pointer & reference types are not preserved. -@@ -3059,7 +3330,7 @@ copy_type (const struct type *type) +@@ -3059,7 +3327,7 @@ copy_type (const struct type *type) gdb_assert (TYPE_OBJFILE (type) != NULL); @@ -20906,7 +20896,7 @@ index 8102321..012485c 100644 TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type); TYPE_LENGTH (new_type) = TYPE_LENGTH (type); memcpy (TYPE_MAIN_TYPE (new_type), TYPE_MAIN_TYPE (type), -@@ -3068,6 +3339,232 @@ copy_type (const struct type *type) +@@ -3068,6 +3336,232 @@ copy_type (const struct type *type) return new_type; } @@ -21139,7 +21129,7 @@ index 8102321..012485c 100644 static struct type * build_flt (int bit, char *name, const struct floatformat **floatformats) { -@@ -3105,7 +3602,7 @@ build_complex (int bit, char *name, struct type *target_type) +@@ -3105,7 +3599,7 @@ build_complex (int bit, char *name, struct type *target_type) return builtin_type_error; } t = init_type (TYPE_CODE_COMPLEX, 2 * bit / TARGET_CHAR_BIT, @@ -21148,7 +21138,7 @@ index 8102321..012485c 100644 TYPE_TARGET_TYPE (t) = target_type; return t; } -@@ -3119,56 +3616,56 @@ gdbtypes_post_init (struct gdbarch *gdbarch) +@@ -3119,56 +3613,56 @@ gdbtypes_post_init (struct gdbarch *gdbarch) builtin_type->builtin_void = init_type (TYPE_CODE_VOID, 1, 0, @@ -21217,7 +21207,7 @@ index 8102321..012485c 100644 builtin_type->builtin_float = build_flt (gdbarch_float_bit (gdbarch), "float", gdbarch_float_format (gdbarch)); -@@ -3187,26 +3684,26 @@ gdbtypes_post_init (struct gdbarch *gdbarch) +@@ -3187,26 +3681,26 @@ gdbtypes_post_init (struct gdbarch *gdbarch) builtin_type->builtin_string = init_type (TYPE_CODE_STRING, TARGET_CHAR_BIT / TARGET_CHAR_BIT, 0, @@ -21249,7 +21239,7 @@ index 8102321..012485c 100644 /* Pointer/Address types. */ -@@ -3245,27 +3742,28 @@ gdbtypes_post_init (struct gdbarch *gdbarch) +@@ -3245,27 +3739,28 @@ gdbtypes_post_init (struct gdbarch *gdbarch) init_type (TYPE_CODE_INT, gdbarch_addr_bit (gdbarch) / 8, TYPE_FLAG_UNSIGNED, @@ -21283,7 +21273,7 @@ index 8102321..012485c 100644 return builtin_type; } -@@ -3276,6 +3774,9 @@ _initialize_gdbtypes (void) +@@ -3276,6 +3771,9 @@ _initialize_gdbtypes (void) { gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init); @@ -21293,7 +21283,7 @@ index 8102321..012485c 100644 /* FIXME: The following types are architecture-neutral. However, they contain pointer_type and reference_type fields potentially caching pointer or reference types that *are* architecture -@@ -3284,47 +3785,47 @@ _initialize_gdbtypes (void) +@@ -3284,47 +3782,47 @@ _initialize_gdbtypes (void) builtin_type_int0 = init_type (TYPE_CODE_INT, 0 / 8, 0, @@ -21352,7 +21342,7 @@ index 8102321..012485c 100644 builtin_type_ieee_single = build_flt (-1, "builtin_type_ieee_single", floatformats_ieee_single); -@@ -3344,15 +3845,15 @@ _initialize_gdbtypes (void) +@@ -3344,15 +3842,15 @@ _initialize_gdbtypes (void) builtin_type_void = init_type (TYPE_CODE_VOID, 1, 0, @@ -35665,6 +35655,42 @@ index 9f382db..12db521 100644 MISCELLANEOUS = coremmap.data ../foobar.baz \ shr1.sl shr2.sl solib_sl.sl solib1.sl solib2.sl +diff --git a/gdb/testsuite/gdb.base/arrayidx.c b/gdb/testsuite/gdb.base/arrayidx.c +index 98d4d35..f98a656 100644 +--- a/gdb/testsuite/gdb.base/arrayidx.c ++++ b/gdb/testsuite/gdb.base/arrayidx.c +@@ -17,6 +17,13 @@ + + int array[] = {1, 2, 3, 4}; + ++#ifdef __GNUC__ ++struct ++ { ++ int a[0]; ++ } unbound; ++#endif ++ + int + main (void) + { +diff --git a/gdb/testsuite/gdb.base/arrayidx.exp b/gdb/testsuite/gdb.base/arrayidx.exp +index 71ce4aa..af0e5f8 100644 +--- a/gdb/testsuite/gdb.base/arrayidx.exp ++++ b/gdb/testsuite/gdb.base/arrayidx.exp +@@ -59,4 +59,12 @@ gdb_test "print array" \ + "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \ + "Print array with array-indexes on" + +- ++set test "p unbound.a == &unbound.a\[0\]" ++gdb_test_multiple $test $test { ++ -re " = 1\r\n$gdb_prompt $" { ++ pass $test ++ } ++ -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" { ++ unsupported "$test (no GCC)" ++ } ++} diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp index 3359c70..f73dd7f 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.exp diff --git a/gdb.spec b/gdb.spec index 8b7c82e..03c8683 100644 --- a/gdb.spec +++ b/gdb.spec @@ -15,7 +15,7 @@ Version: 6.8.50.20090302 # 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: 28%{?_with_upstream:.upstream}%{?dist} +Release: 29%{?_with_upstream:.upstream}%{?dist} License: GPLv3+ Group: Development/Debuggers @@ -887,6 +887,11 @@ fi %endif %changelog +* Thu Jun 11 2009 Jan Kratochvil - 6.8.50.20090302-29 +- Archer update to the snapshot: 30c13da4efe18f43ee34aa4b29bc86e1a53de548 +- Archer backport: 30c13da4efe18f43ee34aa4b29bc86e1a53de548 + - Fix dereferencing unbound C arrays (BZ 505163). + * Wed Jun 10 2009 Jan Kratochvil - 6.8.50.20090302-28 - Archer update to the snapshot: 000db8b7bfef8581ef099ccca8689cfddfea1be8 - Archer backport: b8d3bea36b137effc929e02c4dadf73716cb330b