target: create and use target_name()

Several of the sites now using target_type_name() really
ought to be using an instance-specific name.  Create a
function called target_name(), accessing the instance's
own (command) name.

Use it in several places that really should be displaying
instance-specific names.  Also in several places which
were already doing so, but which had no wrapper to call.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
This commit is contained in:
David Brownell
2009-11-25 16:38:08 -08:00
parent b715a81f5b
commit 2653b80307
5 changed files with 34 additions and 24 deletions

View File

@@ -774,7 +774,7 @@ int gdb_new_connection(struct connection *connection)
gdb_actual_connections++;
LOG_DEBUG("New GDB Connection: %d, Target %s, state: %s",
gdb_actual_connections,
gdb_service->target->cmd_name,
target_name(gdb_service->target),
target_state_name(gdb_service->target));
return ERROR_OK;
@@ -792,7 +792,7 @@ int gdb_connection_closed(struct connection *connection)
gdb_actual_connections--;
LOG_DEBUG("GDB Close, Target: %s, state: %s, gdb_actual_connections=%d",
gdb_service->target->cmd_name,
target_name(gdb_service->target),
target_state_name(gdb_service->target),
gdb_actual_connections);
@@ -2138,7 +2138,7 @@ int gdb_input_inner(struct connection *connection)
watchpoint_clear_target(gdb_service->target);
command_run_linef(connection->cmd_ctx,
"ocd_gdb_restart %s",
target->cmd_name);
target_name(target));
break;
default:
/* ignore unkown packets */
@@ -2216,7 +2216,7 @@ int gdb_init(void)
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(target));
target_name(target));
}
else
{
@@ -2233,7 +2233,7 @@ int gdb_init(void)
gdb_connection_closed, gdb_service);
LOG_DEBUG("gdb service for target %s at TCP port %i",
target_type_name(target),
target_name(target),
port);
target = target->next;
port++;