- Revert the previous patch (7.2-25.fc14).

- Fix .gdb_index memory corruption (BZ 653644).
This commit is contained in:
Jan Kratochvil 2010-11-18 05:32:07 +01:00
parent 23452f19a6
commit 0c33c37fb6
5 changed files with 39 additions and 973 deletions

View File

@ -1,313 +0,0 @@
http://sourceware.org/ml/gdb-patches/2010-11/msg00084.html
Subject: [new testcase] Regression 7.1->7.2 for iFort [Re: [RFA-v2] dwarf debug format: Support DW_AT_variable_parameter attribute]
On Fri, 21 May 2010 22:45:35 +0200, Pierre Muller wrote:
> Thanks, I committed the patch.
commit 570d5d01de35effada277a69552c0903a4928241
Author: Pierre Muller <muller@ics.u-strasbg.fr>
Date: Fri May 21 20:45:18 2010 +0000
* dwarf2read.c (new_symbol): Handle DW_AT_variable_parameter
attribute.
Please revert this patch.
>From the DWARF-4 description of DW_AT_variable_parameter I do not think it
changes the data structures meaning in any way. It just states which data can
be modified by whom. I do not think this is useful for GDB in any way.
> > I think it would be improved by a test case, but that is up to you.
>
> This test would be pascal specific anyhow,
I believe the Pascal compiler should generate different debug info. For the
`var' keyword you can either (a) use DW_TAG_reference_type and point
DW_AT_location at the pointer or (b) use DW_OP_deref (as iFort does) on the
passed pointer and point DW_AT_location at the value itself.
DW_AT_variable_parameter would be true only for the (a) choice.
1 subroutine f (i)
2 integer i
3 i = 2
4 end
5 program varparam
6 integer m
7 m = 1
8 call f (m)
9 write(*,*) m
10 end
for iFort 11.1 20100806 it regressed this code, GDB-7.1 displayed:
Breakpoint 1, f (i=1) at varparam.f90:3
3 i = 2
(gdb) p i
$1 = 1
while GDB-7.2 displays:
Breakpoint 2, f (i=@0x1) at varparam.f90:3
3 i = 2
(gdb) p i
$1 = (REF TO -> ( INTEGER(4) )) @0x1: <error reading variable>
(note that `0x1' GDB considers as an address here)
A new testcase for the iFort usage case is attached.
No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu.
I will then check-in the testcase or you can or so.
Regards,
Jan
gdb/
2010-11-04 Jan Kratochvil <jan.kratochvil@redhat.com>
Revert:
2010-05-21 Pierre Muller <muller@ics.u-strasbg.fr>
* dwarf2read.c (new_symbol): Handle DW_AT_variable_parameter
attribute.
gdb/testsuite/
2010-11-04 Jan Kratochvil <jan.kratochvil@redhat.com>
* dw2-ifort-parameter-debug.S: New file.
* dw2-ifort-parameter.c: New file.
* dw2-ifort-parameter.exp: New file.
Index: gdb-7.2/gdb/dwarf2read.c
===================================================================
--- gdb-7.2.orig/gdb/dwarf2read.c 2010-11-07 05:24:01.000000000 +0100
+++ gdb-7.2/gdb/dwarf2read.c 2010-11-07 05:36:34.000000000 +0100
@@ -10474,14 +10474,6 @@ new_symbol (struct die_info *die, struct
{
dwarf2_const_value (attr, sym, cu);
}
- attr = dwarf2_attr (die, DW_AT_variable_parameter, cu);
- if (attr && DW_UNSND (attr))
- {
- struct type *ref_type;
-
- ref_type = lookup_reference_type (SYMBOL_TYPE (sym));
- SYMBOL_TYPE (sym) = ref_type;
- }
add_symbol_to_list (sym, cu->list_in_scope);
break;
Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S 2010-11-07 05:36:18.000000000 +0100
@@ -0,0 +1,122 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 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/>. */
+
+ .section .debug_info
+.Lcu1_begin:
+ /* CU header */
+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
+.Lcu1_start:
+ .2byte 2 /* DWARF Version */
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
+ .byte 4 /* Pointer size */
+
+ /* CU die */
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
+ .ascii "file1.txt\0" /* DW_AT_name */
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
+ .byte 1 /* DW_AT_language (C) */
+ .4byte func /* DW_AT_low_pc */
+ .4byte main /* DW_AT_high_pc */
+
+ .uleb128 2 /* Abbrev: DW_TAG_subprogram */
+ .byte 1 /* DW_AT_external */
+ .ascii "func\0" /* DW_AT_name */
+ .4byte func /* DW_AT_low_pc */
+ .4byte main /* DW_AT_high_pc */
+
+ .uleb128 3 /* Abbrev: DW_TAG_formal_parameter */
+ .ascii "param\0" /* DW_AT_name */
+ .byte 1 /* DW_AT_variable_parameter */
+ .4byte .Ltype_int - .Lcu1_begin /* DW_AT_type */
+ .byte 2f - 1f /* DW_AT_location */
+1: .byte 3 /* DW_OP_addr */
+ .4byte ptr /* <addr> */
+ .byte 0x6 /* DW_OP_deref */
+2:
+
+ .byte 0 /* End of children of func */
+
+.Ltype_int:
+ .uleb128 4 /* Abbrev: DW_TAG_base_type */
+ .ascii "int\0" /* DW_AT_name */
+ .byte 4 /* DW_AT_byte_size */
+ .byte 5 /* DW_AT_encoding */
+
+ .byte 0 /* End of children of CU */
+.Lcu1_end:
+
+/* Abbrev table */
+ .section .debug_abbrev
+.Labbrev1_begin:
+ .uleb128 1 /* Abbrev code */
+ .uleb128 0x11 /* DW_TAG_compile_unit */
+ .byte 1 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x25 /* DW_AT_producer */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x13 /* DW_AT_language */
+ .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 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 2 /* Abbrev code */
+ .uleb128 0x2e /* DW_TAG_subprogram */
+ .byte 1 /* has_children */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0xc /* DW_FORM_flag */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 3 /* Abbrev code */
+ .uleb128 0x05 /* DW_TAG_formal_parameter */
+ .byte 0 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x4b /* DW_AT_variable_parameter */
+ .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 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 4 /* Abbrev code */
+ .uleb128 0x24 /* DW_TAG_base_type */
+ .byte 0 /* has_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 */
+
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c 2010-11-07 05:36:18.000000000 +0100
@@ -0,0 +1,31 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 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/>. */
+
+int value = 0xdeadf00d;
+int *ptr = &value;
+
+void
+func (void)
+{
+}
+
+int
+main (void)
+{
+ func ();
+ return 0;
+}
Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp 2010-11-07 05:36:18.000000000 +0100
@@ -0,0 +1,40 @@
+# Copyright 2010 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/>.
+
+# Verify DW_AT_variable_parameter does not modify the data structures meaning
+# for GDB, as being used by iFort.
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+ && ![istarget *-*-gnu*]
+ && ![istarget *-*-elf*]
+ && ![istarget *-*-openbsd*]
+ && ![istarget arm-*-eabi*]
+ && ![istarget powerpc-*-eabi*]} {
+ return 0
+}
+
+set testfile "dw2-ifort-parameter"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.c ${testfile}-debug.S] {nodebug}] } {
+ return -1
+}
+
+if ![runto func] {
+ return -1
+}
+
+gdb_test "p/x param" " = 0xdeadf00d"

