gdb/gdb-prologue-not-skipped.patch
Jan Kratochvil e05ce76998 Add kernel vDSO workaround (`no loadable ...') on RHEL-5 (kernel BZ 765875).
- Fix skipping of prologues on RHEL-5 gcc-4.1 -O2 -g code (BZ 797889).
- Fix breakpoint warning during 'next' over exit() (Tom Tromey, BZ 797892).
2012-02-29 11:13:05 +01:00

103 lines
3.6 KiB
Diff

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