mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-28 14:30:48 +00:00
Enable DWARF unwinders for SPU
This patch enables use of DWARF unwinders for the SPU target. In addition to appending the DWARF unwinders, we also need to install a spu_dwarf_reg_to_regnum that maps the raw stack pointer register to the cooked version (to avoid mismatches with gdbarch_sp_regnum). This also causes confusion with the AX collect handling, so we also install ax_pseudo_register routines to handle the cooked SP. gdb/ 2014-04-17 Ulrich Weigand <uweigand@de.ibm.com> * spu-tdep.c: Include "dwarf2-frame.h" and "ax.h". (spu_ax_pseudo_register_collect): New function. (spu_ax_pseudo_register_push_stack): Likewise. (spu_dwarf_reg_to_regnum): Likewise. (spu_gdbarch_init): Install them. Append DWARF unwinders.
This commit is contained in:
parent
2ed3c037cf
commit
7ce16bd4c4
@ -1,3 +1,11 @@
|
||||
2014-04-17 Ulrich Weigand <uweigand@de.ibm.com>
|
||||
|
||||
* spu-tdep.c: Include "dwarf2-frame.h" and "ax.h".
|
||||
(spu_ax_pseudo_register_collect): New function.
|
||||
(spu_ax_pseudo_register_push_stack): Likewise.
|
||||
(spu_dwarf_reg_to_regnum): Likewise.
|
||||
(spu_gdbarch_init): Install them. Append DWARF unwinders.
|
||||
|
||||
2014-04-17 Ulrich Weigand <uweigand@de.ibm.com>
|
||||
|
||||
* gdbarch.sh (value_from_register): Make class "m" instead of "f".
|
||||
|
@ -44,6 +44,8 @@
|
||||
#include "observer.h"
|
||||
#include "infcall.h"
|
||||
#include "dwarf2.h"
|
||||
#include "dwarf2-frame.h"
|
||||
#include "ax.h"
|
||||
#include "exceptions.h"
|
||||
#include "spu-tdep.h"
|
||||
|
||||
@ -311,6 +313,51 @@ spu_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
spu_ax_pseudo_register_collect (struct gdbarch *gdbarch,
|
||||
struct agent_expr *ax, int regnum)
|
||||
{
|
||||
switch (regnum)
|
||||
{
|
||||
case SPU_SP_REGNUM:
|
||||
ax_reg_mask (ax, SPU_RAW_SP_REGNUM);
|
||||
return 0;
|
||||
|
||||
case SPU_FPSCR_REGNUM:
|
||||
case SPU_SRR0_REGNUM:
|
||||
case SPU_LSLR_REGNUM:
|
||||
case SPU_DECR_REGNUM:
|
||||
case SPU_DECR_STATUS_REGNUM:
|
||||
return -1;
|
||||
|
||||
default:
|
||||
internal_error (__FILE__, __LINE__, _("invalid regnum"));
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
spu_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
|
||||
struct agent_expr *ax, int regnum)
|
||||
{
|
||||
switch (regnum)
|
||||
{
|
||||
case SPU_SP_REGNUM:
|
||||
ax_reg (ax, SPU_RAW_SP_REGNUM);
|
||||
return 0;
|
||||
|
||||
case SPU_FPSCR_REGNUM:
|
||||
case SPU_SRR0_REGNUM:
|
||||
case SPU_LSLR_REGNUM:
|
||||
case SPU_DECR_REGNUM:
|
||||
case SPU_DECR_STATUS_REGNUM:
|
||||
return -1;
|
||||
|
||||
default:
|
||||
internal_error (__FILE__, __LINE__, _("invalid regnum"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Value conversion -- access scalar values at the preferred slot. */
|
||||
|
||||
static struct value *
|
||||
@ -352,6 +399,15 @@ spu_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
|
||||
return default_register_reggroup_p (gdbarch, regnum, group);
|
||||
}
|
||||
|
||||
/* DWARF-2 register numbers. */
|
||||
|
||||
static int
|
||||
spu_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
|
||||
{
|
||||
/* Use cooked instead of raw SP. */
|
||||
return (reg == SPU_RAW_SP_REGNUM)? SPU_SP_REGNUM : reg;
|
||||
}
|
||||
|
||||
|
||||
/* Address handling. */
|
||||
|
||||
@ -2680,6 +2736,11 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
set_gdbarch_pseudo_register_write (gdbarch, spu_pseudo_register_write);
|
||||
set_gdbarch_value_from_register (gdbarch, spu_value_from_register);
|
||||
set_gdbarch_register_reggroup_p (gdbarch, spu_register_reggroup_p);
|
||||
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, spu_dwarf_reg_to_regnum);
|
||||
set_gdbarch_ax_pseudo_register_collect
|
||||
(gdbarch, spu_ax_pseudo_register_collect);
|
||||
set_gdbarch_ax_pseudo_register_push_stack
|
||||
(gdbarch, spu_ax_pseudo_register_push_stack);
|
||||
|
||||
/* Data types. */
|
||||
set_gdbarch_char_signed (gdbarch, 0);
|
||||
@ -2718,6 +2779,7 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
|
||||
/* Frame handling. */
|
||||
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
|
||||
dwarf2_append_unwinders (gdbarch);
|
||||
frame_unwind_append_unwinder (gdbarch, &spu_frame_unwind);
|
||||
frame_base_set_default (gdbarch, &spu_frame_base);
|
||||
set_gdbarch_unwind_pc (gdbarch, spu_unwind_pc);
|
||||
|
Loading…
Reference in New Issue
Block a user