/* Override the to_xfer_partial routine. */ static LONGEST spu_xfer_partial (struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, LONGEST len) { struct target_ops *ops_beneath = find_target_beneath (ops); while (ops_beneath && !ops_beneath->to_xfer_partial) ops_beneath = find_target_beneath (ops_beneath); gdb_assert (ops_beneath); /* Use the "mem" spufs file to access SPU local store. */ if (object == TARGET_OBJECT_MEMORY) { int fd = SPUADDR_SPU (offset); CORE_ADDR addr = SPUADDR_ADDR (offset); char mem_annex[32]; if (fd >= 0 && addr < SPU_LS_SIZE) { xsnprintf (mem_annex, sizeof mem_annex, "%d/mem", fd); return ops_beneath->to_xfer_partial (ops_beneath, TARGET_OBJECT_SPU, mem_annex, readbuf, writebuf, addr, len); } } return ops_beneath->to_xfer_partial (ops_beneath, object, annex, readbuf, writebuf, offset, len); }
/* Appends OpenCL programs to the list of `struct so_list' objects. */ static void append_ocl_sos (struct so_list **link_ptr) { CORE_ADDR *ocl_program_addr_base; struct objfile *objfile; ALL_OBJFILES (objfile) { ocl_program_addr_base = (CORE_ADDR *) objfile_data (objfile, ocl_program_data_key); if (ocl_program_addr_base != NULL) { enum bfd_endian byte_order = bfd_big_endian (objfile->obfd)? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE; TRY { CORE_ADDR data = read_memory_unsigned_integer (*ocl_program_addr_base, sizeof (CORE_ADDR), byte_order); if (data != 0x0) { struct so_list *newobj; /* Allocate so_list structure. */ newobj = XCNEW (struct so_list); /* Encode FD and object ID in path name. */ xsnprintf (newobj->so_name, sizeof newobj->so_name, "@%s <%d>", hex_string (data), SPUADDR_SPU (*ocl_program_addr_base)); strcpy (newobj->so_original_name, newobj->so_name); *link_ptr = newobj; link_ptr = &newobj->next; } } CATCH (ex, RETURN_MASK_ALL) { /* Ignore memory errors. */ switch (ex.error) { case MEMORY_ERROR: break; default: throw_exception (ex); break; } } END_CATCH } } }
/* Override the to_region_ok_for_hw_watchpoint routine. */ static int spu_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) { struct target_ops *ops_beneath = find_target_beneath (&spu_ops); while (ops_beneath && !ops_beneath->to_region_ok_for_hw_watchpoint) ops_beneath = find_target_beneath (ops_beneath); /* We cannot watch SPU local store. */ if (SPUADDR_SPU (addr) != -1) return 0; if (ops_beneath) return ops_beneath->to_region_ok_for_hw_watchpoint (addr, len); return 0; }
/* Override the to_search_memory routine. */ static int spu_search_memory (struct target_ops* ops, CORE_ADDR start_addr, ULONGEST search_space_len, const gdb_byte *pattern, ULONGEST pattern_len, CORE_ADDR *found_addrp) { struct target_ops *ops_beneath = find_target_beneath (ops); while (ops_beneath && !ops_beneath->to_search_memory) ops_beneath = find_target_beneath (ops_beneath); /* For SPU local store, always fall back to the simple method. Likewise if we do not have any target-specific special implementation. */ if (!ops_beneath || SPUADDR_SPU (start_addr) >= 0) return simple_search_memory (ops, start_addr, search_space_len, pattern, pattern_len, found_addrp); return ops_beneath->to_search_memory (ops_beneath, start_addr, search_space_len, pattern, pattern_len, found_addrp); }