diff --git a/gdb-upstream.patch b/gdb-upstream.patch index 028fe7a..058f4d9 100644 --- a/gdb-upstream.patch +++ b/gdb-upstream.patch @@ -65,3 +65,310 @@ index 0e0202d..d849b4c 100644 # gdbserver does not have this issue. if ![is_remote target] { setup_kfail "*-*-*" gdb/15934 + + + +commit cac9b138f75c94c1256d054cbafdf208b8963ce1 +Author: Jan Kratochvil +Date: Mon Nov 24 18:05:04 2014 +0100 + + Reindent code (resolve_dynamic_type_internal). + + gdb/ChangeLog + 2014-11-24 Jan Kratochvil + + * gdbtypes.c (resolve_dynamic_type_internal): Reindent the code. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,7 @@ ++2014-11-24 Jan Kratochvil ++ ++ * gdbtypes.c (resolve_dynamic_type_internal): Reindent the code. ++ + 2014-11-24 Samuel Thibault + + Pushed by Joel Brobecker +--- a/gdb/gdbtypes.c ++++ b/gdb/gdbtypes.c +@@ -1877,31 +1877,31 @@ resolve_dynamic_type_internal (struct type *type, CORE_ADDR addr, + + switch (TYPE_CODE (type)) + { +- case TYPE_CODE_TYPEDEF: ++ case TYPE_CODE_TYPEDEF: ++ resolved_type = copy_type (type); ++ TYPE_TARGET_TYPE (resolved_type) ++ = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), addr, ++ top_level); ++ break; ++ ++ case TYPE_CODE_REF: ++ { ++ CORE_ADDR target_addr = read_memory_typed_address (addr, type); ++ + resolved_type = copy_type (type); + TYPE_TARGET_TYPE (resolved_type) +- = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), addr, +- top_level); ++ = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), ++ target_addr, top_level); + break; ++ } + +- case TYPE_CODE_REF: +- { +- CORE_ADDR target_addr = read_memory_typed_address (addr, type); +- +- resolved_type = copy_type (type); +- TYPE_TARGET_TYPE (resolved_type) +- = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), +- target_addr, top_level); +- break; +- } +- +- case TYPE_CODE_ARRAY: +- resolved_type = resolve_dynamic_array (type); +- break; ++ case TYPE_CODE_ARRAY: ++ resolved_type = resolve_dynamic_array (type); ++ break; + +- case TYPE_CODE_RANGE: +- resolved_type = resolve_dynamic_range (type); +- break; ++ case TYPE_CODE_RANGE: ++ resolved_type = resolve_dynamic_range (type); ++ break; + + case TYPE_CODE_UNION: + resolved_type = resolve_dynamic_union (type, addr); + + + +commit 5537b577695dd5cd72395590d7ebd7aa92ee856a +Author: Jan Kratochvil +Date: Sat Dec 13 15:31:59 2014 +0100 + + Fix 7.8 regression: resolve_dynamic_struct: Assertion `TYPE_NFIELDS (type) > 0' (PR 17642) + + https://sourceware.org/bugzilla/show_bug.cgi?id=17642 + + Regression since: + commit 012370f6818657a816df1463ee71ca4e4ee40b33 + Author: Tom Tromey + Date: Thu May 8 11:26:44 2014 -0600 + handle VLA in a struct or union + + Bugreport: + Regression with gdb scripts for Linux kernel + https://sourceware.org/ml/gdb/2014-08/msg00127.html + + That big change after "else" is just reindentation. + + gdb/ChangeLog + 2014-12-13 Jan Kratochvil + + PR symtab/17642 + * gdbtypes.c (resolve_dynamic_type_internal): Apply check_typedef to + TYPE if not TYPE_CODE_TYPEDEF. + + gdb/testsuite/ChangeLog + 2014-12-13 Jan Kratochvil + + PR symtab/17642 + * gdb.base/vla-stub-define.c: New file. + * gdb.base/vla-stub.c: New file. + * gdb.base/vla-stub.exp: New file. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,9 @@ ++2014-12-13 Jan Kratochvil ++ ++ PR symtab/17642 ++ * gdbtypes.c (resolve_dynamic_type_internal): Apply check_typedef to ++ TYPE if not TYPE_CODE_TYPEDEF. ++ + 2014-12-12 Doug Evans + + * valops.c (value_maybe_namespace_elt): Remove unnecessary test of +--- a/gdb/gdbtypes.c ++++ b/gdb/gdbtypes.c +@@ -1888,41 +1888,47 @@ resolve_dynamic_type_internal (struct type *type, CORE_ADDR addr, + if (!is_dynamic_type_internal (real_type, top_level)) + return type; + +- switch (TYPE_CODE (type)) ++ if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + { +- case TYPE_CODE_TYPEDEF: + resolved_type = copy_type (type); + TYPE_TARGET_TYPE (resolved_type) + = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), addr, + top_level); +- break; ++ } ++ else ++ { ++ /* Before trying to resolve TYPE, make sure it is not a stub. */ ++ type = real_type; + +- case TYPE_CODE_REF: +- { +- CORE_ADDR target_addr = read_memory_typed_address (addr, type); ++ switch (TYPE_CODE (type)) ++ { ++ case TYPE_CODE_REF: ++ { ++ CORE_ADDR target_addr = read_memory_typed_address (addr, type); + +- resolved_type = copy_type (type); +- TYPE_TARGET_TYPE (resolved_type) +- = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), +- target_addr, top_level); +- break; +- } ++ resolved_type = copy_type (type); ++ TYPE_TARGET_TYPE (resolved_type) ++ = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), ++ target_addr, top_level); ++ break; ++ } + +- case TYPE_CODE_ARRAY: +- resolved_type = resolve_dynamic_array (type); +- break; ++ case TYPE_CODE_ARRAY: ++ resolved_type = resolve_dynamic_array (type); ++ break; + +- case TYPE_CODE_RANGE: +- resolved_type = resolve_dynamic_range (type); +- break; ++ case TYPE_CODE_RANGE: ++ resolved_type = resolve_dynamic_range (type); ++ break; + +- case TYPE_CODE_UNION: +- resolved_type = resolve_dynamic_union (type, addr); +- break; ++ case TYPE_CODE_UNION: ++ resolved_type = resolve_dynamic_union (type, addr); ++ break; + +- case TYPE_CODE_STRUCT: +- resolved_type = resolve_dynamic_struct (type, addr); +- break; ++ case TYPE_CODE_STRUCT: ++ resolved_type = resolve_dynamic_struct (type, addr); ++ break; ++ } + } + + return resolved_type; +### a/gdb/testsuite/ChangeLog +### b/gdb/testsuite/ChangeLog +## -1,3 +1,10 @@ ++2014-12-13 Jan Kratochvil ++ ++ PR symtab/17642 ++ * gdb.base/vla-stub-define.c: New file. ++ * gdb.base/vla-stub.c: New file. ++ * gdb.base/vla-stub.exp: New file. ++ + 2014-12-12 Phil Muldoon + Jan Kratochvil + Tom Tromey +--- /dev/null ++++ b/gdb/testsuite/gdb.base/vla-stub-define.c +@@ -0,0 +1,21 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2014 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 . */ ++ ++struct dynamic_struct ++{ ++ int dynamic_field[0]; ++} use_dynamic_struct; +--- /dev/null ++++ b/gdb/testsuite/gdb.base/vla-stub.c +@@ -0,0 +1,37 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2014 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 . */ ++ ++struct dynamic_struct; ++typedef struct dynamic_struct dynamic_struct_t; ++ ++struct static_struct ++{ ++ int field; ++}; ++typedef struct static_struct static_struct_t; ++ ++struct local_struct ++{ ++ static_struct_t here; ++ dynamic_struct_t *ptr; ++} local_struct; ++ ++int ++main (void) ++{ ++ return 0; ++} +--- /dev/null ++++ b/gdb/testsuite/gdb.base/vla-stub.exp +@@ -0,0 +1,25 @@ ++# Copyright 2014 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 . ++ ++standard_testfile .c vla-stub-define.c ++if { [prepare_for_testing "failed to prepare for vla-stub.exp" \ ++ ${testfile} [list ${srcfile} ${srcfile2}]] } { ++ return -1 ++} ++ ++gdb_test "p *local_struct.ptr" { = {dynamic_field = 0x0}} ++ ++gdb_test "whatis local_struct.here" "type = static_struct_t" ++gdb_test "whatis *local_struct.ptr" "type = dynamic_struct_t" diff --git a/gdb-vla-intel.patch b/gdb-vla-intel.patch index d4f9eed..7a8674b 100644 --- a/gdb-vla-intel.patch +++ b/gdb-vla-intel.patch @@ -6,25 +6,11 @@ GIT snapshot: commit 511bff520372ffc10fa2ff569c176bdf1e6e475d -diff --git a/gdb/NEWS b/gdb/NEWS -index d9a19ae..e6885d2 100644 -### a/gdb/NEWS -### b/gdb/NEWS -@@ -3,6 +3,9 @@ - - *** Changes since GDB 7.8 - -+* Fortran dynamic array support: It allows the user to evaluate -+ dynamic arrays like an ordinary static array. -+ - *** Changes in GDB 7.8 - - * New command line options -diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c -index f4694b0..8c45276 100644 ---- a/gdb/c-valprint.c -+++ b/gdb/c-valprint.c -@@ -538,7 +538,16 @@ c_value_print (struct value *val, struct ui_file *stream, +Index: gdb-7.8.1/gdb/c-valprint.c +=================================================================== +--- gdb-7.8.1.orig/gdb/c-valprint.c 2014-12-13 15:52:07.695310276 +0100 ++++ gdb-7.8.1/gdb/c-valprint.c 2014-12-13 15:52:10.817307138 +0100 +@@ -538,7 +538,16 @@ c_value_print (struct value *val, struct { /* normal case */ fprintf_filtered (stream, "("); @@ -42,11 +28,11 @@ index f4694b0..8c45276 100644 fprintf_filtered (stream, ") "); } } -diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c -index 36c9f66..274ba62 100644 ---- a/gdb/dwarf2expr.c -+++ b/gdb/dwarf2expr.c -@@ -1478,6 +1478,12 @@ execute_stack_op (struct dwarf_expr_context *ctx, +Index: gdb-7.8.1/gdb/dwarf2expr.c +=================================================================== +--- gdb-7.8.1.orig/gdb/dwarf2expr.c 2014-12-13 15:52:07.695310276 +0100 ++++ gdb-7.8.1/gdb/dwarf2expr.c 2014-12-13 15:52:10.817307138 +0100 +@@ -1478,6 +1478,12 @@ execute_stack_op (struct dwarf_expr_cont } break; @@ -59,10 +45,10 @@ index 36c9f66..274ba62 100644 default: error (_("Unhandled dwarf expression opcode 0x%x"), op); } -diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h -index 39dadf3..8cebbe8 100644 ---- a/gdb/dwarf2expr.h -+++ b/gdb/dwarf2expr.h +Index: gdb-7.8.1/gdb/dwarf2expr.h +=================================================================== +--- gdb-7.8.1.orig/gdb/dwarf2expr.h 2014-12-13 15:52:07.696310275 +0100 ++++ gdb-7.8.1/gdb/dwarf2expr.h 2014-12-13 15:52:10.817307138 +0100 @@ -84,12 +84,8 @@ struct dwarf_expr_context_funcs This can throw an exception if the index is out of range. */ CORE_ADDR (*get_addr_index) (void *baton, unsigned int index); @@ -76,10 +62,10 @@ index 39dadf3..8cebbe8 100644 }; /* The location of a value. */ -diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c -index fcab9b9..a624dac 100644 ---- a/gdb/dwarf2loc.c -+++ b/gdb/dwarf2loc.c +Index: gdb-7.8.1/gdb/dwarf2loc.c +=================================================================== +--- gdb-7.8.1.orig/gdb/dwarf2loc.c 2014-12-13 15:52:07.697310274 +0100 ++++ gdb-7.8.1/gdb/dwarf2loc.c 2014-12-13 15:52:10.818307137 +0100 @@ -306,6 +306,7 @@ struct dwarf_expr_baton { struct frame_info *frame; @@ -88,7 +74,7 @@ index fcab9b9..a624dac 100644 }; /* Helper functions for dwarf2_evaluate_loc_desc. */ -@@ -1209,6 +1210,7 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx, +@@ -1209,6 +1210,7 @@ dwarf_expr_push_dwarf_reg_entry_value (s baton_local.frame = caller_frame; baton_local.per_cu = caller_per_cu; @@ -96,7 +82,7 @@ index fcab9b9..a624dac 100644 saved_ctx.gdbarch = ctx->gdbarch; saved_ctx.addr_size = ctx->addr_size; -@@ -1238,6 +1240,22 @@ dwarf_expr_get_addr_index (void *baton, unsigned int index) +@@ -1238,6 +1240,22 @@ dwarf_expr_get_addr_index (void *baton, return dwarf2_read_addr_index (debaton->per_cu, index); } @@ -119,7 +105,7 @@ index fcab9b9..a624dac 100644 /* VALUE must be of type lval_computed with entry_data_value_funcs. Perform the indirect method on it, that is use its stored target value, the sole purpose of entry_data_value_funcs.. */ -@@ -2202,7 +2220,8 @@ static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs = +@@ -2202,7 +2220,8 @@ static const struct dwarf_expr_context_f dwarf_expr_dwarf_call, dwarf_expr_get_base_type, dwarf_expr_push_dwarf_reg_entry_value, @@ -129,7 +115,7 @@ index fcab9b9..a624dac 100644 }; /* Evaluate a location description, starting at DATA and with length -@@ -2231,6 +2250,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, +@@ -2231,6 +2250,7 @@ dwarf2_evaluate_loc_desc_full (struct ty baton.frame = frame; baton.per_cu = per_cu; @@ -137,7 +123,7 @@ index fcab9b9..a624dac 100644 ctx = new_dwarf_expr_context (); old_chain = make_cleanup_free_dwarf_expr_context (ctx); -@@ -2326,6 +2346,11 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, +@@ -2326,6 +2346,11 @@ dwarf2_evaluate_loc_desc_full (struct ty int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0); do_cleanups (value_chain); @@ -149,7 +135,7 @@ index fcab9b9..a624dac 100644 retval = value_at_lazy (type, address + byte_offset); if (in_stack_memory) set_value_stack (retval, 1); -@@ -2436,6 +2461,7 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, +@@ -2436,6 +2461,7 @@ dwarf2_evaluate_loc_desc (struct type *t static int dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, @@ -157,7 +143,7 @@ index fcab9b9..a624dac 100644 CORE_ADDR *valp) { struct dwarf_expr_context *ctx; -@@ -2451,6 +2477,7 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, +@@ -2451,6 +2477,7 @@ dwarf2_locexpr_baton_eval (const struct baton.frame = get_selected_frame (NULL); baton.per_cu = dlbaton->per_cu; @@ -165,7 +151,7 @@ index fcab9b9..a624dac 100644 objfile = dwarf2_per_cu_objfile (dlbaton->per_cu); -@@ -2491,7 +2518,8 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, +@@ -2491,7 +2518,8 @@ dwarf2_locexpr_baton_eval (const struct /* See dwarf2loc.h. */ int @@ -175,7 +161,7 @@ index fcab9b9..a624dac 100644 { if (prop == NULL) return 0; -@@ -2502,7 +2530,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR *value) +@@ -2502,7 +2530,7 @@ dwarf2_evaluate_property (const struct d { const struct dwarf2_property_baton *baton = prop->data.baton; @@ -184,7 +170,7 @@ index fcab9b9..a624dac 100644 { if (baton->referenced_type) { -@@ -2546,6 +2574,20 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR *value) +@@ -2546,6 +2574,20 @@ dwarf2_evaluate_property (const struct d return 0; } @@ -205,7 +191,7 @@ index fcab9b9..a624dac 100644 /* Helper functions and baton for dwarf2_loc_desc_needs_frame. */ -@@ -2653,6 +2695,15 @@ needs_get_addr_index (void *baton, unsigned int index) +@@ -2653,6 +2695,15 @@ needs_get_addr_index (void *baton, unsig return 1; } @@ -221,7 +207,7 @@ index fcab9b9..a624dac 100644 /* Virtual method table for dwarf2_loc_desc_needs_frame below. */ static const struct dwarf_expr_context_funcs needs_frame_ctx_funcs = -@@ -2667,7 +2718,8 @@ static const struct dwarf_expr_context_funcs needs_frame_ctx_funcs = +@@ -2667,7 +2718,8 @@ static const struct dwarf_expr_context_f needs_frame_dwarf_call, NULL, /* get_base_type */ needs_dwarf_reg_entry_value, @@ -231,7 +217,7 @@ index fcab9b9..a624dac 100644 }; /* Return non-zero iff the location expression at DATA (length SIZE) -@@ -3316,6 +3368,10 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc, +@@ -3316,6 +3368,10 @@ dwarf2_compile_expr_to_ax (struct agent_ unimplemented (op); break; @@ -242,11 +228,11 @@ index fcab9b9..a624dac 100644 case DW_OP_skip: offset = extract_signed_integer (op_ptr, 2, byte_order); op_ptr += 2; -diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h -index 8ad5fa9..fb65c5c 100644 ---- a/gdb/dwarf2loc.h -+++ b/gdb/dwarf2loc.h -@@ -96,11 +96,18 @@ struct value *dwarf2_evaluate_loc_desc (struct type *type, +Index: gdb-7.8.1/gdb/dwarf2loc.h +=================================================================== +--- gdb-7.8.1.orig/gdb/dwarf2loc.h 2014-12-13 15:52:07.697310274 +0100 ++++ gdb-7.8.1/gdb/dwarf2loc.h 2014-12-13 15:52:10.819307136 +0100 +@@ -96,11 +96,18 @@ struct value *dwarf2_evaluate_loc_desc ( into VALUE, otherwise returns 0. */ int dwarf2_evaluate_property (const struct dynamic_prop *prop, @@ -265,11 +251,11 @@ index 8ad5fa9..fb65c5c 100644 /* The symbol location baton types used by the DWARF-2 reader (i.e. SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). "struct dwarf2_locexpr_baton" is for a symbol with a single location -diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c -index 276d2f1..fbf13ce 100644 ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -1847,6 +1847,12 @@ static void free_dwo_file_cleanup (void *); +Index: gdb-7.8.1/gdb/dwarf2read.c +=================================================================== +--- gdb-7.8.1.orig/gdb/dwarf2read.c 2014-12-13 15:52:07.704310267 +0100 ++++ gdb-7.8.1/gdb/dwarf2read.c 2014-12-13 15:52:10.823307132 +0100 +@@ -1847,6 +1847,12 @@ static void free_dwo_file_cleanup (void static void process_cu_includes (void); static void check_producer (struct dwarf2_cu *cu); @@ -282,16 +268,16 @@ index 276d2f1..fbf13ce 100644 /* Various complaints about symbol reading that don't abort the process. */ -@@ -14201,29 +14207,92 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -14182,29 +14188,92 @@ read_tag_string_type (struct die_info *d struct gdbarch *gdbarch = get_objfile_arch (objfile); struct type *type, *range_type, *index_type, *char_type; struct attribute *attr; - unsigned int length; + unsigned int length = UINT_MAX; -+ + + index_type = objfile_type (objfile)->builtin_int; + range_type = create_static_range_type (NULL, index_type, 1, length); - ++ + /* If DW_AT_string_length is defined, the length is stored at some location + * in memory. */ attr = dwarf2_attr (die, DW_AT_string_length, cu); @@ -382,7 +368,7 @@ index 276d2f1..fbf13ce 100644 char_type = language_string_char_type (cu->language_defn, gdbarch); type = create_string_type (NULL, char_type, range_type); -@@ -14540,13 +14609,15 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -14521,13 +14590,15 @@ read_base_type (struct die_info *die, st return set_die_type (die, type, cu); } @@ -399,7 +385,7 @@ index 276d2f1..fbf13ce 100644 { struct dwarf2_property_baton *baton; struct obstack *obstack = &cu->objfile->objfile_obstack; -@@ -14559,8 +14630,25 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, +@@ -14540,8 +14611,25 @@ attr_to_dynamic_prop (const struct attri baton = obstack_alloc (obstack, sizeof (*baton)); baton->referenced_type = NULL; baton->locexpr.per_cu = cu->per_cu; @@ -427,7 +413,7 @@ index 276d2f1..fbf13ce 100644 prop->data.baton = baton; prop->kind = PROP_LOCEXPR; gdb_assert (prop->data.baton != NULL); -@@ -14590,8 +14678,28 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, +@@ -14571,8 +14659,28 @@ attr_to_dynamic_prop (const struct attri baton = obstack_alloc (obstack, sizeof (*baton)); baton->referenced_type = die_type (target_die, target_cu); baton->locexpr.per_cu = cu->per_cu; @@ -458,7 +444,7 @@ index 276d2f1..fbf13ce 100644 prop->data.baton = baton; prop->kind = PROP_LOCEXPR; gdb_assert (prop->data.baton != NULL); -@@ -14626,7 +14734,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -14607,7 +14715,7 @@ read_subrange_type (struct die_info *die struct type *base_type, *orig_base_type; struct type *range_type; struct attribute *attr; @@ -467,7 +453,7 @@ index 276d2f1..fbf13ce 100644 int low_default_is_valid; int high_bound_is_count = 0; const char *name; -@@ -14646,7 +14754,9 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -14627,7 +14735,9 @@ read_subrange_type (struct die_info *die low.kind = PROP_CONST; high.kind = PROP_CONST; @@ -477,7 +463,7 @@ index 276d2f1..fbf13ce 100644 /* Set LOW_DEFAULT_IS_VALID if current language and DWARF version allow omitting DW_AT_lower_bound. */ -@@ -14679,19 +14789,26 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -14660,19 +14770,26 @@ read_subrange_type (struct die_info *die break; } @@ -507,7 +493,7 @@ index 276d2f1..fbf13ce 100644 { /* If bounds are constant do the final calculation here. */ if (low.kind == PROP_CONST && high.kind == PROP_CONST) -@@ -14755,7 +14872,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -14736,7 +14853,7 @@ read_subrange_type (struct die_info *die && !TYPE_UNSIGNED (base_type) && (high.data.const_val & negative_mask)) high.data.const_val |= negative_mask; @@ -516,7 +502,7 @@ index 276d2f1..fbf13ce 100644 if (high_bound_is_count) TYPE_RANGE_DATA (range_type)->flag_upper_bound_is_count = 1; -@@ -21673,6 +21790,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -21654,6 +21771,8 @@ set_die_type (struct die_info *die, stru { struct dwarf2_per_cu_offset_and_type **slot, ofs; struct objfile *objfile = cu->objfile; @@ -525,7 +511,7 @@ index 276d2f1..fbf13ce 100644 /* For Ada types, make sure that the gnat-specific data is always initialized (if not already set). There are a few types where -@@ -21687,6 +21806,43 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -21668,6 +21787,43 @@ set_die_type (struct die_info *die, stru && !HAVE_GNAT_AUX_INFO (type)) INIT_GNAT_SPECIFIC (type); @@ -569,10 +555,10 @@ index 276d2f1..fbf13ce 100644 if (dwarf2_per_objfile->die_type_hash == NULL) { dwarf2_per_objfile->die_type_hash = -diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c -index 8356aab..69e67f4 100644 ---- a/gdb/f-typeprint.c -+++ b/gdb/f-typeprint.c +Index: gdb-7.8.1/gdb/f-typeprint.c +=================================================================== +--- gdb-7.8.1.orig/gdb/f-typeprint.c 2014-12-13 15:52:07.705310266 +0100 ++++ gdb-7.8.1/gdb/f-typeprint.c 2014-12-13 15:52:10.823307132 +0100 @@ -30,6 +30,7 @@ #include "gdbcore.h" #include "target.h" @@ -581,7 +567,7 @@ index 8356aab..69e67f4 100644 #include #include -@@ -56,6 +57,17 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream, +@@ -56,6 +57,17 @@ f_print_type (struct type *type, const c enum type_code code; int demangled_args; @@ -599,7 +585,7 @@ index 8356aab..69e67f4 100644 f_type_print_base (type, stream, show, level); code = TYPE_CODE (type); if ((varstring != NULL && *varstring != '\0') -@@ -170,28 +182,36 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, +@@ -170,28 +182,36 @@ f_type_print_varspec_suffix (struct type if (arrayprint_recurse_level == 1) fprintf_filtered (stream, "("); @@ -657,10 +643,10 @@ index 8356aab..69e67f4 100644 if (arrayprint_recurse_level == 1) fprintf_filtered (stream, ")"); else -diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c -index 408c8cc..38f32e0 100644 ---- a/gdb/f-valprint.c -+++ b/gdb/f-valprint.c +Index: gdb-7.8.1/gdb/f-valprint.c +=================================================================== +--- gdb-7.8.1.orig/gdb/f-valprint.c 2014-12-13 15:52:07.705310266 +0100 ++++ gdb-7.8.1/gdb/f-valprint.c 2014-12-13 15:52:10.824307131 +0100 @@ -39,8 +39,6 @@ extern void _initialize_f_valprint (void); @@ -670,7 +656,7 @@ index 408c8cc..38f32e0 100644 static void f77_get_dynamic_length_of_aggregate (struct type *); int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; -@@ -48,15 +46,6 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; +@@ -48,15 +46,6 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIM /* Array which holds offsets to be applied to get a row's elements for a given array. Array also holds the size of each subarray. */ @@ -686,7 +672,7 @@ index 408c8cc..38f32e0 100644 int f77_get_lowerbound (struct type *type) { -@@ -114,47 +103,6 @@ f77_get_dynamic_length_of_aggregate (struct type *type) +@@ -114,47 +103,6 @@ f77_get_dynamic_length_of_aggregate (str * TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type))); } @@ -734,7 +720,7 @@ index 408c8cc..38f32e0 100644 /* Actual function which prints out F77 arrays, Valaddr == address in the superior. Address == the address in the inferior. */ -@@ -167,41 +115,62 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, +@@ -167,41 +115,62 @@ f77_print_array_1 (int nss, int ndimensi const struct value_print_options *options, int *elts) { @@ -813,7 +799,7 @@ index 408c8cc..38f32e0 100644 fprintf_filtered (stream, "..."); } } -@@ -228,12 +197,6 @@ f77_print_array (struct type *type, const gdb_byte *valaddr, +@@ -228,12 +197,6 @@ f77_print_array (struct type *type, cons Type node corrupt! F77 arrays cannot have %d subscripts (%d Max)"), ndimensions, MAX_FORTRAN_DIMS); @@ -826,7 +812,7 @@ index 408c8cc..38f32e0 100644 f77_print_array_1 (1, ndimensions, type, valaddr, embedded_offset, address, stream, recurse, val, options, &elts); } -@@ -378,12 +341,15 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, +@@ -378,12 +341,15 @@ f_val_print (struct type *type, const gd fprintf_filtered (stream, "( "); for (index = 0; index < TYPE_NFIELDS (type); index++) { @@ -847,10 +833,10 @@ index 408c8cc..38f32e0 100644 if (index != TYPE_NFIELDS (type) - 1) fputs_filtered (", ", stream); } -diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c -index e99a2f3..53cae2c 100644 ---- a/gdb/gdbtypes.c -+++ b/gdb/gdbtypes.c +Index: gdb-7.8.1/gdb/gdbtypes.c +=================================================================== +--- gdb-7.8.1.orig/gdb/gdbtypes.c 2014-12-13 15:52:07.707310264 +0100 ++++ gdb-7.8.1/gdb/gdbtypes.c 2014-12-13 15:53:10.675246976 +0100 @@ -805,7 +805,8 @@ allocate_stub_method (struct type *type) struct type * create_range_type (struct type *result_type, struct type *index_type, @@ -861,7 +847,7 @@ index e99a2f3..53cae2c 100644 { if (result_type == NULL) result_type = alloc_type_copy (index_type); -@@ -820,6 +821,7 @@ create_range_type (struct type *result_type, struct type *index_type, +@@ -820,6 +821,7 @@ create_range_type (struct type *result_t TYPE_ZALLOC (result_type, sizeof (struct range_bounds)); TYPE_RANGE_DATA (result_type)->low = *low_bound; TYPE_RANGE_DATA (result_type)->high = *high_bound; @@ -878,7 +864,7 @@ index e99a2f3..53cae2c 100644 low.kind = PROP_CONST; low.data.const_val = low_bound; -@@ -849,7 +851,11 @@ create_static_range_type (struct type *result_type, struct type *index_type, +@@ -849,7 +851,11 @@ create_static_range_type (struct type *r high.kind = PROP_CONST; high.data.const_val = high_bound; @@ -891,7 +877,7 @@ index e99a2f3..53cae2c 100644 return result_type; } -@@ -1003,18 +1009,24 @@ create_array_type_with_stride (struct type *result_type, +@@ -1003,18 +1009,24 @@ create_array_type_with_stride (struct ty TYPE_CODE (result_type) = TYPE_CODE_ARRAY; TYPE_TARGET_TYPE (result_type) = element_type; @@ -950,7 +936,7 @@ index e99a2f3..53cae2c 100644 switch (TYPE_CODE (type)) { case TYPE_CODE_RANGE: -@@ -1631,11 +1662,19 @@ is_dynamic_type_internal (struct type *type, int top_level) +@@ -1631,11 +1662,19 @@ is_dynamic_type_internal (struct type *t { gdb_assert (TYPE_NFIELDS (type) == 1); @@ -973,7 +959,7 @@ index e99a2f3..53cae2c 100644 } case TYPE_CODE_STRUCT: -@@ -1648,6 +1687,17 @@ is_dynamic_type_internal (struct type *type, int top_level) +@@ -1648,6 +1687,17 @@ is_dynamic_type_internal (struct type *t && is_dynamic_type_internal (TYPE_FIELD_TYPE (type, i), 0)) return 1; } @@ -991,7 +977,7 @@ index e99a2f3..53cae2c 100644 break; } -@@ -1666,22 +1716,23 @@ static struct type *resolve_dynamic_type_internal (struct type *type, +@@ -1666,22 +1716,23 @@ static struct type *resolve_dynamic_type CORE_ADDR addr, int top_level); @@ -1020,7 +1006,7 @@ index e99a2f3..53cae2c 100644 { low_bound.kind = PROP_CONST; low_bound.data.const_val = value; -@@ -1693,7 +1744,7 @@ resolve_dynamic_range (struct type *dyn_range_type) +@@ -1693,7 +1744,7 @@ resolve_dynamic_range (struct type *dyn_ } prop = &TYPE_RANGE_DATA (dyn_range_type)->high; @@ -1029,7 +1015,7 @@ index e99a2f3..53cae2c 100644 { high_bound.kind = PROP_CONST; high_bound.data.const_val = value; -@@ -1707,10 +1758,17 @@ resolve_dynamic_range (struct type *dyn_range_type) +@@ -1707,10 +1758,17 @@ resolve_dynamic_range (struct type *dyn_ high_bound.kind = PROP_UNDEFINED; high_bound.data.const_val = 0; } @@ -1050,7 +1036,7 @@ index e99a2f3..53cae2c 100644 TYPE_RANGE_DATA (static_range_type)->flag_bound_evaluated = 1; return static_range_type; } -@@ -1720,29 +1778,52 @@ resolve_dynamic_range (struct type *dyn_range_type) +@@ -1720,29 +1778,52 @@ resolve_dynamic_range (struct type *dyn_ of the associated array. */ static struct type * @@ -1111,7 +1097,7 @@ index e99a2f3..53cae2c 100644 } /* Resolve dynamic bounds of members of the union TYPE to static -@@ -1846,6 +1927,8 @@ resolve_dynamic_type_internal (struct type *type, CORE_ADDR addr, +@@ -1846,6 +1927,8 @@ resolve_dynamic_type_internal (struct ty { struct type *real_type = check_typedef (type); struct type *resolved_type = type; @@ -1120,23 +1106,23 @@ index e99a2f3..53cae2c 100644 if (!is_dynamic_type_internal (real_type, top_level)) return type; -@@ -1871,11 +1954,12 @@ resolve_dynamic_type_internal (struct type *type, CORE_ADDR addr, +@@ -1876,11 +1959,12 @@ resolve_dynamic_type_internal (struct ty + } + + case TYPE_CODE_ARRAY: +- resolved_type = resolve_dynamic_array (type); ++ case TYPE_CODE_STRING: ++ resolved_type = resolve_dynamic_array (type, addr); + break; + + case TYPE_CODE_RANGE: +- resolved_type = resolve_dynamic_range (type); ++ resolved_type = resolve_dynamic_range (type, addr); + break; + + case TYPE_CODE_UNION: +@@ -1893,6 +1977,25 @@ resolve_dynamic_type_internal (struct ty } - - case TYPE_CODE_ARRAY: -- resolved_type = resolve_dynamic_array (type); -+ case TYPE_CODE_STRING: -+ resolved_type = resolve_dynamic_array (type, addr); - break; - - case TYPE_CODE_RANGE: -- resolved_type = resolve_dynamic_range (type); -+ resolved_type = resolve_dynamic_range (type, addr); - break; - - case TYPE_CODE_UNION: -@@ -1887,6 +1971,25 @@ resolve_dynamic_type_internal (struct type *type, CORE_ADDR addr, - break; } + /* Resolve data_location attribute. */ @@ -1161,7 +1147,7 @@ index e99a2f3..53cae2c 100644 return resolved_type; } -@@ -4104,6 +4207,27 @@ copy_type_recursive (struct objfile *objfile, +@@ -4110,6 +4213,27 @@ copy_type_recursive (struct objfile *obj *TYPE_RANGE_DATA (new_type) = *TYPE_RANGE_DATA (type); } @@ -1189,7 +1175,7 @@ index e99a2f3..53cae2c 100644 /* Copy pointers to other types. */ if (TYPE_TARGET_TYPE (type)) TYPE_TARGET_TYPE (new_type) = -@@ -4150,6 +4274,44 @@ copy_type (const struct type *type) +@@ -4156,6 +4280,44 @@ copy_type (const struct type *type) memcpy (TYPE_MAIN_TYPE (new_type), TYPE_MAIN_TYPE (type), sizeof (struct main_type)); @@ -1234,11 +1220,11 @@ index e99a2f3..53cae2c 100644 return new_type; } -diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h -index 5008ef4..436edf8 100644 ---- a/gdb/gdbtypes.h -+++ b/gdb/gdbtypes.h -@@ -669,6 +669,10 @@ struct main_type +Index: gdb-7.8.1/gdb/gdbtypes.h +=================================================================== +--- gdb-7.8.1.orig/gdb/gdbtypes.h 2014-12-13 15:52:07.708310263 +0100 ++++ gdb-7.8.1/gdb/gdbtypes.h 2014-12-13 15:52:10.825307130 +0100 +@@ -670,6 +670,10 @@ struct main_type struct dynamic_prop high; @@ -1249,7 +1235,7 @@ index 5008ef4..436edf8 100644 /* True if HIGH range bound contains the number of elements in the subrange. This affects how the final hight bound is computed. */ -@@ -724,6 +728,23 @@ struct main_type +@@ -725,6 +729,23 @@ struct main_type struct func_type *func_stuff; } type_specific; @@ -1273,7 +1259,7 @@ index 5008ef4..436edf8 100644 }; /* * A ``struct type'' describes a particular instance of a type, with -@@ -1202,6 +1223,39 @@ extern void allocate_gnat_aux_type (struct type *); +@@ -1203,6 +1224,39 @@ extern void allocate_gnat_aux_type (stru TYPE_RANGE_DATA(range_type)->high.kind #define TYPE_LOW_BOUND_KIND(range_type) \ TYPE_RANGE_DATA(range_type)->low.kind @@ -1313,7 +1299,7 @@ index 5008ef4..436edf8 100644 /* Moto-specific stuff for FORTRAN arrays. */ -@@ -1209,6 +1263,9 @@ extern void allocate_gnat_aux_type (struct type *); +@@ -1210,6 +1264,9 @@ extern void allocate_gnat_aux_type (stru TYPE_HIGH_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype)) #define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \ TYPE_LOW_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype)) @@ -1323,7 +1309,7 @@ index 5008ef4..436edf8 100644 #define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \ (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype)))) -@@ -1677,6 +1734,7 @@ extern struct type *create_array_type_with_stride +@@ -1678,6 +1735,7 @@ extern struct type *create_array_type_wi extern struct type *create_range_type (struct type *, struct type *, const struct dynamic_prop *, @@ -1331,11 +1317,10 @@ index 5008ef4..436edf8 100644 const struct dynamic_prop *); extern struct type *create_array_type (struct type *, struct type *, -diff --git a/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp b/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp -new file mode 100644 -index 0000000..20607c3 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp 2014-12-13 15:52:10.825307130 +0100 @@ -0,0 +1,65 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -1402,11 +1387,10 @@ index 0000000..20607c3 +gdb_continue_to_breakpoint "vla2-deallocated" +gdb_test "print l" " = \\.FALSE\\." "print vla2 deallocated" +gdb_test "print vla2" " = " "print deallocated vla2" -diff --git a/gdb/testsuite/gdb.fortran/vla-datatypes.exp b/gdb/testsuite/gdb.fortran/vla-datatypes.exp -new file mode 100644 -index 0000000..20276d6 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-datatypes.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-datatypes.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-datatypes.exp 2014-12-13 15:52:10.825307130 +0100 @@ -0,0 +1,82 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -1490,11 +1474,10 @@ index 0000000..20276d6 + "print logicalvla(5,5,5) (2nd)" +gdb_test "print charactervla(5,5,5)" " = 'X'" \ + "print charactervla(5,5,5) (2nd)" -diff --git a/gdb/testsuite/gdb.fortran/vla-datatypes.f90 b/gdb/testsuite/gdb.fortran/vla-datatypes.f90 -new file mode 100644 -index 0000000..b11879a ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-datatypes.f90 +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-datatypes.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-datatypes.f90 2014-12-13 15:52:10.825307130 +0100 @@ -0,0 +1,51 @@ +! Copyright 2014 Free Software Foundation, Inc. +! @@ -1547,11 +1530,10 @@ index 0000000..b11879a + ! dummy statement for bp + l = .FALSE. ! vlas-modified +end program vla_primitives -diff --git a/gdb/testsuite/gdb.fortran/vla-func.exp b/gdb/testsuite/gdb.fortran/vla-func.exp -new file mode 100644 -index 0000000..f0f236b ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-func.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-func.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-func.exp 2014-12-13 15:52:10.825307130 +0100 @@ -0,0 +1,61 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -1614,11 +1596,10 @@ index 0000000..f0f236b + "print vla3 (after func2)" +gdb_test "ptype vla3" "type = integer\\\(kind=4\\\) \\\(10\\\)" \ + "ptype vla3 (after func2)" -diff --git a/gdb/testsuite/gdb.fortran/vla-func.f90 b/gdb/testsuite/gdb.fortran/vla-func.f90 -new file mode 100644 -index 0000000..4f45da1 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-func.f90 +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-func.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-func.f90 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,71 @@ +! Copyright 2014 Free Software Foundation, Inc. +! @@ -1691,11 +1672,10 @@ index 0000000..4f45da1 + + ret = .TRUE. ! func2-returned +end program vla_func -diff --git a/gdb/testsuite/gdb.fortran/vla-history.exp b/gdb/testsuite/gdb.fortran/vla-history.exp -new file mode 100644 -index 0000000..170e1eb ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-history.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-history.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-history.exp 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,62 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -1759,11 +1739,10 @@ index 0000000..170e1eb +# Try to access history values for vla values. +gdb_test "print \$9" " = 1311" "print \$9" +gdb_test "print \$10" " = 1001" "print \$10" -diff --git a/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp -new file mode 100644 -index 0000000..2ee2914 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,87 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -1852,11 +1831,10 @@ index 0000000..2ee2914 + "ptype array1(100) (arbitrary length)" +gdb_test "ptype array2(4,100)" "type = integer\\\(kind=4\\\)" \ + "ptype array2(4,100) (arbitrary length)" -diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp -new file mode 100644 -index 0000000..9267723 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-ptype.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-ptype.exp 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,96 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -1954,11 +1932,10 @@ index 0000000..9267723 +gdb_test "ptype vla2(5, 45, 20)" \ + "no such vector element because not allocated" \ + "ptype vla2(5, 45, 20) not allocated" -diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp -new file mode 100644 -index 0000000..6053c17 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-sizeof.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-sizeof.exp 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,46 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2006,11 +1983,10 @@ index 0000000..6053c17 +gdb_breakpoint [gdb_get_line_number "pvla-associated"] +gdb_continue_to_breakpoint "pvla-associated" +gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla" -diff --git a/gdb/testsuite/gdb.fortran/vla-stride.exp b/gdb/testsuite/gdb.fortran/vla-stride.exp -new file mode 100644 -index 0000000..35f585d ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-stride.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-stride.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-stride.exp 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,44 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2056,11 +2032,10 @@ index 0000000..35f585d +gdb_continue_to_breakpoint "single-element" +gdb_test "print pvla" " = \\\(5\\\)" "print single-element" +gdb_test "print pvla(1)" " = 5" "print one single-element" -diff --git a/gdb/testsuite/gdb.fortran/vla-stride.f90 b/gdb/testsuite/gdb.fortran/vla-stride.f90 -new file mode 100644 -index 0000000..6aa4f2b ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-stride.f90 +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-stride.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-stride.f90 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,30 @@ +! Copyright 2014 Free Software Foundation, Inc. +! @@ -2092,11 +2067,10 @@ index 0000000..6aa4f2b + + pvla => null() ! single-element +end program vla_stride -diff --git a/gdb/testsuite/gdb.fortran/vla-strings.exp b/gdb/testsuite/gdb.fortran/vla-strings.exp -new file mode 100644 -index 0000000..7fc1734 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-strings.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-strings.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-strings.exp 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,104 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2202,11 +2176,10 @@ index 0000000..7fc1734 + "whatis var_char_p after associated" +gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \ + "ptype var_char_p after associated" -diff --git a/gdb/testsuite/gdb.fortran/vla-strings.f90 b/gdb/testsuite/gdb.fortran/vla-strings.f90 -new file mode 100644 -index 0000000..0a1d522 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-strings.f90 +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-strings.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-strings.f90 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,40 @@ +! Copyright 2014 Free Software Foundation, Inc. +! @@ -2248,11 +2221,10 @@ index 0000000..0a1d522 + var_char_p => null() + l = associated(var_char_p) ! var_char_p-not-associated +end program vla_strings -diff --git a/gdb/testsuite/gdb.fortran/vla-sub.f90 b/gdb/testsuite/gdb.fortran/vla-sub.f90 -new file mode 100644 -index 0000000..8c2c9ff ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-sub.f90 +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-sub.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-sub.f90 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,82 @@ +! Copyright 2014 Free Software Foundation, Inc. +! @@ -2336,11 +2308,10 @@ index 0000000..8c2c9ff + + call bar(sub_arr3, sub_arr1) +end program vla_sub -diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp b/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp -new file mode 100644 -index 0000000..fd11adb ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,35 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2377,11 +2348,10 @@ index 0000000..fd11adb +gdb_test "p array1(100)" " = 100" "print arbitary array1(100)" +gdb_test "p array2(4,10)" " = 1" "print arbitary array2(4,10)" +gdb_test "p array2(4,100)" " = 1" "print arbitary array2(4,100)" -diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp b/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp -new file mode 100644 -index 0000000..a163617 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,49 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2432,11 +2402,10 @@ index 0000000..a163617 +gdb_test "p sub_arr2(1, 1, 1)" " = 30" "sub_arr2(1, 1, 1) after finish" +gdb_test "p sub_arr2(2, 1, 1)" " = 20" "sub_arr2(2, 1, 1) after finish" + -diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub.exp b/gdb/testsuite/gdb.fortran/vla-value-sub.exp -new file mode 100644 -index 0000000..848f9d7 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-value-sub.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value-sub.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value-sub.exp 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,90 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2528,11 +2497,10 @@ index 0000000..848f9d7 + "set array(2,2,2) to 20 in subroutine (passed vla)" +gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \ + "print array2 in foo after it was mofified in debugger (passed vla)" -diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp -new file mode 100644 -index 0000000..d7b8a1e ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-value.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value.exp 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,148 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2682,11 +2650,10 @@ index 0000000..d7b8a1e +gdb_continue_to_breakpoint "pvla-deassociated" +gdb_test "print \$mypvar(1,3,8)" " = 1001" \ + "print \$mypvar(1,3,8) after deallocated" -diff --git a/gdb/testsuite/gdb.fortran/vla.f90 b/gdb/testsuite/gdb.fortran/vla.f90 -new file mode 100644 -index 0000000..73425f3 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla.f90 +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla.f90 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,56 @@ +! Copyright 2014 Free Software Foundation, Inc. +! @@ -2744,11 +2711,10 @@ index 0000000..73425f3 + allocate (vla3 (2,2)) ! vla2-deallocated + vla3(:,:) = 13 +end program vla -diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp -new file mode 100644 -index 0000000..72b0be2 ---- /dev/null -+++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.mi/mi-vla-fortran.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.mi/mi-vla-fortran.exp 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,182 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2932,11 +2898,10 @@ index 0000000..72b0be2 + +mi_gdb_exit +return 0 -diff --git a/gdb/testsuite/gdb.mi/vla.f90 b/gdb/testsuite/gdb.mi/vla.f90 -new file mode 100644 -index 0000000..46edad2 ---- /dev/null -+++ b/gdb/testsuite/gdb.mi/vla.f90 +Index: gdb-7.8.1/gdb/testsuite/gdb.mi/vla.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.mi/vla.f90 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,42 @@ +! Copyright 2014 Free Software Foundation, Inc. +! @@ -2980,10 +2945,10 @@ index 0000000..46edad2 + pvla2 => null() + l = associated(pvla2) ! pvla2-set-to-null +end program vla -diff --git a/gdb/typeprint.c b/gdb/typeprint.c -index 026f3a2..4c861ac 100644 ---- a/gdb/typeprint.c -+++ b/gdb/typeprint.c +Index: gdb-7.8.1/gdb/typeprint.c +=================================================================== +--- gdb-7.8.1.orig/gdb/typeprint.c 2014-12-13 15:52:07.710310261 +0100 ++++ gdb-7.8.1/gdb/typeprint.c 2014-12-13 15:52:10.828307127 +0100 @@ -459,6 +459,13 @@ whatis_exp (char *exp, int show) type = value_type (val); @@ -2998,11 +2963,11 @@ index 026f3a2..4c861ac 100644 get_user_print_options (&opts); if (opts.objectprint) { -diff --git a/gdb/valarith.c b/gdb/valarith.c -index 4da41cb..fb9671b 100644 ---- a/gdb/valarith.c -+++ b/gdb/valarith.c -@@ -195,12 +195,31 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) +Index: gdb-7.8.1/gdb/valarith.c +=================================================================== +--- gdb-7.8.1.orig/gdb/valarith.c 2014-12-13 15:52:07.711310260 +0100 ++++ gdb-7.8.1/gdb/valarith.c 2014-12-13 15:52:10.828307127 +0100 +@@ -195,12 +195,31 @@ value_subscripted_rvalue (struct value * struct type *array_type = check_typedef (value_type (array)); struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); unsigned int elt_size = TYPE_LENGTH (elt_type); @@ -3036,11 +3001,11 @@ index 4da41cb..fb9671b 100644 if (VALUE_LVAL (array) == lval_memory && value_lazy (array)) v = allocate_value_lazy (elt_type); -diff --git a/gdb/valprint.c b/gdb/valprint.c -index 8600b34..2f8eac1 100644 ---- a/gdb/valprint.c -+++ b/gdb/valprint.c -@@ -307,6 +307,18 @@ valprint_check_validity (struct ui_file *stream, +Index: gdb-7.8.1/gdb/valprint.c +=================================================================== +--- gdb-7.8.1.orig/gdb/valprint.c 2014-12-13 15:52:07.712310259 +0100 ++++ gdb-7.8.1/gdb/valprint.c 2014-12-13 15:52:10.828307127 +0100 +@@ -307,6 +307,18 @@ valprint_check_validity (struct ui_file { CHECK_TYPEDEF (type); @@ -3059,7 +3024,7 @@ index 8600b34..2f8eac1 100644 if (TYPE_CODE (type) != TYPE_CODE_UNION && TYPE_CODE (type) != TYPE_CODE_STRUCT && TYPE_CODE (type) != TYPE_CODE_ARRAY) -@@ -362,6 +374,18 @@ val_print_invalid_address (struct ui_file *stream) +@@ -362,6 +374,18 @@ val_print_invalid_address (struct ui_fil fprintf_filtered (stream, _("")); } @@ -3095,7 +3060,7 @@ index 8600b34..2f8eac1 100644 if (value_entirely_optimized_out (val)) { if (options->summary && !val_print_scalar_type_p (value_type (val))) -@@ -834,6 +862,18 @@ value_check_printable (struct value *val, struct ui_file *stream, +@@ -834,6 +862,18 @@ value_check_printable (struct value *val return 0; } @@ -3114,11 +3079,11 @@ index 8600b34..2f8eac1 100644 return 1; } -diff --git a/gdb/valprint.h b/gdb/valprint.h -index 6698247..7a415cf 100644 ---- a/gdb/valprint.h -+++ b/gdb/valprint.h -@@ -217,4 +217,8 @@ extern void output_command_const (const char *args, int from_tty); +Index: gdb-7.8.1/gdb/valprint.h +=================================================================== +--- gdb-7.8.1.orig/gdb/valprint.h 2014-12-13 15:52:07.712310259 +0100 ++++ gdb-7.8.1/gdb/valprint.h 2014-12-13 15:52:10.828307127 +0100 +@@ -217,4 +217,8 @@ extern void output_command_const (const extern int val_print_scalar_type_p (struct type *type); @@ -3127,10 +3092,10 @@ index 6698247..7a415cf 100644 +extern void val_print_not_associated (struct ui_file *stream); + #endif -diff --git a/gdb/value.c b/gdb/value.c -index 29abe5f..5efea89 100644 ---- a/gdb/value.c -+++ b/gdb/value.c +Index: gdb-7.8.1/gdb/value.c +=================================================================== +--- gdb-7.8.1.orig/gdb/value.c 2014-12-13 15:52:07.713310258 +0100 ++++ gdb-7.8.1/gdb/value.c 2014-12-13 15:52:10.829307126 +0100 @@ -43,6 +43,7 @@ #include "tracepoint.h" #include "cp-abi.h" @@ -3139,7 +3104,7 @@ index 29abe5f..5efea89 100644 /* Prototypes for exported functions. */ -@@ -1627,6 +1628,25 @@ set_value_component_location (struct value *component, +@@ -1649,6 +1650,25 @@ set_value_component_location (struct val if (funcs->copy_closure) component->location.computed.closure = funcs->copy_closure (whole); } @@ -3165,7 +3130,7 @@ index 29abe5f..5efea89 100644 } -@@ -2931,13 +2951,22 @@ value_primitive_field (struct value *arg1, int offset, +@@ -2953,13 +2973,22 @@ value_primitive_field (struct value *arg v = allocate_value_lazy (type); else { @@ -3194,7 +3159,7 @@ index 29abe5f..5efea89 100644 } set_value_component_location (v, arg1); VALUE_REGNUM (v) = VALUE_REGNUM (arg1); -@@ -3520,7 +3549,8 @@ readjust_indirect_value_type (struct value *value, struct type *enc_type, +@@ -3542,7 +3571,8 @@ readjust_indirect_value_type (struct val struct value *original_value) { /* Re-adjust type. */ @@ -3204,7 +3169,7 @@ index 29abe5f..5efea89 100644 /* Add embedding info. */ set_value_enclosing_type (value, enc_type); -@@ -3537,6 +3567,12 @@ coerce_ref (struct value *arg) +@@ -3559,6 +3589,12 @@ coerce_ref (struct value *arg) struct value *retval; struct type *enc_type; @@ -3217,7 +3182,7 @@ index 29abe5f..5efea89 100644 retval = coerce_ref_if_computed (arg); if (retval) return retval; -@@ -3680,8 +3716,14 @@ value_fetch_lazy (struct value *val) +@@ -3702,8 +3738,14 @@ value_fetch_lazy (struct value *val) } else if (VALUE_LVAL (val) == lval_memory) { diff --git a/gdb.spec b/gdb.spec index cec03e8..57ca098 100644 --- a/gdb.spec +++ b/gdb.spec @@ -26,7 +26,7 @@ Version: 7.8.1 # 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: 34%{?dist} +Release: 35%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL Group: Development/Debuggers @@ -1334,6 +1334,9 @@ then fi %changelog +* Sat Dec 13 2014 Jan Kratochvil - 7.8.1-35.fc21 +- Fix resolve_dynamic_struct: Assertion `TYPE_NFIELDS (type) > 0' (PR 17642). + * Sat Nov 22 2014 Jan Kratochvil - 7.8.1-34.fc21 - [ppc64] Fix compatibility of Fedora errno workaround (for RH BZ 1166549).