- Update PPC unwinding patches to their upstream variants (BZ 140532).
This commit is contained in:
parent
6614f13981
commit
7a31f8b0c5
427
gdb-6.3-bz140532-ppc-unwinding-fix.patch
Normal file
427
gdb-6.3-bz140532-ppc-unwinding-fix.patch
Normal file
@ -0,0 +1,427 @@
|
||||
2007-02-08 Joel Brobecker <brobecker@gnat.com>
|
||||
Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* rs6000-tdep.c (bl_to_blrl_insn_p): New function.
|
||||
(skip_prologue): Allow bl->blrl used by PIC code.
|
||||
|
||||
--- ./gdb/rs6000-tdep.c 9 Jan 2007 17:58:57 -0000 1.260
|
||||
+++ ./gdb/rs6000-tdep.c 8 Feb 2007 14:22:53 -0000 1.261
|
||||
@@ -902,6 +902,30 @@ store_param_on_stack_p (unsigned long op
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/* Assuming that INSN is a "bl" instruction located at PC, return
|
||||
+ nonzero if the destination of the branch is a "blrl" instruction.
|
||||
+
|
||||
+ This sequence is sometimes found in certain function prologues.
|
||||
+ It allows the function to load the LR register with a value that
|
||||
+ they can use to access PIC data using PC-relative offsets. */
|
||||
+
|
||||
+static int
|
||||
+bl_to_blrl_insn_p (CORE_ADDR pc, int insn)
|
||||
+{
|
||||
+ const int opcode = 18;
|
||||
+ const CORE_ADDR dest = branch_dest (opcode, insn, pc, -1);
|
||||
+ int dest_insn;
|
||||
+
|
||||
+ if (dest == -1)
|
||||
+ return 0; /* Should never happen, but just return zero to be safe. */
|
||||
+
|
||||
+ dest_insn = read_memory_integer (dest, 4);
|
||||
+ if ((dest_insn & 0xfc00ffff) == 0x4c000021) /* blrl */
|
||||
+ return 1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static CORE_ADDR
|
||||
skip_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct rs6000_framedata *fdata)
|
||||
{
|
||||
@@ -1133,6 +1157,12 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR l
|
||||
to save fprs??? */
|
||||
|
||||
fdata->frameless = 0;
|
||||
+
|
||||
+ /* If the return address has already been saved, we can skip
|
||||
+ calls to blrl (for PIC). */
|
||||
+ if (lr_reg != -1 && bl_to_blrl_insn_p (pc, op))
|
||||
+ continue;
|
||||
+
|
||||
/* Don't skip over the subroutine call if it is not within
|
||||
the first three instructions of the prologue and either
|
||||
we have no line table information or the line info tells
|
||||
|
||||
|
||||
|
||||
2007-03-27 Andreas Schwab <schwab@suse.de>
|
||||
Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* dwarf2-frame.c (dwarf2_frame_eh_frame_regnum): Rename to...
|
||||
(dwarf2_frame_adjust_regnum): ...this. Make static. Add eh_frame_p
|
||||
argument. Update all callers.
|
||||
(struct dwarf2_frame_ops): Replace eh_frame_regnum with adjust_regnum.
|
||||
(dwarf2_frame_set_eh_frame_regnum): Rename to...
|
||||
(dwarf2_frame_set_adjust_regnum): ...this. Update argument type.
|
||||
* dwarf2frame.h (dwarf2_frame_set_eh_frame_regnum): Rename to...
|
||||
(dwarf2_frame_set_adjust_regnum): ...this.
|
||||
(dwarf2_frame_eh_frame_regnum): Delete prototype.
|
||||
* rs6000-tdep.c: Include "dwarf2-frame.h".
|
||||
(rs6000_adjust_frame_regnum): Define.
|
||||
(rs6000_gdbarch_init): Enable use of DWARF CFI frame unwinder.
|
||||
Register rs6000_adjust_frame_regnum.
|
||||
|
||||
* Makefile.in (rs6000-tdep.o): Update dependencies.
|
||||
|
||||
--- ./gdb/dwarf2-frame.c 27 Feb 2007 20:17:18 -0000 1.68
|
||||
+++ ./gdb/dwarf2-frame.c 27 Mar 2007 19:02:42 -0000 1.69
|
||||
@@ -107,6 +107,9 @@ struct dwarf2_fde
|
||||
};
|
||||
|
||||
static struct dwarf2_fde *dwarf2_frame_find_fde (CORE_ADDR *pc);
|
||||
+
|
||||
+static int dwarf2_frame_adjust_regnum (struct gdbarch *gdbarch, int regnum,
|
||||
+ int eh_frame_p);
|
||||
|
||||
|
||||
/* Structure describing a frame state. */
|
||||
@@ -314,8 +317,7 @@ execute_cfa_program (gdb_byte *insn_ptr,
|
||||
else if ((insn & 0xc0) == DW_CFA_offset)
|
||||
{
|
||||
reg = insn & 0x3f;
|
||||
- if (eh_frame_p)
|
||||
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
|
||||
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
|
||||
insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp);
|
||||
offset = utmp * fs->data_align;
|
||||
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
|
||||
@@ -326,8 +328,7 @@ execute_cfa_program (gdb_byte *insn_ptr,
|
||||
{
|
||||
gdb_assert (fs->initial.reg);
|
||||
reg = insn & 0x3f;
|
||||
- if (eh_frame_p)
|
||||
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
|
||||
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
|
||||
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
|
||||
if (reg < fs->initial.num_regs)
|
||||
fs->regs.reg[reg] = fs->initial.reg[reg];
|
||||
@@ -368,8 +369,7 @@ register %s (#%d) at 0x%s"),
|
||||
|
||||
case DW_CFA_offset_extended:
|
||||
insn_ptr = read_uleb128 (insn_ptr, insn_end, ®);
|
||||
- if (eh_frame_p)
|
||||
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
|
||||
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
|
||||
insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp);
|
||||
offset = utmp * fs->data_align;
|
||||
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
|
||||
@@ -380,35 +380,30 @@ register %s (#%d) at 0x%s"),
|
||||
case DW_CFA_restore_extended:
|
||||
gdb_assert (fs->initial.reg);
|
||||
insn_ptr = read_uleb128 (insn_ptr, insn_end, ®);
|
||||
- if (eh_frame_p)
|
||||
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
|
||||
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
|
||||
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
|
||||
fs->regs.reg[reg] = fs->initial.reg[reg];
|
||||
break;
|
||||
|
||||
case DW_CFA_undefined:
|
||||
insn_ptr = read_uleb128 (insn_ptr, insn_end, ®);
|
||||
- if (eh_frame_p)
|
||||
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
|
||||
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
|
||||
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
|
||||
fs->regs.reg[reg].how = DWARF2_FRAME_REG_UNDEFINED;
|
||||
break;
|
||||
|
||||
case DW_CFA_same_value:
|
||||
insn_ptr = read_uleb128 (insn_ptr, insn_end, ®);
|
||||
- if (eh_frame_p)
|
||||
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
|
||||
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
|
||||
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
|
||||
fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAME_VALUE;
|
||||
break;
|
||||
|
||||
case DW_CFA_register:
|
||||
insn_ptr = read_uleb128 (insn_ptr, insn_end, ®);
|
||||
- if (eh_frame_p)
|
||||
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
|
||||
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
|
||||
insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp);
|
||||
- if (eh_frame_p)
|
||||
- utmp = dwarf2_frame_eh_frame_regnum (gdbarch, utmp);
|
||||
+ utmp = dwarf2_frame_adjust_regnum (gdbarch, utmp, eh_frame_p);
|
||||
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
|
||||
fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAVED_REG;
|
||||
fs->regs.reg[reg].loc.reg = utmp;
|
||||
@@ -456,9 +451,8 @@ bad CFI data; mismatched DW_CFA_restore_
|
||||
|
||||
case DW_CFA_def_cfa_register:
|
||||
insn_ptr = read_uleb128 (insn_ptr, insn_end, &fs->cfa_reg);
|
||||
- if (eh_frame_p)
|
||||
- fs->cfa_reg = dwarf2_frame_eh_frame_regnum (gdbarch,
|
||||
- fs->cfa_reg);
|
||||
+ fs->cfa_reg = dwarf2_frame_adjust_regnum (gdbarch, fs->cfa_reg,
|
||||
+ eh_frame_p);
|
||||
fs->cfa_how = CFA_REG_OFFSET;
|
||||
break;
|
||||
|
||||
@@ -484,8 +478,7 @@ bad CFI data; mismatched DW_CFA_restore_
|
||||
|
||||
case DW_CFA_expression:
|
||||
insn_ptr = read_uleb128 (insn_ptr, insn_end, ®);
|
||||
- if (eh_frame_p)
|
||||
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
|
||||
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
|
||||
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
|
||||
insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp);
|
||||
fs->regs.reg[reg].loc.exp = insn_ptr;
|
||||
@@ -496,8 +489,7 @@ bad CFI data; mismatched DW_CFA_restore_
|
||||
|
||||
case DW_CFA_offset_extended_sf:
|
||||
insn_ptr = read_uleb128 (insn_ptr, insn_end, ®);
|
||||
- if (eh_frame_p)
|
||||
- reg = dwarf2_frame_eh_frame_regnum (gdbarch, reg);
|
||||
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
|
||||
insn_ptr = read_sleb128 (insn_ptr, insn_end, &offset);
|
||||
offset *= fs->data_align;
|
||||
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
|
||||
@@ -535,9 +527,8 @@ bad CFI data; mismatched DW_CFA_restore_
|
||||
|
||||
case DW_CFA_def_cfa_sf:
|
||||
insn_ptr = read_uleb128 (insn_ptr, insn_end, &fs->cfa_reg);
|
||||
- if (eh_frame_p)
|
||||
- fs->cfa_reg = dwarf2_frame_eh_frame_regnum (gdbarch,
|
||||
- fs->cfa_reg);
|
||||
+ fs->cfa_reg = dwarf2_frame_adjust_regnum (gdbarch, fs->cfa_reg,
|
||||
+ eh_frame_p);
|
||||
insn_ptr = read_sleb128 (insn_ptr, insn_end, &offset);
|
||||
fs->cfa_offset = offset * fs->data_align;
|
||||
fs->cfa_how = CFA_REG_OFFSET;
|
||||
@@ -581,6 +572,7 @@ bad CFI data; mismatched DW_CFA_restore_
|
||||
|
||||
case DW_CFA_GNU_negative_offset_extended:
|
||||
insn_ptr = read_uleb128 (insn_ptr, insn_end, ®);
|
||||
+ reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
|
||||
insn_ptr = read_uleb128 (insn_ptr, insn_end, &offset);
|
||||
offset *= fs->data_align;
|
||||
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
|
||||
@@ -617,8 +607,9 @@ struct dwarf2_frame_ops
|
||||
trampoline. */
|
||||
int (*signal_frame_p) (struct gdbarch *, struct frame_info *);
|
||||
|
||||
- /* Convert .eh_frame register number to DWARF register number. */
|
||||
- int (*eh_frame_regnum) (struct gdbarch *, int);
|
||||
+ /* Convert .eh_frame register number to DWARF register number, or
|
||||
+ adjust .debug_frame register number. */
|
||||
+ int (*adjust_regnum) (struct gdbarch *, int, int);
|
||||
};
|
||||
|
||||
/* Default architecture-specific register state initialization
|
||||
@@ -726,29 +717,30 @@ dwarf2_frame_signal_frame_p (struct gdba
|
||||
return ops->signal_frame_p (gdbarch, next_frame);
|
||||
}
|
||||
|
||||
-/* Set the architecture-specific mapping of .eh_frame register numbers to
|
||||
- DWARF register numbers. */
|
||||
+/* Set the architecture-specific adjustment of .eh_frame and .debug_frame
|
||||
+ register numbers. */
|
||||
|
||||
void
|
||||
-dwarf2_frame_set_eh_frame_regnum (struct gdbarch *gdbarch,
|
||||
- int (*eh_frame_regnum) (struct gdbarch *,
|
||||
- int))
|
||||
+dwarf2_frame_set_adjust_regnum (struct gdbarch *gdbarch,
|
||||
+ int (*adjust_regnum) (struct gdbarch *,
|
||||
+ int, int))
|
||||
{
|
||||
struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
|
||||
|
||||
- ops->eh_frame_regnum = eh_frame_regnum;
|
||||
+ ops->adjust_regnum = adjust_regnum;
|
||||
}
|
||||
|
||||
-/* Translate a .eh_frame register to DWARF register. */
|
||||
+/* Translate a .eh_frame register to DWARF register, or adjust a .debug_frame
|
||||
+ register. */
|
||||
|
||||
-int
|
||||
-dwarf2_frame_eh_frame_regnum (struct gdbarch *gdbarch, int regnum)
|
||||
+static int
|
||||
+dwarf2_frame_adjust_regnum (struct gdbarch *gdbarch, int regnum, int eh_frame_p)
|
||||
{
|
||||
struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
|
||||
|
||||
- if (ops->eh_frame_regnum == NULL)
|
||||
+ if (ops->adjust_regnum == NULL)
|
||||
return regnum;
|
||||
- return ops->eh_frame_regnum (gdbarch, regnum);
|
||||
+ return ops->adjust_regnum (gdbarch, regnum, eh_frame_p);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1726,10 +1718,10 @@ decode_frame_entry_1 (struct comp_unit *
|
||||
else
|
||||
cie->return_address_register = read_unsigned_leb128 (unit->abfd, buf,
|
||||
&bytes_read);
|
||||
- if (eh_frame_p)
|
||||
- cie->return_address_register
|
||||
- = dwarf2_frame_eh_frame_regnum (current_gdbarch,
|
||||
- cie->return_address_register);
|
||||
+ cie->return_address_register
|
||||
+ = dwarf2_frame_adjust_regnum (current_gdbarch,
|
||||
+ cie->return_address_register,
|
||||
+ eh_frame_p);
|
||||
|
||||
buf += bytes_read;
|
||||
|
||||
--- ./gdb/dwarf2-frame.h 9 Jan 2007 17:58:50 -0000 1.14
|
||||
+++ ./gdb/dwarf2-frame.h 27 Mar 2007 19:02:42 -0000 1.15
|
||||
@@ -94,18 +94,13 @@ extern void
|
||||
int (*signal_frame_p) (struct gdbarch *,
|
||||
struct frame_info *));
|
||||
|
||||
-/* Set the architecture-specific mapping of .eh_frame register numbers to
|
||||
- DWARF register numbers. */
|
||||
+/* Set the architecture-specific adjustment of .eh_frame and .debug_frame
|
||||
+ register numbers. */
|
||||
|
||||
extern void
|
||||
- dwarf2_frame_set_eh_frame_regnum (struct gdbarch *gdbarch,
|
||||
- int (*eh_frame_regnum) (struct gdbarch *,
|
||||
- int));
|
||||
-
|
||||
-/* Translate a .eh_frame register to DWARF register. */
|
||||
-
|
||||
-extern int
|
||||
- dwarf2_frame_eh_frame_regnum (struct gdbarch *gdbarch, int regnum);
|
||||
+ dwarf2_frame_set_adjust_regnum (struct gdbarch *gdbarch,
|
||||
+ int (*adjust_regnum) (struct gdbarch *,
|
||||
+ int, int));
|
||||
|
||||
/* Return the frame unwind methods for the function that contains PC,
|
||||
or NULL if it can't be handled by DWARF CFI frame unwinder. */
|
||||
--- ./gdb/rs6000-tdep.c 13 Mar 2007 17:34:22 -0000 1.266
|
||||
+++ ./gdb/rs6000-tdep.c 27 Mar 2007 19:02:42 -0000 1.267
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "sim-regno.h"
|
||||
#include "gdb/sim-ppc.h"
|
||||
#include "reggroups.h"
|
||||
+#include "dwarf2-frame.h"
|
||||
|
||||
#include "libbfd.h" /* for bfd_default_set_arch_mach */
|
||||
#include "coff/internal.h" /* for libcoff.h */
|
||||
@@ -2294,6 +2295,69 @@ rs6000_dwarf2_reg_to_regnum (int num)
|
||||
}
|
||||
}
|
||||
|
||||
+/* Translate a .eh_frame register to DWARF register, or adjust a
|
||||
+ .debug_frame register. */
|
||||
+
|
||||
+static int
|
||||
+rs6000_adjust_frame_regnum (struct gdbarch *gdbarch, int num, int eh_frame_p)
|
||||
+{
|
||||
+ /* GCC releases before 3.4 use GCC internal register numbering in
|
||||
+ .debug_frame (and .debug_info, et cetera). The numbering is
|
||||
+ different from the standard SysV numbering for everything except
|
||||
+ for GPRs and FPRs. We can not detect this problem in most cases
|
||||
+ - to get accurate debug info for variables living in lr, ctr, v0,
|
||||
+ et cetera, use a newer version of GCC. But we must detect
|
||||
+ one important case - lr is in column 65 in .debug_frame output,
|
||||
+ instead of 108.
|
||||
+
|
||||
+ GCC 3.4, and the "hammer" branch, have a related problem. They
|
||||
+ record lr register saves in .debug_frame as 108, but still record
|
||||
+ the return column as 65. We fix that up too.
|
||||
+
|
||||
+ We can do this because 65 is assigned to fpsr, and GCC never
|
||||
+ generates debug info referring to it. To add support for
|
||||
+ handwritten debug info that restores fpsr, we would need to add a
|
||||
+ producer version check to this. */
|
||||
+ if (!eh_frame_p)
|
||||
+ {
|
||||
+ if (num == 65)
|
||||
+ return 108;
|
||||
+ else
|
||||
+ return num;
|
||||
+ }
|
||||
+
|
||||
+ /* .eh_frame is GCC specific. For binary compatibility, it uses GCC
|
||||
+ internal register numbering; translate that to the standard DWARF2
|
||||
+ register numbering. */
|
||||
+ if (0 <= num && num <= 63) /* r0-r31,fp0-fp31 */
|
||||
+ return num;
|
||||
+ else if (68 <= num && num <= 75) /* cr0-cr8 */
|
||||
+ return num - 68 + 86;
|
||||
+ else if (77 <= num && num <= 108) /* vr0-vr31 */
|
||||
+ return num - 77 + 1124;
|
||||
+ else
|
||||
+ switch (num)
|
||||
+ {
|
||||
+ case 64: /* mq */
|
||||
+ return 100;
|
||||
+ case 65: /* lr */
|
||||
+ return 108;
|
||||
+ case 66: /* ctr */
|
||||
+ return 109;
|
||||
+ case 76: /* xer */
|
||||
+ return 101;
|
||||
+ case 109: /* vrsave */
|
||||
+ return 356;
|
||||
+ case 110: /* vscr */
|
||||
+ return 67;
|
||||
+ case 111: /* spe_acc */
|
||||
+ return 99;
|
||||
+ case 112: /* spefscr */
|
||||
+ return 612;
|
||||
+ default:
|
||||
+ return num;
|
||||
+ }
|
||||
+}
|
||||
|
||||
/* Support for CONVERT_FROM_FUNC_PTR_ADDR (ARCH, ADDR, TARG).
|
||||
|
||||
@@ -3428,6 +3492,10 @@ rs6000_gdbarch_init (struct gdbarch_info
|
||||
(gdbarch, rs6000_in_solib_return_trampoline);
|
||||
set_gdbarch_skip_trampoline_code (gdbarch, rs6000_skip_trampoline_code);
|
||||
|
||||
+ /* Hook in the DWARF CFI frame unwinder. */
|
||||
+ frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
||||
+ dwarf2_frame_set_adjust_regnum (gdbarch, rs6000_adjust_frame_regnum);
|
||||
+
|
||||
/* Hook in ABI-specific overrides, if they have been registered. */
|
||||
gdbarch_init_osabi (info, gdbarch);
|
||||
|
||||
--- ./gdb/Makefile.in.orig 2007-07-31 16:42:29.000000000 -0400
|
||||
+++ ./gdb/Makefile.in 2007-08-01 13:42:51.000000000 -0400
|
||||
@@ -2468,7 +2468,7 @@ rs6000-tdep.o: rs6000-tdep.c $(defs_h) $
|
||||
$(reggroups_h) $(libbfd_h) $(coff_internal_h) $(libcoff_h) \
|
||||
$(coff_xcoff_h) $(libxcoff_h) $(elf_bfd_h) $(solib_svr4_h) \
|
||||
$(ppc_tdep_h) $(gdb_assert_h) $(dis_asm_h) $(trad_frame_h) \
|
||||
- $(frame_unwind_h) $(frame_base_h) $(rs6000_tdep_h)
|
||||
+ $(frame_unwind_h) $(frame_base_h) $(rs6000_tdep_h) $(dwarf2_frame_h)
|
||||
rs6000-aix-tdep.o: rs6000-aix-tdep.c $(defs_h) $(osabi_h) $(rs6000_tdep_h)
|
||||
s390-nat.o: s390-nat.c $(defs_h) $(tm_h) $(regcache_h) $(inferior_h) \
|
||||
$(s390_tdep_h) $(observer_h) $(linux_nat_h)
|
||||
s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \
|
||||
|
||||
|
||||
|
||||
2007-04-10 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
* rs6000-tdep.c (rs6000_dwarf2_reg_to_regnum): Decode 64 as CR
|
||||
register.
|
||||
|
||||
--- ./gdb/rs6000-tdep.c 1 Apr 2007 18:24:59 -0000 1.269
|
||||
+++ ./gdb/rs6000-tdep.c 10 Apr 2007 16:02:41 -0000 1.270
|
||||
@@ -2274,6 +2274,8 @@ rs6000_dwarf2_reg_to_regnum (int num)
|
||||
else
|
||||
switch (num)
|
||||
{
|
||||
+ case 64:
|
||||
+ return tdep->ppc_cr_regnum;
|
||||
case 67:
|
||||
return tdep->ppc_vrsave_regnum - 1; /* vscr */
|
||||
case 99:
|
300
gdb-6.3-bz140532-ppc-unwinding-test.patch
Normal file
300
gdb-6.3-bz140532-ppc-unwinding-test.patch
Normal file
@ -0,0 +1,300 @@
|
||||
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S
|
||||
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S 2007-08-02 13:23:10.000000000 -0400
|
||||
@@ -0,0 +1,78 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2007 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+ .section ".text"
|
||||
+ .align 2
|
||||
+ .globl func0
|
||||
+ .type func0, @function
|
||||
+func0:
|
||||
+ stwu 1,-16(1)
|
||||
+ mflr 0
|
||||
+ stw 31,12(1)
|
||||
+ stw 0,20(1)
|
||||
+ mr 31,1
|
||||
+ bl abort
|
||||
+ .size func0, .-func0
|
||||
+ .align 2
|
||||
+ .globl func1
|
||||
+ .type func1, @function
|
||||
+func1:
|
||||
+ stwu 1,-16(1)
|
||||
+ mflr 0
|
||||
+/* 20 = BO = branch always
|
||||
+ 31 = BI = CR bit (ignored) */
|
||||
+ bcl 20,31,.Lpie
|
||||
+.Lpie: stw 31,12(1)
|
||||
+ stw 0,20(1)
|
||||
+ mr 31,1
|
||||
+ bl func0
|
||||
+ mr 0,3
|
||||
+ lis 9,var@ha
|
||||
+ lwz 9,var@l(9)
|
||||
+ add 0,0,9
|
||||
+ mr 3,0
|
||||
+ lwz 11,0(1)
|
||||
+ lwz 0,4(11)
|
||||
+ mtlr 0
|
||||
+ lwz 31,-4(11)
|
||||
+ mr 1,11
|
||||
+ blr
|
||||
+ .size func1, .-func1
|
||||
+ .section .note.GNU-stack,"",@progbits
|
||||
+ .ident "GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-8)"
|
||||
+
|
||||
+/* Original source file:
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+extern volatile int var;
|
||||
+
|
||||
+int func0 (void) __attribute__((__noinline__));
|
||||
+int func0 (void)
|
||||
+{
|
||||
+ abort ();
|
||||
+ return var;
|
||||
+}
|
||||
+
|
||||
+int func1 (void) __attribute__((__noinline__));
|
||||
+int func1 (void)
|
||||
+{
|
||||
+ return func0 () + var;
|
||||
+}
|
||||
+
|
||||
+*/
|
||||
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S
|
||||
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S 2007-08-02 14:28:56.000000000 -0400
|
||||
@@ -0,0 +1,98 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2007 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+ .section ".toc","aw"
|
||||
+ .section ".text"
|
||||
+ .align 2
|
||||
+ .globl func0
|
||||
+ .section ".opd","aw"
|
||||
+ .align 3
|
||||
+func0:
|
||||
+ .quad .L.func0,.TOC.@tocbase
|
||||
+ .previous
|
||||
+ .type func0, @function
|
||||
+.L.func0:
|
||||
+ mflr 0
|
||||
+ std 31,-8(1)
|
||||
+ std 0,16(1)
|
||||
+ stdu 1,-128(1)
|
||||
+ mr 31,1
|
||||
+ bl abort
|
||||
+ nop
|
||||
+ .long 0
|
||||
+ .byte 0,0,0,1,128,1,0,1
|
||||
+ .size func0,.-.L.func0
|
||||
+ .section ".toc","aw"
|
||||
+.LC1:
|
||||
+ .tc var[TC],var
|
||||
+ .section ".text"
|
||||
+ .align 2
|
||||
+ .globl func1
|
||||
+ .section ".opd","aw"
|
||||
+ .align 3
|
||||
+func1:
|
||||
+ .quad .L.func1,.TOC.@tocbase
|
||||
+ .previous
|
||||
+ .type func1, @function
|
||||
+.L.func1:
|
||||
+ mflr 0
|
||||
+/* 20 = BO = branch always
|
||||
+ 31 = BI = CR bit (ignored) */
|
||||
+ bcl 20,31,.Lpie
|
||||
+.Lpie: std 31,-8(1)
|
||||
+ std 0,16(1)
|
||||
+ stdu 1,-128(1)
|
||||
+ mr 31,1
|
||||
+ bl func0
|
||||
+ mr 11,3
|
||||
+ ld 9,.LC1@toc(2)
|
||||
+ lwz 0,0(9)
|
||||
+ add 0,11,0
|
||||
+ extsw 0,0
|
||||
+ mr 3,0
|
||||
+ ld 1,0(1)
|
||||
+ ld 0,16(1)
|
||||
+ mtlr 0
|
||||
+ ld 31,-8(1)
|
||||
+ blr
|
||||
+ .long 0
|
||||
+ .byte 0,0,0,1,128,1,0,1
|
||||
+ .size func1,.-.L.func1
|
||||
+ .section .note.GNU-stack,"",@progbits
|
||||
+ .ident "GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-8)"
|
||||
+
|
||||
+/* Original source file:
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+extern volatile int var;
|
||||
+
|
||||
+int func0 (void) __attribute__((__noinline__));
|
||||
+int func0 (void)
|
||||
+{
|
||||
+ abort ();
|
||||
+ return var;
|
||||
+}
|
||||
+
|
||||
+int func1 (void) __attribute__((__noinline__));
|
||||
+int func1 (void)
|
||||
+{
|
||||
+ return func0 () + var;
|
||||
+}
|
||||
+
|
||||
+*/
|
||||
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c
|
||||
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c 2007-08-02 13:25:10.000000000 -0400
|
||||
@@ -0,0 +1,29 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2007 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+/* Force `-fpie' double jump bl->blrl. */
|
||||
+/* No longer used. */
|
||||
+volatile int var;
|
||||
+
|
||||
+extern int func1 (void);
|
||||
+
|
||||
+int main (void)
|
||||
+{
|
||||
+ func1 ();
|
||||
+ return 0;
|
||||
+}
|
||||
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp
|
||||
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp 2007-08-02 14:21:29.000000000 -0400
|
||||
@@ -0,0 +1,79 @@
|
||||
+# Copyright 2006, 2007 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# Test unwinding fixes of the PPC platform, specifically on the coping with BCL
|
||||
+# jump of the PIE code.
|
||||
+
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+set prms_id 0
|
||||
+set bug_id 0
|
||||
+
|
||||
+if ![istarget "powerpc*-*-linux*"] then {
|
||||
+ verbose "Skipping powerpc-linux prologue tests."
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set testfile "powerpc-bcl-prologue"
|
||||
+set srcfile1 ${testfile}.c
|
||||
+set flags "debug"
|
||||
+if [istarget "powerpc-*"] then {
|
||||
+ set srcfile2 ${testfile}-asm32.S
|
||||
+ set flags "$flags additional_flags=-m32"
|
||||
+} elseif [istarget "powerpc64-*"] then {
|
||||
+ set srcfile2 ${testfile}-asm64.S
|
||||
+ set flags "$flags additional_flags=-m64"
|
||||
+} else {
|
||||
+ fail "powerpc arch test"
|
||||
+ return
|
||||
+}
|
||||
+set objfile2 ${objdir}/${subdir}/${testfile}-asm.o
|
||||
+set binfile ${objdir}/${subdir}/${testfile}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2}" ${binfile} executable $flags] != ""} {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+# We should stop in abort(3).
|
||||
+
|
||||
+gdb_run_cmd
|
||||
+
|
||||
+gdb_test_multiple {} "continue to abort()" {
|
||||
+ -re ".*Program received signal SIGABRT,.*$gdb_prompt $" {
|
||||
+ pass "continue to abort()"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Check backtrace:
|
||||
+# #3 0x0804835f in func0 ()
|
||||
+# #4 0x0804836a in func1 ()
|
||||
+# #5 0x0804838c in main ()
|
||||
+# (gdb)
|
||||
+# `\\.?' prefixes are needed for ppc64 without `debug' (another bug).
|
||||
+
|
||||
+set test "matching unwind"
|
||||
+gdb_test_multiple "backtrace" $test {
|
||||
+ -re "\r\n#\[0-9\]\[^\r\n\]* in \\.?func0 \\(\[^\r\n\]*\r\n#\[0-9\]\[^\r\n\]* in \\.?func1 \\(\[^\r\n\]*\r\n#\[0-9\]\[^\r\n\]* in \\.?main \\(\[^\r\n\]*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
@ -1,52 +0,0 @@
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=140532
|
||||
|
||||
|
||||
2007-01-01 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* rs6000-tdep.c (skip_prologue): Handle bl->brlr used by PIC code.
|
||||
|
||||
|
||||
diff -u -rup gdb-6.5-orig/gdb/rs6000-tdep.c gdb-6.5/gdb/rs6000-tdep.c
|
||||
--- gdb-6.5-orig/gdb/rs6000-tdep.c 2006-12-30 15:53:52.000000000 -0500
|
||||
+++ gdb-6.5/gdb/rs6000-tdep.c 2006-12-31 19:06:28.000000000 -0500
|
||||
@@ -1182,6 +1182,40 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR l
|
||||
else if ((op & 0xfc000001) == 0x48000001)
|
||||
{ /* bl foo,
|
||||
to save fprs??? */
|
||||
+ CORE_ADDR bl_target;
|
||||
+ gdb_byte bl_target_op_buf[4];
|
||||
+
|
||||
+ /* Safely skip:
|
||||
+ prologue: ...
|
||||
+ bl addr
|
||||
+ ...
|
||||
+ addr: blrl
|
||||
+ as it could break the prologue by `prologue_sal.line'
|
||||
+ or `prologue_sal.line != this_sal.line' conditions below. */
|
||||
+ /* Sign-extend it to the upper 6 bits. */
|
||||
+ if (op & 0x02000000)
|
||||
+ bl_target = pc + -(long) (((~op) & 0x03fffffc) + 4);
|
||||
+ else
|
||||
+ bl_target = pc + (op & 0x03fffffc);
|
||||
+ if (target_read_memory (bl_target, bl_target_op_buf, 4) == 0)
|
||||
+ {
|
||||
+ unsigned long bl_target_op;
|
||||
+
|
||||
+ bl_target_op = extract_signed_integer (bl_target_op_buf, 4);
|
||||
+ if (bl_target_op == 0x4e800021) /* blrl */
|
||||
+ {
|
||||
+ /* If we did not yet retrieved LR into some GPR
|
||||
+ all our chances are lost. On the other hand already
|
||||
+ stored LR is still kept intact in its GPR. */
|
||||
+ if (lr_reg == -1)
|
||||
+ {
|
||||
+ /* Invalidate lr_reg, but don't set it to -1.
|
||||
+ That would mean that it had never been set. */
|
||||
+ lr_reg = -2;
|
||||
+ }
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
fdata->frameless = 0;
|
||||
/* Don't skip over the subroutine call if it is not within
|
@ -1,153 +0,0 @@
|
||||
2007-01-13 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/bt-ppc.c, gdb.base/bt-ppc.exp: New files.
|
||||
|
||||
|
||||
diff -u -rupN gdb-6.5-ppc/gdb/testsuite/gdb.base/bt-ppc.c gdb-6.5/gdb/testsuite/gdb.base/bt-ppc.c
|
||||
--- gdb-6.5-ppc/gdb/testsuite/gdb.base/bt-ppc.c 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ gdb-6.5/gdb/testsuite/gdb.base/bt-ppc.c 2007-01-12 21:34:55.000000000 -0500
|
||||
@@ -0,0 +1,41 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2007 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+/* Force `-fpie' double jump bl->blrl. */
|
||||
+volatile int var;
|
||||
+
|
||||
+int func0 (void) __attribute__((__noinline__));
|
||||
+int func0 (void)
|
||||
+{
|
||||
+ abort ();
|
||||
+ return var;
|
||||
+}
|
||||
+
|
||||
+int func1 (void) __attribute__((__noinline__));
|
||||
+int func1 (void)
|
||||
+{
|
||||
+ return func0 () + var;
|
||||
+}
|
||||
+
|
||||
+int main (void)
|
||||
+{
|
||||
+ func1 ();
|
||||
+ return 0;
|
||||
+}
|
||||
diff -u -rupN gdb-6.5-ppc/gdb/testsuite/gdb.base/bt-ppc.exp gdb-6.5/gdb/testsuite/gdb.base/bt-ppc.exp
|
||||
--- gdb-6.5-ppc/gdb/testsuite/gdb.base/bt-ppc.exp 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ gdb-6.5/gdb/testsuite/gdb.base/bt-ppc.exp 2007-01-12 21:27:25.000000000 -0500
|
||||
@@ -0,0 +1,99 @@
|
||||
+# Copyright 2006, 2007 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# Test multiple unwinding fixes of PPC platform.
|
||||
+# As the tests are platform independent we can run it everywhere.
|
||||
+
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+set prms_id 0
|
||||
+set bug_id 0
|
||||
+
|
||||
+# This test uses GCC-specific syntax.
|
||||
+if [get_compiler_info not-used] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if {![test_compiler_info "gcc-*"]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+proc do_test { opts addons } {
|
||||
+ global objdir srcdir subdir gdb_prompt
|
||||
+
|
||||
+ set testfile "bt-ppc"
|
||||
+ set srcfile ${testfile}.c
|
||||
+ set binfile ${objdir}/${subdir}/${testfile}
|
||||
+
|
||||
+ # `additional_flags' should be last as it eats arguments till eol.
|
||||
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" ${binfile} executable [list $opts additional_flags=$addons]] != ""} {
|
||||
+ return -1
|
||||
+ }
|
||||
+
|
||||
+ gdb_exit
|
||||
+ gdb_start
|
||||
+ gdb_reinitialize_dir $srcdir/$subdir
|
||||
+ gdb_load ${binfile}
|
||||
+
|
||||
+ # We should stop in abort(3).
|
||||
+
|
||||
+ gdb_run_cmd
|
||||
+
|
||||
+ gdb_test_multiple {} "continue to abort()" {
|
||||
+ -re ".*Program received signal SIGABRT,.*$gdb_prompt $" {
|
||||
+ pass "continue to abort()"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ # Check backtrace:
|
||||
+ # #3 0x0804835f in func0 ()
|
||||
+ # #4 0x0804836a in func1 ()
|
||||
+ # #5 0x0804838c in main ()
|
||||
+ # (gdb)
|
||||
+ # `\\.?' prefixes are needed for ppc64 without `debug' (another bug).
|
||||
+
|
||||
+ set show [concat $opts $addons]
|
||||
+ if [regexp {^-fno-asynchronous-unwind-tables (-fpie -pie )?-O2$} $show] {
|
||||
+ # We get correct unwind but with two excessive "??" entries
|
||||
+ # due to undetectable inserted alignment entry.
|
||||
+ # With -fa-u-t we have correct FDE, without -O2 we have frame pointer.
|
||||
+ # 1 0x0000003acb631980 in abort () from /lib64/libc.so.6
|
||||
+ # 2 0x0000000000400489 in func0 ()
|
||||
+ # 3 0x00000000004004d0 in ?? ()
|
||||
+ # 4 0x0000000000400499 in func1 ()
|
||||
+ # 5 0x00007fffc5442410 in ?? ()
|
||||
+ # 6 0x00000000004004b9 in main ()
|
||||
+ setup_xfail "x86_64-*-*"
|
||||
+ }
|
||||
+ gdb_test_multiple "bt" "Correct unwind for: $show" {
|
||||
+ -re "\r\n#\[0-9\]\[^\r\n\]* in \\.?func0 \\(\[^\r\n\]*\r\n#\[0-9\]\[^\r\n\]* in \\.?func1 \\(\[^\r\n\]*\r\n#\[0-9\]\[^\r\n\]* in \\.?main \\(\[^\r\n\]*\r\n$gdb_prompt $" {
|
||||
+ pass "Correct unwind for: $show"
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+foreach eh_frame {{-fno-asynchronous-unwind-tables}
|
||||
+ {-fasynchronous-unwind-tables}} {
|
||||
+ foreach pie {{} {-fpie -pie}} {
|
||||
+ foreach optim {{} {-O2}} {
|
||||
+ foreach is_debug {{} {debug}} {
|
||||
+ do_test $is_debug [concat $eh_frame $pie $optim]
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
@ -1,145 +0,0 @@
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=140532
|
||||
|
||||
|
||||
2007-01-13 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* dwarf2-frame.c (decode_frame_entry_1): Call
|
||||
dwarf2_frame_return_address_regnum when processing CIE return address.
|
||||
(struct dwarf2_frame_ops): Add return_address_regnum.
|
||||
(dwarf2_frame_set_return_address_regnum): Define.
|
||||
(dwarf2_frame_return_address_regnum): Define.
|
||||
* dwarf2-frame.h (dwarf2_frame_set_return_address_regnum): Declare.
|
||||
(dwarf2_frame_return_address_regnum): Declare.
|
||||
* rs6000-tdep.c (rs6000_dwarf2_reg_to_regnum): Map also 64(CR) and
|
||||
65(FPSCR) DWARF2 registers.
|
||||
(rs6000_return_address_regnum): Define.
|
||||
(rs6000_gdbarch_init): Register rs6000_return_address_regnum.
|
||||
|
||||
|
||||
--- gdb-6.5-ppc/gdb/dwarf2-frame.c 2007-01-12 14:40:32.000000000 -0500
|
||||
+++ gdb-6.5/gdb/dwarf2-frame.c 2007-01-12 18:46:32.000000000 -0500
|
||||
@@ -586,6 +586,10 @@ struct dwarf2_frame_ops
|
||||
|
||||
/* Convert .eh_frame register number to DWARF register number. */
|
||||
int (*eh_frame_regnum) (struct gdbarch *, int);
|
||||
+
|
||||
+ /* Convert .eh_frame/.debug_frame CIE return address register number to DWARF
|
||||
+ register number. */
|
||||
+ int (*return_address_regnum) (struct gdbarch *, int, int);
|
||||
};
|
||||
|
||||
/* Default architecture-specific register state initialization
|
||||
@@ -693,6 +697,32 @@ dwarf2_frame_signal_frame_p (struct gdba
|
||||
return ops->signal_frame_p (gdbarch, next_frame);
|
||||
}
|
||||
|
||||
+/* Set the architecture-specific mapping of .eh_frame/.debug_frame CIE return
|
||||
+ address register number to DWARF register number. */
|
||||
+
|
||||
+void
|
||||
+dwarf2_frame_set_return_address_regnum (struct gdbarch *gdbarch,
|
||||
+ int (*return_address_regnum)
|
||||
+ (struct gdbarch *, int, int))
|
||||
+{
|
||||
+ struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
|
||||
+
|
||||
+ ops->return_address_regnum = return_address_regnum;
|
||||
+}
|
||||
+
|
||||
+/* Translate a .eh_frame/.debug_frame CIE register to DWARF register. */
|
||||
+
|
||||
+int
|
||||
+dwarf2_frame_return_address_regnum (struct gdbarch *gdbarch, int regnum,
|
||||
+ int eh_frame_p)
|
||||
+{
|
||||
+ struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
|
||||
+
|
||||
+ if (ops->return_address_regnum == NULL)
|
||||
+ return regnum;
|
||||
+ return ops->return_address_regnum (gdbarch, regnum, eh_frame_p);
|
||||
+}
|
||||
+
|
||||
/* Set the architecture-specific mapping of .eh_frame register numbers to
|
||||
DWARF register numbers. */
|
||||
|
||||
@@ -1618,6 +1648,11 @@ decode_frame_entry_1 (struct comp_unit *
|
||||
else
|
||||
cie->return_address_register = read_unsigned_leb128 (unit->abfd, buf,
|
||||
&bytes_read);
|
||||
+
|
||||
+ cie->return_address_register
|
||||
+ = dwarf2_frame_return_address_regnum (current_gdbarch,
|
||||
+ cie->return_address_register,
|
||||
+ eh_frame_p);
|
||||
if (eh_frame_p)
|
||||
cie->return_address_register
|
||||
= dwarf2_frame_eh_frame_regnum (current_gdbarch,
|
||||
--- gdb-6.5-ppc/gdb/dwarf2-frame.h 2007-01-12 14:40:32.000000000 -0500
|
||||
+++ gdb-6.5/gdb/dwarf2-frame.h 2007-01-12 18:36:47.000000000 -0500
|
||||
@@ -107,6 +107,20 @@ extern void
|
||||
extern int
|
||||
dwarf2_frame_eh_frame_regnum (struct gdbarch *gdbarch, int regnum);
|
||||
|
||||
+/* Set the architecture-specific mapping of .eh_frame/.debug_frame CIE return
|
||||
+ address register number to DWARF register number. */
|
||||
+
|
||||
+extern void
|
||||
+ dwarf2_frame_set_return_address_regnum (struct gdbarch *gdbarch,
|
||||
+ int (*return_address_regnum)
|
||||
+ (struct gdbarch *, int, int));
|
||||
+
|
||||
+/* Translate a .eh_frame/.debug_frame CIE register to DWARF register. */
|
||||
+
|
||||
+extern int
|
||||
+ dwarf2_frame_return_address_regnum (struct gdbarch *gdbarch, int regnum,
|
||||
+ int eh_frame_p);
|
||||
+
|
||||
/* Return the frame unwind methods for the function that contains PC,
|
||||
or NULL if it can't be handled by DWARF CFI frame unwinder. */
|
||||
|
||||
--- gdb-6.5-ppc/gdb/rs6000-tdep.c 2007-01-12 14:40:32.000000000 -0500
|
||||
+++ gdb-6.5/gdb/rs6000-tdep.c 2007-01-12 18:44:21.000000000 -0500
|
||||
@@ -2307,6 +2307,11 @@ rs6000_dwarf2_reg_to_regnum (int num)
|
||||
else
|
||||
switch (num)
|
||||
{
|
||||
+ case 64:
|
||||
+ return tdep->ppc_cr_regnum;
|
||||
+ /* Broken GCC uses it for CIE `Return address column' as LR. */
|
||||
+ case 65:
|
||||
+ return tdep->ppc_fpscr_regnum;
|
||||
case 67:
|
||||
return tdep->ppc_vrsave_regnum - 1; /* vscr */
|
||||
case 99:
|
||||
@@ -2363,6 +2368,22 @@ rs6000_eh_frame_regnum (struct gdbarch *
|
||||
}
|
||||
}
|
||||
|
||||
+/* Convert a .eh_frame/.debug_frame CIE return address register number to DWARF
|
||||
+ register number. */
|
||||
+static int
|
||||
+rs6000_return_address_regnum (struct gdbarch *gdbarch, int regnum,
|
||||
+ int eh_frame_p)
|
||||
+{
|
||||
+ if (eh_frame_p != 0)
|
||||
+ return regnum;
|
||||
+
|
||||
+ /* Broken GCC uses it for CIE `Return address column' as LR. */
|
||||
+ if (regnum == 65)
|
||||
+ return 108;
|
||||
+
|
||||
+ return regnum;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
rs6000_store_return_value (struct type *type,
|
||||
struct regcache *regcache,
|
||||
@@ -3584,6 +3605,8 @@ rs6000_gdbarch_init (struct gdbarch_info
|
||||
/* Hook in the DWARF CFI frame unwinder. */
|
||||
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
||||
dwarf2_frame_set_eh_frame_regnum (gdbarch, rs6000_eh_frame_regnum);
|
||||
+ dwarf2_frame_set_return_address_regnum (gdbarch,
|
||||
+ rs6000_return_address_regnum);
|
||||
|
||||
/* Hook in ABI-specific overrides, if they have been registered. */
|
||||
gdbarch_init_osabi (info, gdbarch);
|
@ -1,91 +0,0 @@
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=140532
|
||||
|
||||
|
||||
2006-05-09 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
* rs6000-tdep.c: Include "dwarf2-frame.h".
|
||||
(rs6000_eh_frame_regnum): Define.
|
||||
(rs6000_gdbarch_init): Enable use of DWARF CFI frame unwinder.
|
||||
Register rs6000_eh_frame_regnum.
|
||||
|
||||
* Makefile.in (rs6000-tdep.o): Update dependencies.
|
||||
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2006-05/msg00341.html
|
||||
Selectively enabling them on platforms that are unlikely to have ever
|
||||
used GCC versions before 3.4 should be fine.
|
||||
|
||||
|
||||
--- ./gdb/Makefile.in 5 May 2006 22:39:12 -0000 1.812
|
||||
+++ ./gdb/Makefile.in 9 May 2006 14:10:40 -0000
|
||||
@@ -2515,7 +2515,7 @@ rs6000-tdep.o: rs6000-tdep.c $(defs_h) $
|
||||
$(reggroups_h) $(libbfd_h) $(coff_internal_h) $(libcoff_h) \
|
||||
$(coff_xcoff_h) $(libxcoff_h) $(elf_bfd_h) $(solib_svr4_h) \
|
||||
$(ppc_tdep_h) $(gdb_assert_h) $(dis_asm_h) $(trad_frame_h) \
|
||||
- $(frame_unwind_h) $(frame_base_h) $(rs6000_tdep_h)
|
||||
+ $(frame_unwind_h) $(frame_base_h) $(rs6000_tdep_h) $(dwarf2_frame_h)
|
||||
rs6000-aix-tdep.o: rs6000-aix-tdep.c $(defs_h) $(osabi_h) $(rs6000_tdep_h)
|
||||
s390-nat.o: s390-nat.c $(defs_h) $(tm_h) $(regcache_h) $(inferior_h) \
|
||||
$(s390_tdep_h) $(target_h) $(linux_nat_h)
|
||||
--- ./gdb/rs6000-tdep.c 23 Apr 2006 14:15:01 -0000 1.258
|
||||
+++ ./gdb/rs6000-tdep.c 9 May 2006 14:10:15 -0000
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "sim-regno.h"
|
||||
#include "gdb/sim-ppc.h"
|
||||
#include "reggroups.h"
|
||||
+#include "dwarf2-frame.h"
|
||||
|
||||
#include "libbfd.h" /* for bfd_default_set_arch_mach */
|
||||
#include "coff/internal.h" /* for libcoff.h */
|
||||
@@ -2243,6 +2244,40 @@ rs6000_dwarf2_reg_to_regnum (int num)
|
||||
}
|
||||
|
||||
|
||||
+/* Convert a .eh_frame register number to a Dwarf 2 register number. */
|
||||
+static int
|
||||
+rs6000_eh_frame_regnum (struct gdbarch *gdbarch, int num)
|
||||
+{
|
||||
+ if (0 <= num && num <= 63) /* r0-r31,fp0-fp31 */
|
||||
+ return num;
|
||||
+ else if (68 <= num && num <= 75) /* cr0-cr8 */
|
||||
+ return num - 68 + 86;
|
||||
+ else if (77 <= num && num <= 108) /* vr0-vr31 */
|
||||
+ return num - 77 + 1124;
|
||||
+ else
|
||||
+ switch (num)
|
||||
+ {
|
||||
+ case 64: /* mq */
|
||||
+ return 100;
|
||||
+ case 65: /* lr */
|
||||
+ return 108;
|
||||
+ case 66: /* ctr */
|
||||
+ return 109;
|
||||
+ case 76: /* xer */
|
||||
+ return 101;
|
||||
+ case 109: /* vrsave */
|
||||
+ return 356;
|
||||
+ case 110: /* vscr */
|
||||
+ return 67;
|
||||
+ case 111: /* spe_acc */
|
||||
+ return 99;
|
||||
+ case 112: /* spefscr */
|
||||
+ return 612;
|
||||
+ default:
|
||||
+ return num;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void
|
||||
rs6000_store_return_value (struct type *type,
|
||||
struct regcache *regcache,
|
||||
@@ -3461,6 +3496,10 @@ rs6000_gdbarch_init (struct gdbarch_info
|
||||
/* Helpers for function argument information. */
|
||||
set_gdbarch_fetch_pointer_argument (gdbarch, rs6000_fetch_pointer_argument);
|
||||
|
||||
+ /* Hook in the DWARF CFI frame unwinder. */
|
||||
+ frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
||||
+ dwarf2_frame_set_eh_frame_regnum (gdbarch, rs6000_eh_frame_regnum);
|
||||
+
|
||||
/* Hook in ABI-specific overrides, if they have been registered. */
|
||||
gdbarch_init_osabi (info, gdbarch);
|
||||
|
17
gdb.spec
17
gdb.spec
@ -11,7 +11,7 @@ Name: gdb
|
||||
Version: 6.6
|
||||
|
||||
# The release always contains a leading reserved number, start it at 1.
|
||||
Release: 22%{?dist}
|
||||
Release: 23%{?dist}
|
||||
|
||||
License: GPL
|
||||
Group: Development/Debuggers
|
||||
@ -287,13 +287,9 @@ Patch222: gdb-6.5-bz165025-DW_CFA_GNU_negative_offset_extended-test.patch
|
||||
Patch224: gdb-6.5-bz109921-DW_AT_decl_file-fix.patch
|
||||
Patch225: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
|
||||
|
||||
# Fix unwinding of non-CFI (w/o debuginfo) PPC code by recent GCC (BZ 140532).
|
||||
Patch226: gdb-6.3-bz140532-ppcnoncfi-skip_prologue-PIC.patch
|
||||
# Fix unwinding of non-debug (.eh_frame) PPC code, Andreas Schwab (BZ 140532).
|
||||
Patch227: gdb-6.5-bz140532-ppc-eh_frame-regnum.patch
|
||||
# Fix unwinding of debug (.debug_frame) PPC code, workaround GCC (BZ 140532).
|
||||
Patch228: gdb-6.5-bz140532-ppc-debug_frame-return_address.patch
|
||||
Patch229: gdb-6.5-bz140532-ppc-debug_frame-return_address-test.patch
|
||||
# Update PPC unwinding patches to their upstream variants (BZ 140532).
|
||||
Patch226: gdb-6.3-bz140532-ppc-unwinding-fix.patch
|
||||
Patch229: gdb-6.3-bz140532-ppc-unwinding-test.patch
|
||||
|
||||
# Fix missing testsuite .log output of testcases using get_compiler_info().
|
||||
Patch230: gdb-6.5-testsuite-log.patch
|
||||
@ -494,8 +490,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
||||
%patch224 -p1
|
||||
%patch225 -p1
|
||||
%patch226 -p1
|
||||
%patch227 -p1
|
||||
%patch228 -p1
|
||||
%patch229 -p1
|
||||
%patch230 -p1
|
||||
%patch231 -p1
|
||||
@ -677,6 +671,9 @@ fi
|
||||
# don't include the files in include, they are part of binutils
|
||||
|
||||
%changelog
|
||||
* Mon Aug 6 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-23
|
||||
- Update PPC unwinding patches to their upstream variants (BZ 140532).
|
||||
|
||||
* Wed Jul 25 2007 Jesse Keating <jkeating@redhat.com> - 6.6-22
|
||||
- Rebuild for RH #249435
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user