1 http://sourceware.org/ml/gdb-patches/2012-02/msg00673.html
2 Subject: [patch] Fix regression by me for gcc-4.0...gcc-4.4 i386 -O2 -g parameters (PR 13777)
6 http://sourceware.org/bugzilla/show_bug.cgi?id=13777
12 Temporary breakpoint 1, main (argc=Cannot access memory at address 0x81b7c7cd
14 instead of GDB before my PR 12573 fix/change:
16 Temporary breakpoint 1, main (argc=1, ...
18 I asked before on #gcc since which versions GCC produced DW_AT_location which
19 is for any PC either optimized-out or it has valid value. I was told since
20 gcc-4.0. But that is not true.
22 I have bisected gcc and I found 4.4.0 was still broken, 4.5.0 was correct,
24 commit 25e880b1917bd6bbf07e86b5574c698f3e9472d9
25 Author: rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
26 Date: Sat May 30 00:33:46 2009 +0000
27 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147995 138bc75d-0d04-0410-961f-82ee72b054a4
28 unwind info for epilogues
30 Curiously 4.4.x branch got later also fixed in this case by:
31 commit 61db8bd232daeed3751b43570fab16146145e096
32 Author: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
33 Date: Tue Jun 2 07:18:16 2009 +0000
34 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_4-branch@148070 138bc75d-0d04-0410-961f-82ee72b054a4
35 (but that missed 4.4.0)
37 As 4.5.0 was first FSF GCC with VTA I was trusting more the validity only
38 after VTA and these heuristic results seems to confirm that.
40 I find the change below definitely safe.
42 Someone may object the original PR 12573 (do not try to skip prologue for -O2
43 -g code as it may cause more confusion than anything else) as while it fixed
44 some GDB crashes there is no such purpose anymore with Tom's
45 ambiguous-linespec patch. Still I believe PR 12573 was right to do.
47 No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu.
57 2012-02-28 Jan Kratochvil <jan.kratochvil@redhat.com>
60 * dwarf2read.c (process_full_comp_unit): Set LOCATIONS_VALID only for
64 2012-02-28 Jan Kratochvil <jan.kratochvil@redhat.com>
67 * gdb.dwarf2/dw2-skip-prologue.S (DW_AT_producer): Set it to 4.5.0.
69 --- a/gdb/dwarf2read.c
70 +++ b/gdb/dwarf2read.c
71 @@ -4841,7 +4841,9 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
73 /* GCC-4.0 has started to support -fvar-tracking. GCC-3.x still can
74 produce DW_AT_location with location lists but it can be possibly
75 - invalid without -fvar-tracking.
76 + invalid without -fvar-tracking. Still up to GCC-4.4.x incl. 4.4.0
77 + there were bugs in prologue debug info, fixed later in GCC-4.5
78 + by "unwind info for epilogues" patch (which is not directly related).
80 For -gdwarf-4 type units LOCATIONS_VALID indication is fortunately not
81 needed, it would be wrong due to missing DW_AT_producer there.
82 @@ -4849,7 +4851,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
83 Still one can confuse GDB by using non-standard GCC compilation
84 options - this waits on GCC PR other/32998 (-frecord-gcc-switches).
86 - if (cu->has_loclist && gcc_4_minor >= 0)
87 + if (cu->has_loclist && gcc_4_minor >= 5)
88 symtab->locations_valid = 1;
91 --- a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
92 +++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
94 .4byte func_start /* DW_AT_low_pc */
95 .4byte func_end /* DW_AT_high_pc */
96 .ascii "main.c\0" /* DW_AT_name */
97 - .ascii "GNU C 4.0.0\0" /* DW_AT_producer must be >= 4.0 */
98 + .ascii "GNU C 4.5.0\0" /* DW_AT_producer must be >= 4.5 */
99 .byte 2 /* DW_AT_language (DW_LANG_C) */
101 .uleb128 2 /* Abbrev: DW_TAG_subprogram */