[vla] Fix regression on no type for subrange from IBM XLF Fortran (BZ 806920).
This commit is contained in:
parent
3d3c8f2d4a
commit
9d32f32f26
265
gdb-subrange-no-type.patch
Normal file
265
gdb-subrange-no-type.patch
Normal file
@ -0,0 +1,265 @@
|
||||
commit 7d8bdfbdfd0e38fb314d70785b0516181b8d4e77
|
||||
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Mon Mar 26 20:49:51 2012 +0200
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=806920
|
||||
gdb.dwarf2/dw2-subrange-no-type.exp
|
||||
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -9014,6 +9014,44 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
/* Preserve BASE_TYPE's original type, just set its LENGTH. */
|
||||
check_typedef (base_type);
|
||||
|
||||
+ /* Dwarf-2 specifications explicitly allows to create subrange types
|
||||
+ without specifying a base type.
|
||||
+ In that case, the base type must be set to the type of
|
||||
+ the lower bound, upper bound or count, in that order, if any of these
|
||||
+ three attributes references an object that has a type.
|
||||
+ If no base type is found, the Dwarf-2 specifications say that
|
||||
+ a signed integer type of size equal to the size of an address should
|
||||
+ be used.
|
||||
+ For the following C code: `extern char gdb_int [];'
|
||||
+ GCC produces an empty range DIE.
|
||||
+ FIXME: muller/2010-05-28: Possible references to object for low bound,
|
||||
+ high bound or count are not yet handled by this code. */
|
||||
+ if (TYPE_CODE (base_type) == TYPE_CODE_VOID)
|
||||
+ {
|
||||
+ struct objfile *objfile = cu->objfile;
|
||||
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
||||
+ int addr_size = gdbarch_addr_bit (gdbarch) /8;
|
||||
+ struct type *int_type = objfile_type (objfile)->builtin_int;
|
||||
+
|
||||
+ /* Test "int", "long int", and "long long int" objfile types,
|
||||
+ and select the first one having a size above or equal to the
|
||||
+ architecture address size. */
|
||||
+ if (int_type && TYPE_LENGTH (int_type) >= addr_size)
|
||||
+ base_type = int_type;
|
||||
+ else
|
||||
+ {
|
||||
+ int_type = objfile_type (objfile)->builtin_long;
|
||||
+ if (int_type && TYPE_LENGTH (int_type) >= addr_size)
|
||||
+ base_type = int_type;
|
||||
+ else
|
||||
+ {
|
||||
+ int_type = objfile_type (objfile)->builtin_long_long;
|
||||
+ if (int_type && TYPE_LENGTH (int_type) >= addr_size)
|
||||
+ base_type = int_type;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* The die_type call above may have already set the type for this DIE. */
|
||||
range_type = get_die_type (die, cu);
|
||||
if (range_type)
|
||||
@@ -9141,44 +9179,6 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
TYPE_HIGH_BOUND (range_type) = high;
|
||||
}
|
||||
|
||||
- /* Dwarf-2 specifications explicitly allows to create subrange types
|
||||
- without specifying a base type.
|
||||
- In that case, the base type must be set to the type of
|
||||
- the lower bound, upper bound or count, in that order, if any of these
|
||||
- three attributes references an object that has a type.
|
||||
- If no base type is found, the Dwarf-2 specifications say that
|
||||
- a signed integer type of size equal to the size of an address should
|
||||
- be used.
|
||||
- For the following C code: `extern char gdb_int [];'
|
||||
- GCC produces an empty range DIE.
|
||||
- FIXME: muller/2010-05-28: Possible references to object for low bound,
|
||||
- high bound or count are not yet handled by this code. */
|
||||
- if (TYPE_CODE (base_type) == TYPE_CODE_VOID)
|
||||
- {
|
||||
- struct objfile *objfile = cu->objfile;
|
||||
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
||||
- int addr_size = gdbarch_addr_bit (gdbarch) /8;
|
||||
- struct type *int_type = objfile_type (objfile)->builtin_int;
|
||||
-
|
||||
- /* Test "int", "long int", and "long long int" objfile types,
|
||||
- and select the first one having a size above or equal to the
|
||||
- architecture address size. */
|
||||
- if (int_type && TYPE_LENGTH (int_type) >= addr_size)
|
||||
- base_type = int_type;
|
||||
- else
|
||||
- {
|
||||
- int_type = objfile_type (objfile)->builtin_long;
|
||||
- if (int_type && TYPE_LENGTH (int_type) >= addr_size)
|
||||
- base_type = int_type;
|
||||
- else
|
||||
- {
|
||||
- int_type = objfile_type (objfile)->builtin_long_long;
|
||||
- if (int_type && TYPE_LENGTH (int_type) >= addr_size)
|
||||
- base_type = int_type;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
/* DW_AT_bit_stride is currently unsupported as we count in bytes. */
|
||||
attr = dwarf2_attr (die, DW_AT_byte_stride, cu);
|
||||
if (attr && attr_form_is_block (attr) && cu->language != language_ada)
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S
|
||||
@@ -0,0 +1,121 @@
|
||||
+/* 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/>. */
|
||||
+
|
||||
+/* Debug information */
|
||||
+
|
||||
+ .section .data
|
||||
+vardata:
|
||||
+ .rept 129
|
||||
+ .ascii "x"
|
||||
+ .endr
|
||||
+ .ascii "UNSEEN\0"
|
||||
+
|
||||
+ .section .debug_info
|
||||
+.Lcu1_begin:
|
||||
+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
|
||||
+.Lcu1_start:
|
||||
+ .2byte 2 /* DWARF version number */
|
||||
+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
|
||||
+ .byte 4 /* Pointer Size (in bytes) */
|
||||
+
|
||||
+ /* CU die */
|
||||
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
|
||||
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
|
||||
+ .byte 2 /* DW_AT_language (C) - */
|
||||
+
|
||||
+.Larray_type:
|
||||
+ .uleb128 2 /* Abbrev: DW_TAG_array_type */
|
||||
+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
|
||||
+
|
||||
+ .uleb128 8 /* Abbrev: DW_TAG_subrange_type without DW_AT_type */
|
||||
+ .byte 0 /* DW_AT_lower_bound */
|
||||
+ .byte 128 /* DW_AT_upper_bound */
|
||||
+
|
||||
+ .byte 0 /* End of children of die */
|
||||
+
|
||||
+.Lchar_type:
|
||||
+ .uleb128 4 /* Abbrev: DW_TAG_base_type */
|
||||
+ .ascii "char\0" /* DW_AT_name */
|
||||
+ .byte 1 /* DW_AT_byte_size */
|
||||
+ .byte 6 /* DW_AT_encoding */
|
||||
+
|
||||
+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */
|
||||
+ .ascii "notype_string\0" /* DW_AT_name */
|
||||
+ .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */
|
||||
+ .byte 2f - 1f /* DW_AT_location */
|
||||
+1: .byte 3 /* DW_OP_addr */
|
||||
+ .4byte vardata /* <addr> */
|
||||
+2:
|
||||
+
|
||||
+ .byte 0 /* End of children of CU */
|
||||
+.Lcu1_end:
|
||||
+
|
||||
+ .section .debug_abbrev
|
||||
+.Ldebug_abbrev0:
|
||||
+ .uleb128 1 /* Abbrev code */
|
||||
+ .uleb128 0x11 /* DW_TAG_compile_unit */
|
||||
+ .byte 0x1 /* has_children */
|
||||
+ .uleb128 0x25 /* DW_AT_producer */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0x13 /* DW_AT_language */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
+ .uleb128 2 /* Abbrev code */
|
||||
+ .uleb128 0x1 /* TAG: DW_TAG_array_type */
|
||||
+ .byte 0x1 /* DW_children_yes */
|
||||
+ .uleb128 0x49 /* DW_AT_type */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
+ .uleb128 4 /* Abbrev code */
|
||||
+ .uleb128 0x24 /* DW_TAG_base_type */
|
||||
+ .byte 0x0 /* no_children */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0xb /* DW_AT_byte_size */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .uleb128 0x3e /* DW_AT_encoding */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
+ .uleb128 6 /* Abbrev code */
|
||||
+ .uleb128 0x34 /* DW_TAG_variable */
|
||||
+ .byte 0x0 /* no_children */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0x49 /* DW_AT_type */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .uleb128 0x2 /* DW_AT_location */
|
||||
+ .uleb128 0xa /* DW_FORM_block1 */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
+ .uleb128 8 /* Abbrev code */
|
||||
+ .uleb128 0x21 /* DW_TAG_subrange_type without DW_AT_type */
|
||||
+ .byte 0x0 /* no children */
|
||||
+ .uleb128 0x22 /* DW_AT_lower_bound */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .uleb128 0x2f /* DW_AT_upper_bound */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
+ .byte 0x0 /* Terminator */
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp
|
||||
@@ -0,0 +1,39 @@
|
||||
+# 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/>.
|
||||
+load_lib dwarf.exp
|
||||
+
|
||||
+# https://bugzilla.redhat.com/show_bug.cgi?id=806920
|
||||
+# read_subrange_type <TYPE_CODE (base_type) == TYPE_CODE_VOID> reinitialization
|
||||
+# of BASE_TYPE was done too late, it affects DW_TAG_subrange_type without
|
||||
+# specified DW_AT_type, present only in XLF produced code.
|
||||
+
|
||||
+# This test can only be run on targets which support DWARF-2 and use gas.
|
||||
+if {![dwarf2_support]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile dw2-subrange-no-type
|
||||
+set srcfile ${testfile}.S
|
||||
+set executable ${testfile}.x
|
||||
+set binfile ${objdir}/${subdir}/${executable}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+
|
||||
+gdb_test "ptype notype_string" {type = char \[129\]}
|
||||
+gdb_test "p notype_string" " = 'x' <repeats 129 times>"
|
9
gdb.spec
9
gdb.spec
@ -33,7 +33,7 @@ Version: 7.4.50.%{snap}
|
||||
|
||||
# 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: 32%{?dist}
|
||||
Release: 33%{?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
|
||||
@ -572,6 +572,9 @@ Patch658: gdb-x86-onstack-2of2.patch
|
||||
Patch655: gdb-die-cu-offset-1of2.patch
|
||||
Patch656: gdb-die-cu-offset-2of2.patch
|
||||
|
||||
# [vla] Fix regression on no type for subrange from IBM XLF Fortran (BZ 806920).
|
||||
Patch660: gdb-subrange-no-type.patch
|
||||
|
||||
%if 0%{!?rhel:1} || 0%{?rhel} > 6
|
||||
# RL_STATE_FEDORA_GDB would not be found for:
|
||||
# Patch642: gdb-readline62-ask-more-rh.patch
|
||||
@ -861,6 +864,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
||||
%patch658 -p1
|
||||
%patch655 -p1
|
||||
%patch656 -p1
|
||||
%patch660 -p1
|
||||
|
||||
%patch393 -p1
|
||||
%if 0%{!?el5:1} || 0%{?scl:1}
|
||||
@ -1329,6 +1333,9 @@ fi
|
||||
%endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch"
|
||||
|
||||
%changelog
|
||||
* Mon Mar 26 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-33.fc17
|
||||
- [vla] Fix regression on no type for subrange from IBM XLF Fortran (BZ 806920).
|
||||
|
||||
* Sat Mar 17 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-32.fc17
|
||||
- Fix loading of core files without build-ids but with build-ids in executables.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user