add_service("gdb", CONNECTION_PIPE, 0, 1, gdb_new_connection, gdb_input, gdb_connection_closed, gdb_service);
- LOG_DEBUG("gdb service for target %s using pipes", target->type->name);
+ LOG_DEBUG("gdb service for target %s using pipes",
+ target_get_name(target));
}
else
{
add_service("gdb", CONNECTION_TCP, gdb_port + target->target_number, 1, gdb_new_connection, gdb_input, gdb_connection_closed, gdb_service);
- LOG_DEBUG("gdb service for target %s at port %i", target->type->name, gdb_port + target->target_number);
+ LOG_DEBUG("gdb service for target %s at port %i",
+ target_get_name(target),
+ gdb_port + target->target_number);
target = target->next;
}
}
continue;
/* if (t->type == arm11_target) */
- if (0 == strcmp(t->type->name, "arm11"))
+ if (0 == strcmp(target_get_name(t), "arm11"))
return t->arch_info;
}
* in some unusual bits. Let feroceon.c validate it
* and do the appropriate setup itself.
*/
- if (strcmp(target->type->name, "feroceon") == 0)
+ if (strcmp(target_get_name(target), "feroceon") == 0)
break;
LOG_ERROR("unknown EmbeddedICE version (comms ctrl: 0x%8.8x)", buf_get_u32(reg_list[EICE_COMMS_CTRL].value, 0, 32));
}
}
return retval;
}
+const char *target_get_name(struct target_s *target)
+{
+ return target->type->name;
+}
static int target_write_memory_imp(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer)
{
if ((retval = target->type->init_target(cmd_ctx, target)) != ERROR_OK)
{
- LOG_ERROR("target '%s' init failed", target->type->name);
+ LOG_ERROR("target '%s' init failed", target_get_name(target));
return retval;
}
command_print(cmd_ctx, "%2d: %-10s %-10s %-10s %10d %14s %s",
target->target_number,
target->cmd_name,
- target->type->name,
+ target_get_name(target),
Jim_Nvp_value2name_simple( nvp_target_endian, target->endianness )->name,
target->tap->abs_chain_position,
target->tap->dotted_name,
LOG_DEBUG( "target: (%d) %s (%s) event: %d (%s) action: %s\n",
target->target_number,
target->cmd_name,
- target->type->name,
+ target_get_name(target),
e,
Jim_Nvp_value2name_simple( nvp_target_event, e )->name,
Jim_GetString( teap->body, NULL ) );
return JIM_ERR;
}
}
- Jim_SetResultString( goi->interp, target->type->name, -1 );
+ Jim_SetResultString( goi->interp, target_get_name(target), -1 );
/* loop for more */
break;
case TCFG_EVENT:
typedef struct target_type_s
{
+ /**
+ * Name of the target. Do @b not access this field directly, use
+ * target_get_name() instead.
+ */
char *name;
/**
extern int get_num_by_target(target_t *query_target);
extern target_t *get_target(const char *id);
+/**
+ * Get the target name.
+ *
+ * This routine is a wrapper for the target->type->name field.
+ */
+extern const char *target_get_name(struct target_s *target);
+
/// @returns @c true if the target has been examined.
extern bool target_was_examined(struct target_s *target);
/// Sets the @c examined flag for the given target.