/* SPU target-dependent code for GDB, the GNU debugger.
- Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Contributed by Ulrich Weigand <uweigand@de.ibm.com>.
Based on a port by Sid Manning <sid@us.ibm.com>.
int found_sp = 0;
int found_fp = 0;
int found_lr = 0;
+ int found_bc = 0;
int reg_immed[SPU_NUM_GPRS];
gdb_byte buf[16];
CORE_ADDR prolog_pc = start_pc;
- The first instruction to set up the stack pointer.
- The first instruction to set up the frame pointer.
- The first instruction to save the link register.
+ - The first instruction to save the backchain.
- We return the instruction after the latest of these three,
+ We return the instruction after the latest of these four,
or the incoming PC if none is found. The first instruction
to set up the stack pointer also defines the frame size.
found_lr = 1;
prolog_pc = pc + 4;
}
+
+ if (ra == SPU_RAW_SP_REGNUM
+ && (found_sp? immed == 0 : rt == SPU_RAW_SP_REGNUM)
+ && !found_bc)
+ {
+ found_bc = 1;
+ prolog_pc = pc + 4;
+ }
}
/* _start uses SELB to set up the stack pointer. */
spu_software_single_step (struct frame_info *frame)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct address_space *aspace = get_frame_address_space (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR pc, next_pc;
unsigned int insn;
else
next_pc = (SPUADDR_ADDR (pc) + 4) & (SPU_LS_SIZE - 1);
- insert_single_step_breakpoint (gdbarch, SPUADDR (SPUADDR_SPU (pc), next_pc));
+ insert_single_step_breakpoint (gdbarch,
+ aspace, SPUADDR (SPUADDR_SPU (pc), next_pc));
if (is_branch (insn, &offset, ®))
{
target = target & (SPU_LS_SIZE - 1);
if (target != next_pc)
- insert_single_step_breakpoint (gdbarch,
+ insert_single_step_breakpoint (gdbarch, aspace,
SPUADDR (SPUADDR_SPU (pc), target));
}
struct symbol *sym;
struct symtab_and_line sal;
- sym = lookup_block_symbol (block, "main", NULL, VAR_DOMAIN);
+ sym = lookup_block_symbol (block, "main", VAR_DOMAIN);
if (sym)
{
fixup_symbol_section (sym, objfile);
/* Use a numerical address for the set_breakpoint command to avoid having
the breakpoint re-set incorrectly. */
xsnprintf (buf, sizeof buf, "*%s", core_addr_to_string (pc));
- set_breakpoint (get_objfile_arch (objfile),
- buf, NULL /* condition */,
- 0 /* hardwareflag */, 1 /* tempflag */,
- -1 /* thread */, 0 /* ignore_count */,
- 0 /* pending */, 1 /* enabled */);
+ create_breakpoint (get_objfile_arch (objfile), buf /* arg */,
+ NULL /* cond_string */, -1 /* thread */,
+ 0 /* parse_condition_and_thread */, 1 /* tempflag */,
+ 0 /* hardwareflag */, 0 /* traceflag */,
+ 0 /* ignore_count */,
+ AUTO_BOOLEAN_FALSE /* pending_break_support */,
+ NULL /* ops */, 0 /* from_tty */, 1 /* enabled */);
}