summaryrefslogtreecommitdiff
path: root/gdb/score-tdep.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2011-01-11 21:53:25 +0000
committerMichael Snyder <msnyder@vmware.com>2011-01-11 21:53:25 +0000
commitc378eb4eaae2baecb17b41ba928daf9dc74b1aab (patch)
tree0b086b28cdcda59cb9004a848297fb08d804ed20 /gdb/score-tdep.c
parent6c162d5eb67081ad91106259239a9a1ef00ec7a6 (diff)
2011-01-11 Michael Snyder <msnyder@vmware.com>
* s390-tdep.c: Comment cleanup, mostly periods and spaces. * score-tdep.c: Ditto. * score-tdep.h: Ditto. * ser-base.c: Ditto. * ser-go32.c: Ditto. * serial.c: Ditto. * serial.h: Ditto. * ser-mingw.c: Ditto. * ser-pipe.c: Ditto. * ser-tcp.c: Ditto. * ser-unix.c: Ditto. * sh64-tdep.c: Ditto. * shnbsd-nat.c: Ditto. * sh-tdep.c: Ditto. * sh-tdep.h: Ditto. * solib.c: Ditto. * solib-darwin.c: Ditto. * solib-frv.c: Ditto. * solib.h: Ditto. * solib-irix.c: Ditto. * solib-osf.c: Ditto. * solib-pa64.c: Ditto. * solib-som.c: Ditto. * solib-spu.c: Ditto. * solib-sunos.c: Ditto. * solib-svr4.c: Ditto. * solist.h: Ditto. * sol-thread.c: Ditto. * somread.c: Ditto. * source.c: Ditto. * source.h: Ditto. * sparc64-linux-tdep.c: Ditto. * sparc64-tdep.c: Ditto. * sparc-linux-nat.c: Ditto. * sparc-linux-tdep.c: Ditto. * sparc-sol2-nat.c: Ditto. * sparc-sol2-tdep.c: Ditto. * sparc-tdep.c: Ditto. * sparc-tdep.h: Ditto. * spu-tdep.c: Ditto. * stabsread.c: Ditto. * stabsread.h: Ditto. * stack.c: Ditto. * symfile.c: Ditto. * symfile.h: Ditto. * symmisc.c: Ditto. * symtab.c: Ditto. * symtab.h: Ditto. * target.c: Ditto. * target-descriptions.c: Ditto. * target-descriptions.h: Ditto. * target.h: Ditto. * target-memory.c: Ditto. * terminal.h: Ditto. * thread.c: Ditto. * top.c: Ditto. * tracepoint.c: Ditto. * tracepoint.h: Ditto. * trad-frame.h: Ditto. * typeprint.c: Ditto.
Diffstat (limited to 'gdb/score-tdep.c')
-rw-r--r--gdb/score-tdep.c145
1 files changed, 80 insertions, 65 deletions
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index 16ff1ce07d..ffe562fa34 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -43,9 +43,9 @@
((unsigned)((_i) << (31 - (_ms))) >> (31 - (_ms) + (_ls)))
typedef struct{
- unsigned long long v;
- unsigned long long raw;
- unsigned int len;
+ unsigned long long v;
+ unsigned long long raw;
+ unsigned int len;
}inst_t;
struct score_frame_cache
@@ -61,7 +61,8 @@ static struct type *
score_register_type (struct gdbarch *gdbarch, int regnum)
{
gdb_assert (regnum >= 0
- && regnum < ((target_mach == bfd_mach_score7) ? SCORE7_NUM_REGS : SCORE3_NUM_REGS));
+ && regnum < ((target_mach == bfd_mach_score7)
+ ? SCORE7_NUM_REGS : SCORE3_NUM_REGS));
return builtin_type (gdbarch)->builtin_uint32;
}
@@ -121,7 +122,8 @@ static int
score_register_sim_regno (struct gdbarch *gdbarch, int regnum)
{
gdb_assert (regnum >= 0
- && regnum < ((target_mach == bfd_mach_score7) ? SCORE7_NUM_REGS : SCORE3_NUM_REGS));
+ && regnum < ((target_mach == bfd_mach_score7)
+ ? SCORE7_NUM_REGS : SCORE3_NUM_REGS));
return regnum;
}
#endif
@@ -421,7 +423,8 @@ score_xfer_register (struct regcache *regcache, int regnum, int length,
{
int reg_offset = 0;
gdb_assert (regnum >= 0
- && regnum < ((target_mach == bfd_mach_score7) ? SCORE7_NUM_REGS : SCORE3_NUM_REGS));
+ && regnum < ((target_mach == bfd_mach_score7)
+ ? SCORE7_NUM_REGS : SCORE3_NUM_REGS));
switch (endian)
{
@@ -465,6 +468,7 @@ score_return_value (struct gdbarch *gdbarch, struct type *func_type,
offset += SCORE_REGSIZE, regnum++)
{
int xfer = SCORE_REGSIZE;
+
if (offset + xfer > TYPE_LENGTH (type))
xfer = TYPE_LENGTH (type) - offset;
score_xfer_register (regcache, regnum, xfer,
@@ -478,9 +482,9 @@ score_return_value (struct gdbarch *gdbarch, struct type *func_type,
static struct frame_id
score_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
{
- return frame_id_build (
- get_frame_register_unsigned (this_frame, SCORE_SP_REGNUM),
- get_frame_pc (this_frame));
+ return frame_id_build (get_frame_register_unsigned (this_frame,
+ SCORE_SP_REGNUM),
+ get_frame_pc (this_frame));
}
static int
@@ -687,7 +691,8 @@ score3_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
while (iscan-- > 0)
{
inst_t *inst
- = score3_adjust_pc_and_fetch_inst (&cpc, NULL, gdbarch_byte_order (gdbarch));
+ = score3_adjust_pc_and_fetch_inst (&cpc, NULL,
+ gdbarch_byte_order (gdbarch));
if (!inst)
break;
@@ -764,7 +769,8 @@ score3_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR cur_pc)
{
CORE_ADDR pc = cur_pc;
inst_t *inst
- = score3_adjust_pc_and_fetch_inst (&pc, NULL, gdbarch_byte_order (gdbarch));
+ = score3_adjust_pc_and_fetch_inst (&pc, NULL,
+ gdbarch_byte_order (gdbarch));
if (inst->len == 2
&& (G_FLD (inst->v, 14, 10) == 0x10)
@@ -901,7 +907,7 @@ score7_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
inst = score7_fetch_inst (gdbarch, cur_pc, NULL);
}
- /* FIXME: make a full-power prologue analyzer */
+ /* FIXME: make a full-power prologue analyzer. */
if (inst->len == 2)
{
inst_len = SCORE16_INSTLEN;
@@ -1071,7 +1077,8 @@ score3_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
CORE_ADDR sp;
CORE_ADDR fp;
CORE_ADDR cur_pc = startaddr;
- enum bfd_endian byte_order = gdbarch_byte_order (get_frame_arch (this_frame));
+ enum bfd_endian byte_order
+ = gdbarch_byte_order (get_frame_arch (this_frame));
int sp_offset = 0;
int ra_offset = 0;
@@ -1091,7 +1098,7 @@ score3_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
inst = score3_adjust_pc_and_fetch_inst (&cur_pc, &inst_len, byte_order);
- /* FIXME: make a full-power prologue analyzer */
+ /* FIXME: make a full-power prologue analyzer. */
if (inst->len == 2)
{
if (G_FLD (inst->v, 14, 12) == 0x0
@@ -1177,7 +1184,8 @@ score3_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
inst_t *inst2;
cur_pc += inst->len;
- inst2 = score3_adjust_pc_and_fetch_inst (&cur_pc, NULL, byte_order);
+ inst2 = score3_adjust_pc_and_fetch_inst (&cur_pc, NULL,
+ byte_order);
if (inst2->len == 2
&& G_FLD (inst2->v, 14, 10) == 0x10
@@ -1262,7 +1270,8 @@ score3_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
inst_t *inst2;
cur_pc += inst->len;
- inst2 = score3_adjust_pc_and_fetch_inst (&cur_pc, NULL, byte_order);
+ inst2 = score3_adjust_pc_and_fetch_inst (&cur_pc, NULL,
+ byte_order);
if (inst2->len == 2
&& G_FLD (inst2->v, 14, 10) == 0x10
@@ -1392,74 +1401,76 @@ score_prologue_frame_base_sniffer (struct frame_info *this_frame)
/* Core file support (dirty hack)
- The core file MUST be generated by GNU/Linux on S+core */
+ The core file MUST be generated by GNU/Linux on S+core. */
static void
score7_linux_supply_gregset(const struct regset *regset,
struct regcache *regcache,
int regnum, const void *gregs_buf, size_t len)
{
- int regno;
- elf_gregset_t *gregs;
+ int regno;
+ elf_gregset_t *gregs;
- gdb_assert (regset != NULL);
- gdb_assert ((regcache != NULL) && (gregs_buf != NULL));
+ gdb_assert (regset != NULL);
+ gdb_assert ((regcache != NULL) && (gregs_buf != NULL));
- gregs = (elf_gregset_t *) gregs_buf;
+ gregs = (elf_gregset_t *) gregs_buf;
- for (regno = 0; regno < 32; regno++)
- if (regnum == -1 || regnum == regno)
- regcache_raw_supply (regcache, regno, gregs->regs + regno);
+ for (regno = 0; regno < 32; regno++)
+ if (regnum == -1 || regnum == regno)
+ regcache_raw_supply (regcache, regno, gregs->regs + regno);
- {
- struct sreg {
- int regnum;
- void *buf;
- } sregs [] = {
- { 55, &(gregs->cel) }, /* CEL */
- { 54, &(gregs->ceh) }, /* CEH */
- { 53, &(gregs->sr0) }, /* sr0, i.e. cnt or COUNTER */
- { 52, &(gregs->sr1) }, /* sr1, i.e. lcr or LDCR */
- { 51, &(gregs->sr1) }, /* sr2, i.e. scr or STCR */
-
- /* Exception occured at this address, exactly the PC we want */
- { 49, &(gregs->cp0_epc) }, /* PC */
-
- { 38, &(gregs->cp0_ema) }, /* EMA */
- { 37, &(gregs->cp0_epc) }, /* EPC */
- { 34, &(gregs->cp0_ecr) }, /* ECR */
- { 33, &(gregs->cp0_condition) }, /* COND */
- { 32, &(gregs->cp0_psr) }, /* PSR */
- };
-
- for (regno = 0; regno < sizeof(sregs)/sizeof(sregs[0]); regno++)
- if (regnum == -1 || regnum == sregs[regno].regnum)
- regcache_raw_supply (regcache, sregs[regno].regnum, sregs[regno].buf);
- }
+ {
+ struct sreg {
+ int regnum;
+ void *buf;
+ } sregs [] = {
+ { 55, &(gregs->cel) }, /* CEL */
+ { 54, &(gregs->ceh) }, /* CEH */
+ { 53, &(gregs->sr0) }, /* sr0, i.e. cnt or COUNTER */
+ { 52, &(gregs->sr1) }, /* sr1, i.e. lcr or LDCR */
+ { 51, &(gregs->sr1) }, /* sr2, i.e. scr or STCR */
+
+ /* Exception occured at this address, exactly the PC we want */
+ { 49, &(gregs->cp0_epc) }, /* PC */
+
+ { 38, &(gregs->cp0_ema) }, /* EMA */
+ { 37, &(gregs->cp0_epc) }, /* EPC */
+ { 34, &(gregs->cp0_ecr) }, /* ECR */
+ { 33, &(gregs->cp0_condition) }, /* COND */
+ { 32, &(gregs->cp0_psr) }, /* PSR */
+ };
+
+ for (regno = 0; regno < sizeof(sregs)/sizeof(sregs[0]); regno++)
+ if (regnum == -1 || regnum == sregs[regno].regnum)
+ regcache_raw_supply (regcache,
+ sregs[regno].regnum, sregs[regno].buf);
+ }
}
/* Return the appropriate register set from the core section identified
- by SECT_NAME and SECT_SIZE. */
+ by SECT_NAME and SECT_SIZE. */
static const struct regset *
score7_linux_regset_from_core_section(struct gdbarch *gdbarch,
const char *sect_name, size_t sect_size)
{
- struct gdbarch_tdep *tdep;
+ struct gdbarch_tdep *tdep;
- gdb_assert (gdbarch != NULL);
- gdb_assert (sect_name != NULL);
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (sect_name != NULL);
- tdep = gdbarch_tdep (gdbarch);
+ tdep = gdbarch_tdep (gdbarch);
- if (strcmp(sect_name, ".reg") == 0 && sect_size == sizeof(elf_gregset_t))
+ if (strcmp(sect_name, ".reg") == 0 && sect_size == sizeof(elf_gregset_t))
{
- if (tdep->gregset == NULL)
- tdep->gregset = regset_alloc (gdbarch, score7_linux_supply_gregset, NULL);
- return tdep->gregset;
+ if (tdep->gregset == NULL)
+ tdep->gregset = regset_alloc (gdbarch,
+ score7_linux_supply_gregset, NULL);
+ return tdep->gregset;
}
- return NULL;
+ return NULL;
}
static struct gdbarch *
@@ -1487,7 +1498,8 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
#endif
set_gdbarch_pc_regnum (gdbarch, SCORE_PC_REGNUM);
set_gdbarch_sp_regnum (gdbarch, SCORE_SP_REGNUM);
- set_gdbarch_adjust_breakpoint_address (gdbarch, score_adjust_breakpoint_address);
+ set_gdbarch_adjust_breakpoint_address (gdbarch,
+ score_adjust_breakpoint_address);
set_gdbarch_register_type (gdbarch, score_register_type);
set_gdbarch_frame_align (gdbarch, score_frame_align);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
@@ -1500,17 +1512,20 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
case bfd_mach_score7:
set_gdbarch_breakpoint_from_pc (gdbarch, score7_breakpoint_from_pc);
set_gdbarch_skip_prologue (gdbarch, score7_skip_prologue);
- set_gdbarch_in_function_epilogue_p (gdbarch, score7_in_function_epilogue_p);
+ set_gdbarch_in_function_epilogue_p (gdbarch,
+ score7_in_function_epilogue_p);
set_gdbarch_register_name (gdbarch, score7_register_name);
set_gdbarch_num_regs (gdbarch, SCORE7_NUM_REGS);
- /* Core file support. */
- set_gdbarch_regset_from_core_section (gdbarch, score7_linux_regset_from_core_section);
+ /* Core file support. */
+ set_gdbarch_regset_from_core_section (gdbarch,
+ score7_linux_regset_from_core_section);
break;
case bfd_mach_score3:
set_gdbarch_breakpoint_from_pc (gdbarch, score3_breakpoint_from_pc);
set_gdbarch_skip_prologue (gdbarch, score3_skip_prologue);
- set_gdbarch_in_function_epilogue_p (gdbarch, score3_in_function_epilogue_p);
+ set_gdbarch_in_function_epilogue_p (gdbarch,
+ score3_in_function_epilogue_p);
set_gdbarch_register_name (gdbarch, score3_register_name);
set_gdbarch_num_regs (gdbarch, SCORE3_NUM_REGS);
break;