extern struct target_type stm8_target;
extern struct target_type riscv_target;
extern struct target_type mem_ap_target;
+extern struct target_type esirisc_target;
static struct target_type *target_types[] = {
&arm7tdmi_target,
&quark_d20xx_target,
&stm8_target,
&riscv_target,
+ &mem_ap_target,
+ &esirisc_target,
#if BUILD_TARGET64
&aarch64_target,
#endif
- &mem_ap_target,
NULL,
};
struct target *get_current_target(struct command_context *cmd_ctx)
{
- struct target *target = cmd_ctx->current_target_override
- ? cmd_ctx->current_target_override
- : cmd_ctx->current_target;
+ struct target *target = get_current_target_or_null(cmd_ctx);
if (target == NULL) {
LOG_ERROR("BUG: current_target out of bounds");
return target;
}
+struct target *get_current_target_or_null(struct command_context *cmd_ctx)
+{
+ return cmd_ctx->current_target_override
+ ? cmd_ctx->current_target_override
+ : cmd_ctx->current_target;
+}
+
int target_poll(struct target *target)
{
int retval;
retval = target_write_u32(target, wp_addr, wp);
if (retval != ERROR_OK)
break;
+
+ /* Avoid GDB timeouts */
+ keep_alive();
}
if (retval != ERROR_OK) {
return target->type->hit_watchpoint(target, hit_watchpoint);
}
+const char *target_get_gdb_arch(struct target *target)
+{
+ if (target->type->get_gdb_arch == NULL)
+ return NULL;
+ return target->type->get_gdb_arch(target);
+}
+
int target_get_gdb_reg_list(struct target *target,
struct reg **reg_list[], int *reg_list_size,
enum target_register_class reg_class)
for (i = 0, reg = cache->reg_list;
i < cache->num_regs;
i++, reg++, count++) {
+ if (reg->exist == false)
+ continue;
/* only print cached values if they are valid */
if (reg->valid) {
value = buf_to_str(reg->value,
/* access a single register by its name */
reg = register_get_by_name(target->reg_cache, CMD_ARGV[0], 1);
- if (!reg) {
- command_print(CMD_CTX, "register %s not found in current target", CMD_ARGV[0]);
- return ERROR_OK;
- }
+ if (!reg)
+ goto not_found;
}
assert(reg != NULL); /* give clang a hint that we *know* reg is != NULL here */
+ if (!reg->exist)
+ goto not_found;
+
/* display a register */
if ((CMD_ARGC == 1) || ((CMD_ARGC == 2) && !((CMD_ARGV[1][0] >= '0')
&& (CMD_ARGV[1][0] <= '9')))) {
}
return ERROR_COMMAND_SYNTAX_ERROR;
+
+not_found:
+ command_print(CMD_CTX, "register %s not found in current target", CMD_ARGV[0]);
+ return ERROR_OK;
}
COMMAND_HANDLER(handle_poll_command)