/* SPU target-dependent code for GDB, the GNU debugger.
- Copyright (C) 2006-2018 Free Software Foundation, Inc.
+ Copyright (C) 2006-2019 Free Software Foundation, Inc.
Contributed by Ulrich Weigand <uweigand@de.ibm.com>.
Based on a port by Sid Manning <sid@us.ibm.com>.
return status;
xsnprintf (annex, sizeof annex, "%d/%s", (int) id, regname);
memset (reg, 0, sizeof reg);
- target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
reg, 0, sizeof reg);
ul = strtoulst ((char *) reg, NULL, 16);
if (status != REG_VALID)
return status;
xsnprintf (annex, sizeof annex, "%d/fpcr", (int) id);
- target_read (target_stack, TARGET_OBJECT_SPU, annex, buf, 0, 16);
+ target_read (current_top_target (), TARGET_OBJECT_SPU, annex, buf, 0, 16);
return status;
case SPU_SRR0_REGNUM:
xsnprintf (annex, sizeof annex, "%d/%s", (int) id, regname);
xsnprintf (reg, sizeof reg, "0x%s",
phex_nz (extract_unsigned_integer (buf, 4, byte_order), 4));
- target_write (target_stack, TARGET_OBJECT_SPU, annex,
+ target_write (current_top_target (), TARGET_OBJECT_SPU, annex,
(gdb_byte *) reg, 0, strlen (reg));
}
case SPU_FPSCR_REGNUM:
regcache_raw_read_unsigned (regcache, SPU_ID_REGNUM, &id);
xsnprintf (annex, sizeof annex, "%d/fpcr", (int) id);
- target_write (target_stack, TARGET_OBJECT_SPU, annex, buf, 0, 16);
+ target_write (current_top_target (), TARGET_OBJECT_SPU, annex, buf, 0, 16);
break;
case SPU_SRR0_REGNUM:
spu_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr,
int nargs, struct value **args, CORE_ADDR sp,
- int struct_return, CORE_ADDR struct_addr)
+ function_call_return_method return_method,
+ CORE_ADDR struct_addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sp_delta;
/* If STRUCT_RETURN is true, then the struct return address (in
STRUCT_ADDR) will consume the first argument-passing register.
Both adjust the register count and store that value. */
- if (struct_return)
+ if (return_method == return_method_struct)
{
memset (buf, 0, sizeof buf);
store_unsigned_integer (buf, 4, byte_order, SPUADDR_ADDR (struct_addr));
-- this is not the correct behaviour.
The workaround is to check whether the PID we are asked to remove this
- breakpoint from (i.e. ptid_get_pid (inferior_ptid)) is different from the
+ breakpoint from (i.e. inferior_ptid.pid ()) is different from the
PID of the current inferior (i.e. current_inferior ()->pid). This is only
true in the context of detach_breakpoints. If so, we simply do nothing.
[ Note that for the fork child process, it does not matter if breakpoints
remain inserted, because those SPU contexts are not runnable anyway --
the Linux kernel allows only the original process to invoke spu_run. */
- if (ptid_get_pid (inferior_ptid) != current_inferior ()->pid)
+ if (inferior_ptid.pid () != current_inferior ()->pid)
return 0;
return default_memory_remove_breakpoint (gdbarch, bp_tgt);
{
CORE_ADDR vma = extract_unsigned_integer (ovly_table + 16*i + 0,
4, byte_order);
- CORE_ADDR size = extract_unsigned_integer (ovly_table + 16*i + 4,
- 4, byte_order);
+ /* Note that this skips the "size" entry, which is at offset
+ 4. */
CORE_ADDR pos = extract_unsigned_integer (ovly_table + 16*i + 8,
4, byte_order);
CORE_ADDR buf = extract_unsigned_integer (ovly_table + 16*i + 12,
/* All sections. */
else
{
- struct objfile *objfile;
-
- ALL_OBJSECTIONS (objfile, osect)
- if (section_is_overlay (osect))
- spu_overlay_update_osect (osect);
+ for (objfile *objfile : current_program_space->objfiles ())
+ ALL_OBJFILE_OSECTIONS (objfile, osect)
+ if (section_is_overlay (osect))
+ spu_overlay_update_osect (osect);
}
}
if (cust != NULL)
{
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust);
- struct block *block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+ const struct block *block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
struct symbol *sym;
struct symtab_and_line sal;
{
struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- struct objfile *obj;
if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
return NULL;
- ALL_OBJFILES (obj)
+ for (objfile *obj : current_program_space->objfiles ())
{
if (obj->sections != obj->sections_end
&& SPUADDR_SPU (obj_section_addr (obj->sections)) == tdep->id)
type = lookup_pointer_type (type);
addr = BMSYMBOL_VALUE_ADDRESS (msymbol);
- call_function_by_hand (value_from_pointer (type, addr), NULL, 0, NULL);
+ call_function_by_hand (value_from_pointer (type, addr), NULL, {});
}
}
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/event_status", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read event_status."));
event_status = strtoulst ((char *) buf, NULL, 16);
xsnprintf (annex, sizeof annex, "%d/event_mask", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read event_mask."));
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/signal1", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex, buf, 0, 4);
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU,
+ annex, buf, 0, 4);
if (len < 0)
error (_("Could not read signal1."));
else if (len == 4)
}
xsnprintf (annex, sizeof annex, "%d/signal1_type", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read signal1_type."));
signal1_type = strtoulst ((char *) buf, NULL, 16);
xsnprintf (annex, sizeof annex, "%d/signal2", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex, buf, 0, 4);
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU,
+ annex, buf, 0, 4);
if (len < 0)
error (_("Could not read signal2."));
else if (len == 4)
}
xsnprintf (annex, sizeof annex, "%d/signal2_type", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read signal2_type."));
ui_out_emit_tuple tuple_emitter (current_uiout, "SPUInfoMailbox");
xsnprintf (annex, sizeof annex, "%d/mbox_info", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, sizeof buf);
if (len < 0)
error (_("Could not read mbox_info."));
"mbox", "SPU Outbound Mailbox");
xsnprintf (annex, sizeof annex, "%d/ibox_info", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, sizeof buf);
if (len < 0)
error (_("Could not read ibox_info."));
"ibox", "SPU Outbound Interrupt Mailbox");
xsnprintf (annex, sizeof annex, "%d/wbox_info", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, sizeof buf);
if (len < 0)
error (_("Could not read wbox_info."));
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/dma_info", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, 40 + 16 * 32);
if (len <= 0)
error (_("Could not read dma_info."));
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/proxydma_info", id);
- len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
+ len = target_read (current_top_target (), TARGET_OBJECT_SPU, annex,
buf, 0, 24 + 8 * 32);
if (len <= 0)
error (_("Could not read proxydma_info."));