View File

@ -1,204 +0,0 @@
http://sourceware.org/ml/gdb-patches/2010-11/msg00107.html
Subject: [patch 1/2] Code cleanup: New init_one_comp_unit
Hi,
unify some code into a function, to be extended in the next patch.
Thanks,
Jan
gdb/
2010-11-06 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup.
* dwarf2read.c (alloc_one_comp_unit): Rename prototype to ...
(init_one_comp_unit): ... this one.
(prepare_one_comp_unit): New prototype.
(dw2_require_line_header, process_psymtab_comp_unit): Use
init_one_comp_unit.
(process_psymtab_comp_unit): Use prepare_one_comp_unit.
(load_partial_comp_unit): Remove variable attr. Use
init_one_comp_unit with xmalloc. Use prepare_one_comp_unit.
(load_full_comp_unit): Use init_one_comp_unit with xmalloc. Use
prepare_one_comp_unit.
(read_signatured_type): Remove variable attr. Use init_one_comp_unit.
Use prepare_one_comp_unit.
(alloc_one_comp_unit): Rename to ...
(init_one_comp_unit): ... here and remove there calloc, new parameter
cu.
(prepare_one_comp_unit): New function.
Index: gdb-7.2/gdb/dwarf2read.c
===================================================================
--- gdb-7.2.orig/gdb/dwarf2read.c 2010-11-07 05:36:34.000000000 +0100
+++ gdb-7.2/gdb/dwarf2read.c 2010-11-07 05:38:21.000000000 +0100
@@ -1214,7 +1214,11 @@ static struct dwarf2_per_cu_data *dwarf2
static struct dwarf2_per_cu_data *dwarf2_find_comp_unit
(unsigned int offset, struct objfile *objfile);
-static struct dwarf2_cu *alloc_one_comp_unit (struct objfile *objfile);
+static void init_one_comp_unit (struct dwarf2_cu *cu,
+ struct objfile *objfile);
+
+static void prepare_one_comp_unit (struct dwarf2_cu *cu,
+ struct die_info *comp_unit_die);
static void free_one_comp_unit (void *);
@@ -1980,10 +1984,7 @@ dw2_require_line_header (struct objfile
return;
this_cu->v.quick->read_lines = 1;
- memset (&cu, 0, sizeof (cu));
- cu.objfile = objfile;
- obstack_init (&cu.comp_unit_obstack);
-
+ init_one_comp_unit (&cu, objfile);
cleanups = make_cleanup (free_stack_comp_unit, &cu);
dwarf2_read_section (objfile, &dwarf2_per_objfile->info);
@@ -2978,10 +2979,7 @@ process_psymtab_comp_unit (struct objfil
CORE_ADDR best_lowpc = 0, best_highpc = 0;
struct die_reader_specs reader_specs;
- memset (&cu, 0, sizeof (cu));
- cu.objfile = objfile;
- obstack_init (&cu.comp_unit_obstack);
-
+ init_one_comp_unit (&cu, objfile);
back_to_inner = make_cleanup (free_stack_comp_unit, &cu);
info_ptr = partial_read_comp_unit_head (&cu.header, info_ptr,
@@ -3035,12 +3033,7 @@ process_psymtab_comp_unit (struct objfil
return info_ptr;
}
- /* Set the language we're debugging. */
- attr = dwarf2_attr (comp_unit_die, DW_AT_language, &cu);
- if (attr)
- set_cu_language (DW_UNSND (attr), &cu);
- else
- set_cu_language (language_minimal, &cu);
+ prepare_one_comp_unit (&cu, comp_unit_die);
/* Allocate a new partial symbol table structure. */
attr = dwarf2_attr (comp_unit_die, DW_AT_name, &cu);
@@ -3263,7 +3256,8 @@ load_partial_comp_unit (struct dwarf2_pe
info_ptr = dwarf2_per_objfile->info.buffer + this_cu->offset;
beg_of_comp_unit = info_ptr;
- cu = alloc_one_comp_unit (objfile);
+ cu = xmalloc (sizeof (*cu));
+ init_one_comp_unit (cu, objfile);
/* ??? Missing cleanup for CU? */
@@ -3290,12 +3284,7 @@ load_partial_comp_unit (struct dwarf2_pe
info_ptr = read_full_die (&reader_specs, &comp_unit_die, info_ptr,
&has_children);
- /* Set the language we're debugging. */
- attr = dwarf2_attr (comp_unit_die, DW_AT_language, cu);
- if (attr)
- set_cu_language (DW_UNSND (attr), cu);
- else
- set_cu_language (language_minimal, cu);
+ prepare_one_comp_unit (cu, comp_unit_die);
/* Check if comp unit has_children.
If so, read the rest of the partial symbols from this comp unit.
@@ -4227,7 +4216,8 @@ load_full_comp_unit (struct dwarf2_per_c
info_ptr = dwarf2_per_objfile->info.buffer + offset;
beg_of_comp_unit = info_ptr;
- cu = alloc_one_comp_unit (objfile);
+ cu = xmalloc (sizeof (*cu));
+ init_one_comp_unit (cu, objfile);
/* If an error occurs while loading, release our storage. */
free_cu_cleanup = make_cleanup (free_one_comp_unit, cu);
@@ -4254,11 +4244,7 @@ load_full_comp_unit (struct dwarf2_per_c
all objfiles needed for references have been loaded yet, and symbol
table processing isn't initialized. But we have to set the CU language,
or we won't be able to build types correctly. */
- attr = dwarf2_attr (cu->dies, DW_AT_language, cu);
- if (attr)
- set_cu_language (DW_UNSND (attr), cu);
- else
- set_cu_language (language_minimal, cu);
+ prepare_one_comp_unit (cu, cu->dies);
/* Similarly, if we do not read the producer, we can not apply
producer-specific interpretation. */
@@ -12617,17 +12603,15 @@ read_signatured_type (struct objfile *ob
struct dwarf2_cu *cu;
ULONGEST signature;
struct cleanup *back_to, *free_cu_cleanup;
- struct attribute *attr;
dwarf2_read_section (objfile, &dwarf2_per_objfile->types);
types_ptr = dwarf2_per_objfile->types.buffer + type_sig->offset;
gdb_assert (type_sig->per_cu.cu == NULL);
- cu = xmalloc (sizeof (struct dwarf2_cu));
- memset (cu, 0, sizeof (struct dwarf2_cu));
- obstack_init (&cu->comp_unit_obstack);
- cu->objfile = objfile;
+ cu = xmalloc (sizeof (*cu));
+ init_one_comp_unit (cu, objfile);
+
type_sig->per_cu.cu = cu;
cu->per_cu = &type_sig->per_cu;
@@ -12659,11 +12643,7 @@ read_signatured_type (struct objfile *ob
all objfiles needed for references have been loaded yet, and symbol
table processing isn't initialized. But we have to set the CU language,
or we won't be able to build types correctly. */
- attr = dwarf2_attr (cu->dies, DW_AT_language, cu);
- if (attr)
- set_cu_language (DW_UNSND (attr), cu);
- else
- set_cu_language (language_minimal, cu);
+ prepare_one_comp_unit (cu, cu->dies);
do_cleanups (back_to);
@@ -13755,15 +13735,29 @@ dwarf2_find_comp_unit (unsigned int offs
return this_cu;
}
-/* Malloc space for a dwarf2_cu for OBJFILE and initialize it. */
+/* Initialize dwarf2_cu CU for OBJFILE in a pre-allocated space. */
-static struct dwarf2_cu *
-alloc_one_comp_unit (struct objfile *objfile)
+static void
+init_one_comp_unit (struct dwarf2_cu *cu, struct objfile *objfile)
{
- struct dwarf2_cu *cu = xcalloc (1, sizeof (struct dwarf2_cu));
+ memset (cu, 0, sizeof (*cu));
cu->objfile = objfile;
obstack_init (&cu->comp_unit_obstack);
- return cu;
+}
+
+/* Initiailize basic fields of dwarf_cu CU according to DIE COMP_UNIT_DIE. */
+
+static void
+prepare_one_comp_unit (struct dwarf2_cu *cu, struct die_info *comp_unit_die)
+{
+ struct attribute *attr;
+
+ /* Set the language we're debugging. */
+ attr = dwarf2_attr (comp_unit_die, DW_AT_language, cu);
+ if (attr)
+ set_cu_language (DW_UNSND (attr), cu);
+ else
+ set_cu_language (language_minimal, cu);
}
/* Release one cached compilation unit, CU. We unlink it from the tree

View File

@ -1,448 +0,0 @@
http://sourceware.org/ml/gdb-patches/2010-11/msg00108.html
Subject: [patch 2/2] iFort compat.: case insensitive symbols (PR 11313)
Hi,
iFort (Intel Fortran compiler) produces DIEs like:
<1><1dc>: Abbrev Number: 6 (DW_TAG_module)
<1e0> DW_AT_name : MOD1
But Fortran is case insensitive, therefore GDB lowercases any user input
first. Symbols cannot match. gfortran always produces lowercased DIE names.
I was told by Jakub Jelinek GCC frontend will never be properly case
preserving - to output "Mod1" if user stated it in such case in the sources.
Therefore GDB will now lowercase any case insensitive symbol names on their
read-in from DWARF.
ELF symbol tables are currently not touched - their matching to their CU (and
thus to their DW_AT_identifier_case / DW_AT_language) is expensive and it does
not seem to me to be needed for iFort as only the module names are uppercased
there.
For the iFort compatibility there is also needed:
[new testcase] Regression 7.1->7.2 for iFort [Re: [RFA-v2] dwarf debug format: Support DW_AT_variable_parameter attribute]
http://sourceware.org/ml/gdb-patches/2010-11/msg00084.html
No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu.
Thanks,
Jan
gdb/
2010-11-07 Jan Kratochvil <jan.kratochvil@redhat.com>
PR 11313 - case insensitive identifiers in DWARF not in lowercase.
* dwarf2read.c: Include ctype.h.
(struct dwarf2_cu) <case_sensitivity>: New.
(struct attribute) <string_is_canonical>: Update the comment.
(canonical_case): New declaration.
(read_partial_die): Call canonical_case.
(canonical_case): New function.
(dwarf2_canonicalize_name): Update the function comment. Call
canonical_case, adjust the obstack allocation.
(dwarf2_name): Call canonical_case, set DW_STRING_IS_CANONICAL.
(init_one_comp_unit, prepare_one_comp_unit): Set cu->case_sensitivity.
gdb/testsuite/
2010-11-07 Jan Kratochvil <jan.kratochvil@redhat.com>
PR 11313 - case insensitive identifiers in DWARF not in lowercase.
* gdb.dwarf2/dw2-case-insensitive-debug.S: New.
* gdb.dwarf2/dw2-case-insensitive.c: New.
* gdb.dwarf2/dw2-case-insensitive.exp: New.
* gdb.mi/mi-var-child-f.exp (mi_runto): Use lowercase main__.
Index: gdb-7.2/gdb/dwarf2read.c
===================================================================
--- gdb-7.2.orig/gdb/dwarf2read.c 2010-11-07 05:38:21.000000000 +0100
+++ gdb-7.2/gdb/dwarf2read.c 2010-11-07 05:38:47.000000000 +0100
@@ -55,6 +55,7 @@
#include "gdb_stat.h"
#include "completer.h"
#include "top.h"
+#include <ctype.h>
#include <fcntl.h>
#include "gdb_string.h"
@@ -376,6 +377,10 @@ struct dwarf2_cu
DIEs for namespaces, we don't need to try to infer them
from mangled names. */
unsigned int has_namespace_info : 1;
+
+ /* Are identifiers in this CU case sensitive or should they be lowercased
+ before storing them into GDB symbol tables? */
+ enum case_sensitivity case_sensitivity;
};
/* When using the index (and thus not using psymtabs), each CU has an
@@ -621,9 +626,10 @@ struct attribute
ENUM_BITFIELD(dwarf_attribute) name : 16;
ENUM_BITFIELD(dwarf_form) form : 15;
- /* Has DW_STRING already been updated by dwarf2_canonicalize_name? This
- field should be in u.str (existing only for DW_STRING) but it is kept
- here for better struct attribute alignment. */
+ /* Has DW_STRING already been updated by dwarf2_canonicalize_name or
+ canonical_case? This field should be in u.str (existing only for
+ DW_STRING) but it is kept here for better struct attribute alignment.
+ */
unsigned int string_is_canonical : 1;
union
@@ -1109,6 +1115,9 @@ static gdb_byte *read_full_die (const st
static void process_die (struct die_info *, struct dwarf2_cu *);
+static char *canonical_case (char *name, struct dwarf2_cu *cu,
+ struct obstack *obstack);
+
static char *dwarf2_canonicalize_name (char *, struct dwarf2_cu *,
struct obstack *);
@@ -8589,7 +8598,8 @@ read_partial_die (struct partial_die_inf
case DW_TAG_enumerator:
/* These tags always have simple identifiers already; no need
to canonicalize them. */
- part_die->name = DW_STRING (&attr);
+ part_die->name = canonical_case (DW_STRING (&attr), cu,
+ &cu->objfile->objfile_obstack);
break;
default:
part_die->name
@@ -11043,7 +11053,36 @@ sibling_die (struct die_info *die)
return die->sibling;
}
-/* Get name of a die, return NULL if not found. */
+/* Convert NAME to the lower case if CU is case_sensitive_off. Allocate
+ memory on OBSTACK if needed, otherwise return the NAME pointer. */
+
+static char *
+canonical_case (char *name, struct dwarf2_cu *cu,
+ struct obstack *obstack)
+{
+ char *retval;
+ int i;
+
+ if (cu->case_sensitivity == case_sensitive_on)
+ return name;
+
+ for (i = 0; name[i] != 0; i++)
+ if (tolower (name[i]) != name[i])
+ break;
+ if (name[i] == 0)
+ return name;
+
+ retval = obstack_alloc (obstack, strlen (name) + 1);
+
+ for (i = 0; name[i] != 0; i++)
+ retval[i] = tolower (name[i]);
+ retval[i] = 0;
+
+ return retval;
+}
+
+/* Get name of a die, return NULL if not found. canonical_case is always
+ already called for the returned string. */
static char *
dwarf2_canonicalize_name (char *name, struct dwarf2_cu *cu,
@@ -11055,14 +11094,26 @@ dwarf2_canonicalize_name (char *name, st
if (canon_name != NULL)
{
- if (strcmp (canon_name, name) != 0)
- name = obsavestring (canon_name, strlen (canon_name),
+ char *cased_name;
+
+ cased_name = canonical_case (canon_name, cu, obstack);
+
+ /* Push CASED_NAME on OBSTACK only if it isn't already pushed there
+ by canonical_case and if it was allocated using xmalloc by
+ cp_canonicalize_string. */
+ if (strcmp (canon_name, cased_name) == 0
+ && strcmp (canon_name, name) != 0)
+ name = obsavestring (cased_name, strlen (cased_name),
obstack);
+ else
+ name = cased_name;
xfree (canon_name);
+
+ return name;
}
}
- return name;
+ return canonical_case (name, cu, obstack);
}
/* Get name of a die, return NULL if not found. */
@@ -11088,7 +11139,13 @@ dwarf2_name (struct die_info *die, struc
case DW_TAG_enumeration_type:
case DW_TAG_enumerator:
/* These tags always have simple identifiers already; no need
- to canonicalize them. */
+ to call dwarf2_canonicalize_name for them. */
+ if (!DW_STRING_IS_CANONICAL (attr))
+ {
+ DW_STRING (attr) = canonical_case (DW_STRING (attr), cu,
+ &cu->objfile->objfile_obstack);
+ DW_STRING_IS_CANONICAL (attr) = 1;
+ }
return DW_STRING (attr);
case DW_TAG_subprogram:
@@ -13743,6 +13800,7 @@ init_one_comp_unit (struct dwarf2_cu *cu
memset (cu, 0, sizeof (*cu));
cu->objfile = objfile;
obstack_init (&cu->comp_unit_obstack);
+ cu->case_sensitivity = case_sensitive_on;
}
/* Initiailize basic fields of dwarf_cu CU according to DIE COMP_UNIT_DIE. */
@@ -13758,6 +13816,13 @@ prepare_one_comp_unit (struct dwarf2_cu
set_cu_language (DW_UNSND (attr), cu);
else
set_cu_language (language_minimal, cu);
+
+ attr = dwarf2_attr (comp_unit_die, DW_AT_identifier_case, cu);
+ if (attr)
+ cu->case_sensitivity = (DW_UNSND (attr) == DW_ID_case_sensitive
+ ? case_sensitive_on : case_sensitive_off);
+ else
+ cu->case_sensitivity = cu->language_defn->la_case_sensitivity;
}
/* Release one cached compilation unit, CU. We unlink it from the tree
Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S 2010-11-07 05:38:35.000000000 +0100
@@ -0,0 +1,122 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2004, 2007, 2008, 2009, 2010 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/>. */
+
+ .section .debug_info
+.Lcu1_begin:
+ /* CU header */
+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
+.Lcu1_start:
+ .2byte 2 /* DWARF Version */
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
+ .byte 4 /* Pointer size */
+
+ /* CU die */
+ .uleb128 2 /* Abbrev: DW_TAG_compile_unit */
+ .ascii "file1.txt\0" /* DW_AT_name */
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
+ .byte 2 /* DW_AT_language (DW_LANG_C) */
+ .byte 3 /* DW_AT_identifier_case (DW_ID_case_insensitive) */
+ .4byte FUNC_attr /* DW_AT_low_pc */
+ .4byte FUNC_lang /* DW_AT_high_pc */
+
+ .uleb128 3 /* Abbrev: DW_TAG_subprogram */
+ .byte 1 /* DW_AT_external */
+ .ascii "FUNC_attr\0" /* DW_AT_name */
+ .4byte FUNC_attr /* DW_AT_low_pc */
+ .4byte FUNC_lang /* DW_AT_high_pc */
+
+ .byte 0 /* End of children of CU */
+.Lcu1_end:
+
+.Lcu2_begin:
+ /* CU header */
+ .4byte .Lcu2_end - .Lcu2_start /* Length of Compilation Unit */
+.Lcu2_start:
+ .2byte 2 /* DWARF Version */
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
+ .byte 4 /* Pointer size */
+
+ /* CU die */
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
+ .ascii "file1.txt\0" /* DW_AT_name */
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
+ .byte 8 /* DW_AT_language (DW_LANG_Fortran90) */
+ .4byte FUNC_lang /* DW_AT_low_pc */
+ .4byte main /* DW_AT_high_pc */
+
+ .uleb128 3 /* Abbrev: DW_TAG_subprogram */
+ .byte 1 /* DW_AT_external */
+ .ascii "FUNC_lang\0" /* DW_AT_name */
+ .4byte FUNC_lang /* DW_AT_low_pc */
+ .4byte main /* DW_AT_high_pc */
+
+ .byte 0 /* End of children of CU */
+.Lcu2_end:
+
+/* Abbrev table */
+ .section .debug_abbrev
+.Labbrev1_begin:
+ .uleb128 1 /* Abbrev code */
+ .uleb128 0x11 /* DW_TAG_compile_unit */
+ .byte 1 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x25 /* DW_AT_producer */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x13 /* DW_AT_language */
+ .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 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 2 /* Abbrev code */
+ .uleb128 0x11 /* DW_TAG_compile_unit */
+ .byte 1 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x25 /* DW_AT_producer */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x13 /* DW_AT_language */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x42 /* DW_AT_identifier_case */
+ .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 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 3 /* Abbrev code */
+ .uleb128 0x2e /* DW_TAG_subprogram */
+ .byte 0 /* has_children */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0xc /* DW_FORM_flag */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c 2010-11-07 05:38:35.000000000 +0100
@@ -0,0 +1,36 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2004, 2007, 2008, 2009, 2010 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 one is DW_LANG_C but it uses DW_ID_case_insensitive. */
+
+void
+FUNC_attr (void)
+{
+}
+
+/* This one has no DW_AT_identifier_case but it is DW_LANG_Fortran90. */
+
+void
+FUNC_lang (void)
+{
+}
+
+int
+main()
+{
+ return 0;
+}
Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp 2010-11-07 05:38:35.000000000 +0100
@@ -0,0 +1,41 @@
+# Copyright 2010 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 test can only be run on targets which support DWARF-2 and use gas.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+ && ![istarget *-*-gnu*]
+ && ![istarget *-*-elf*]
+ && ![istarget *-*-openbsd*]
+ && ![istarget arm-*-eabi*]
+ && ![istarget powerpc-*-eabi*]} {
+ return 0
+}
+
+set testfile "dw2-case-insensitive"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.c ${testfile}-debug.S] {nodebug}] } {
+ return -1
+}
+
+gdb_test_no_output "set language fortran"
+
+if {[gdb_breakpoint "fuNC_attr"] == 1} {
+ pass "setting breakpoint at fuNC_attr"
+}
+
+if {[gdb_breakpoint "fuNC_lang"] == 1} {
+ pass "setting breakpoint at fuNC_lang"
+}
Index: gdb-7.2/gdb/testsuite/gdb.mi/mi-var-child-f.exp
===================================================================
--- gdb-7.2.orig/gdb/testsuite/gdb.mi/mi-var-child-f.exp 2010-01-01 08:32:03.000000000 +0100
+++ gdb-7.2/gdb/testsuite/gdb.mi/mi-var-child-f.exp 2010-11-07 05:38:35.000000000 +0100
@@ -36,7 +36,7 @@ if {[gdb_compile "${srcdir}/${subdir}/${
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
-mi_runto MAIN__
+mi_runto main__
mi_gdb_test "-var-create array * array" \
"\\^done,name=\"array\",numchild=\"3\",value=\".*\",type=\"integer \\(2,-1:1\\)\"" \

View File

@ -0,0 +1,30 @@
https://bugzilla.redhat.com/show_bug.cgi?id=653644
[commit] Fix .gdb_index memory corruption
http://sourceware.org/ml/gdb-patches/2010-11/msg00216.html
http://sourceware.org/ml/gdb-cvs/2010-11/msg00080.html
### src/gdb/ChangeLog 2010/11/16 17:38:34 1.12313
### src/gdb/ChangeLog 2010/11/16 22:04:51 1.12314
## -1,3 +1,8 @@
+2010-11-16 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * dwarf2read.c (dw2_forget_cached_source_info): Clear the FULL_NAMES
+ elements after xfree.
+
2010-11-16 Tom Tromey <tromey@redhat.com>
* gdb-add-index.sh: Really remove.
--- gdb-7.2/gdb/dwarf2read.c.orig 2010-11-18 05:28:59.000000000 +0100
+++ gdb-7.2/gdb/dwarf2read.c 2010-11-18 05:30:17.000000000 +0100
@@ -2084,7 +2084,10 @@ dw2_forget_cached_source_info (struct ob
int j;
for (j = 0; j < cu->v.quick->lines->num_file_names; ++j)
- xfree ((void *) cu->v.quick->full_names[j]);
+ {
+ xfree ((void *) cu->v.quick->full_names[j]);
+ cu->v.quick->full_names[j] = NULL;
+ }
}
}
}

View File

@ -27,7 +27,7 @@ Version: 7.2
# 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%{?_with_upstream:.upstream}%{dist}
Release: 26%{?_with_upstream:.upstream}%{dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and GFDL and BSD and Public Domain
Group: Development/Debuggers
@ -630,10 +630,9 @@ Patch517: gdb-exec-pie-amd64.patch
#=push
Patch520: gdb-bz642879-elfread-sigint-stale.patch
# iFort compat. - case insensitive DWARF not in lowercase (BZ 645773).
Patch522: gdb-bz645773-ifort-case-1of3.patch
Patch523: gdb-bz645773-ifort-case-2of3.patch
Patch524: gdb-bz645773-ifort-case-3of3.patch
# Fix .gdb_index memory corruption (BZ 653644).
#=drop
Patch527: gdb-bz653644-gdbindex-double-free.patch
BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa}
Requires: readline%{?_isa}
@ -908,9 +907,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch517 -p1
%patch518 -p1
%patch520 -p1
%patch522 -p1
%patch523 -p1
%patch524 -p1
%patch527 -p1
%patch393 -p1
%patch335 -p1
@ -1281,6 +1278,10 @@ fi
%endif
%changelog
* Thu Nov 18 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-26.fc14
- Revert the previous patch (7.2-25.fc14).
- Fix .gdb_index memory corruption (BZ 653644).
* Sun Nov 7 2010 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-25.fc14
- iFort compat. - case insensitive DWARF not in lowercase (BZ 645773).