+/* Enable shared library breakpoint for the
+ OpenCL runtime running on the SPU. */
+static void
+ocl_enable_break (struct objfile *objfile)
+{
+ struct bound_minimal_symbol event_sym;
+ struct bound_minimal_symbol addr_sym;
+
+ /* The OpenCL runtime on the SPU will call __opencl_program_update_event
+ whenever an OpenCL program is loaded. */
+ event_sym = lookup_minimal_symbol ("__opencl_program_update_event", NULL,
+ objfile);
+ /* The PPU address of the OpenCL program can be found
+ at opencl_elf_image_address. */
+ addr_sym = lookup_minimal_symbol ("opencl_elf_image_address", NULL, objfile);
+
+ if (event_sym.minsym && addr_sym.minsym)
+ {
+ /* Place a solib_event breakpoint on the symbol. */
+ CORE_ADDR event_addr = BMSYMBOL_VALUE_ADDRESS (event_sym);
+ create_solib_event_breakpoint (get_objfile_arch (objfile), event_addr);
+
+ /* Store the address of the symbol that will point to OpenCL program
+ using the per-objfile private data mechanism. */
+ if (objfile_data (objfile, ocl_program_data_key) == NULL)
+ {
+ CORE_ADDR *ocl_program_addr_base = OBSTACK_CALLOC (
+ &objfile->objfile_obstack,
+ objfile->sections_end - objfile->sections,
+ CORE_ADDR);
+ *ocl_program_addr_base = BMSYMBOL_VALUE_ADDRESS (addr_sym);
+ set_objfile_data (objfile, ocl_program_data_key,
+ ocl_program_addr_base);
+ }
+ }
+}
+