diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a64f76ca70..3f439446de 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2011-06-29 Jan Kratochvil + + Disable epilogue unwinders on recent GCCs. + * amd64-tdep.c (amd64_in_function_epilogue_p): New variable symtab, + initialize it, return 0 on EPILOGUE_UNWIND_VALID. + * dwarf2read.c (process_full_comp_unit): Initialize + EPILOGUE_UNWIND_VALID. + * i386-tdep.c (i386_in_function_epilogue_p): New variable symtab, + initialize it, return 0 on EPILOGUE_UNWIND_VALID. + * symtab.h (struct symtab): New field epilogue_unwind_valid. + 2011-06-29 Jan Kratochvil Code cleanup - reformatting. diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 8dc43638f9..4524f03ecf 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -2219,6 +2219,11 @@ static int amd64_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) { gdb_byte insn; + struct symtab *symtab; + + symtab = find_pc_symtab (pc); + if (symtab && symtab->epilogue_unwind_valid) + return 0; if (target_read_memory (pc, &insn, 1)) return 0; /* Can't read memory at pc. */ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index b17d74de42..e078c62fa3 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -4751,6 +4751,9 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu) */ if (cu->has_loclist && gcc_4_minor >= 0) symtab->locations_valid = 1; + + if (gcc_4_minor >= 5) + symtab->epilogue_unwind_valid = 1; } if (dwarf2_per_objfile->using_index) diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index ab266eff15..366d0fa849 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -1885,6 +1885,11 @@ static int i386_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) { gdb_byte insn; + struct symtab *symtab; + + symtab = find_pc_symtab (pc); + if (symtab && symtab->epilogue_unwind_valid) + return 0; if (target_read_memory (pc, &insn, 1)) return 0; /* Can't read memory at pc. */ diff --git a/gdb/symtab.h b/gdb/symtab.h index 4f96398a43..41a0fd6bb1 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -779,6 +779,11 @@ struct symtab unsigned int locations_valid : 1; + /* DWARF unwinder for this CU is valid even for epilogues (PC at the return + instruction). This is supported by GCC since 4.5.0. */ + + unsigned int epilogue_unwind_valid : 1; + /* The macro table for this symtab. Like the blockvector, this may be shared between different symtabs --- and normally is for all the symtabs in a given compilation unit. */