target: use common target_name to access target::cmd_name member

Change-Id: I203b89ef25a072c3b00b504483d5f2a83477fad6
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1182
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
This commit is contained in:
Spencer Oliver 2013-02-25 16:52:00 +00:00 committed by Andreas Fritiofson
parent ef83a9ee93
commit dcfa3ac7c7
2 changed files with 9 additions and 9 deletions

View File

@ -549,7 +549,7 @@ static int armv7a_read_mpidr(struct target *target)
armv7a->multi_processor_system = (mpidr >> 30) & 1;
armv7a->cluster_id = (mpidr >> 8) & 0xf;
armv7a->cpu_id = mpidr & 0x3;
LOG_INFO("%s cluster %x core %x %s", target->cmd_name,
LOG_INFO("%s cluster %x core %x %s", target_name(target),
armv7a->cluster_id,
armv7a->cpu_id,
armv7a->multi_processor_system == 0 ? "multi core" : "mono core");

View File

@ -379,9 +379,9 @@ struct target *get_target(const char *id)
/* try as tcltarget name */
for (target = all_targets; target; target = target->next) {
if (target->cmd_name == NULL)
if (target_name(target) == NULL)
continue;
if (strcmp(id, target->cmd_name) == 0)
if (strcmp(id, target_name(target)) == 0)
return target;
}
@ -395,7 +395,7 @@ struct target *get_target(const char *id)
for (target = all_targets; target; target = target->next) {
if (target->target_number == (int)num) {
LOG_WARNING("use '%s' as target identifier, not '%u'",
target->cmd_name, num);
target_name(target), num);
return target;
}
}
@ -982,7 +982,7 @@ int target_add_breakpoint(struct target *target,
struct breakpoint *breakpoint)
{
if ((target->state != TARGET_HALTED) && (breakpoint->type != BKPT_HARD)) {
LOG_WARNING("target %s is not halted", target->cmd_name);
LOG_WARNING("target %s is not halted", target_name(target));
return ERROR_TARGET_NOT_HALTED;
}
return target->type->add_breakpoint(target, breakpoint);
@ -992,7 +992,7 @@ int target_add_context_breakpoint(struct target *target,
struct breakpoint *breakpoint)
{
if (target->state != TARGET_HALTED) {
LOG_WARNING("target %s is not halted", target->cmd_name);
LOG_WARNING("target %s is not halted", target_name(target));
return ERROR_TARGET_NOT_HALTED;
}
return target->type->add_context_breakpoint(target, breakpoint);
@ -1002,7 +1002,7 @@ int target_add_hybrid_breakpoint(struct target *target,
struct breakpoint *breakpoint)
{
if (target->state != TARGET_HALTED) {
LOG_WARNING("target %s is not halted", target->cmd_name);
LOG_WARNING("target %s is not halted", target_name(target));
return ERROR_TARGET_NOT_HALTED;
}
return target->type->add_hybrid_breakpoint(target, breakpoint);
@ -1018,7 +1018,7 @@ int target_add_watchpoint(struct target *target,
struct watchpoint *watchpoint)
{
if (target->state != TARGET_HALTED) {
LOG_WARNING("target %s is not halted", target->cmd_name);
LOG_WARNING("target %s is not halted", target_name(target));
return ERROR_TARGET_NOT_HALTED;
}
return target->type->add_watchpoint(target, watchpoint);
@ -5071,7 +5071,7 @@ static int jim_target_current(Jim_Interp *interp, int argc, Jim_Obj *const *argv
struct command_context *cmd_ctx = current_command_context(interp);
assert(cmd_ctx != NULL);
Jim_SetResultString(interp, get_current_target(cmd_ctx)->cmd_name, -1);
Jim_SetResultString(interp, target_name(get_current_target(cmd_ctx)), -1);
return JIM_OK;
}