void cyg_hal_gdb_interrupt (target_register_t pc) { t_inst break_inst = HAL_BREAKINST; CYGARC_HAL_SAVE_GP(); // Clear flag that we Continued instead of Stepping cyg_hal_gdb_running_step = 0; // and override existing break? So that a ^C takes effect... if (NULL != break_buffer.targetAddr) cyg_hal_gdb_remove_break( (target_register_t)break_buffer.targetAddr ); if (NULL == break_buffer.targetAddr) { // Not always safe to read/write directly to program // memory due to possibly unaligned instruction, use the // provided memory functions instead. __read_mem_safe(&break_buffer.savedInstr, (t_inst*)pc, HAL_BREAKINST_SIZE); __write_mem_safe(&break_inst, (t_inst*)pc, HAL_BREAKINST_SIZE); // Save the PC where we put the break, so we can remove // it after the target takes the break. break_buffer.targetAddr = (t_inst*)pc; __data_cache(CACHE_FLUSH); __instruction_cache(CACHE_FLUSH); } CYGARC_HAL_RESTORE_GP(); }
void __install_breakpoint_list (void) { struct breakpoint_list *l = breakpoint_list; while (l != NULL) { if (! l->in_memory) { int len = sizeof (l->old_contents); if (__read_mem_safe (&l->old_contents[0], (void*)l->addr, len) == len) { if (__write_mem_safe (HAL_BREAKINST_ADDR(l->length), (void*)l->addr, l->length) == l->length) { l->in_memory = 1; } } } l = l->next; } #if defined(HAL_STUB_HW_BREAKPOINT_LIST_SIZE) && (HAL_STUB_HW_BREAKPOINT_LIST_SIZE > 0) __install_hw_breakpoint_list(); #endif #if defined(HAL_STUB_HW_WATCHPOINT_LIST_SIZE) && (HAL_STUB_HW_WATCHPOINT_LIST_SIZE > 0) __install_hw_watchpoint_list(); #endif HAL_ICACHE_SYNC(); }
int read_memory (mem_addr_t *src, int size, int amt, char *dst) { #if defined(HAVE_BSP) && !defined(USE_ECOS_HAL_SAFE_MEMORY) return (bsp_memory_read((unsigned char *)src->addr, MEM_ADDR_ASI(src), size << 3, amt, dst) != amt); #else int totamt = size * amt; return (totamt != __read_mem_safe (dst, (void*)src->addr, totamt)); #endif }