target: target_get_name() --> target_type_name()
authorDavid Brownell <dbrownell@users.sourceforge.net>
Thu, 26 Nov 2009 00:38:08 +0000 (16:38 -0800)
committerDavid Brownell <dbrownell@users.sourceforge.net>
Thu, 26 Nov 2009 00:38:08 +0000 (16:38 -0800)
There are two names that may matter on a per-target basis.
One is a per-instance name (for example, "at91sam7s.cpu").
The other is the name of its type (for example, "arm7tdmi"),
which is shared among multiple targets.

Currently target_get_name() returns the type name, which is
misleading and is rarely appropriate for target diagnostics.
Rename that as target_type_name().

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
src/server/gdb_server.c
src/target/breakpoints.c
src/target/embeddedice.c
src/target/etm.c
src/target/target.c
src/target/target.h
src/target/target_type.h

index cb14cc3f8f3fe62970dad832c0387fc86a002ace..f733e7b6601ba1c31676851ba7b87f3ca876c9e6 100644 (file)
@@ -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_get_name(target));
+                               target_type_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_get_name(target),
+                                       target_type_name(target),
                                        port);
                        target = target->next;
                        port++;
index 3ab1464e8b8db27dab7eb2f3cb9f6cd830598fe1..df797e3774017531cc83937fce25f87646f1971d 100644 (file)
@@ -155,7 +155,9 @@ void breakpoint_remove(struct target *target, uint32_t address)
 void breakpoint_clear_target(struct target *target)
 {
        struct breakpoint *breakpoint;
-       LOG_DEBUG("Delete all breakpoints for target: %s", target_get_name( target ));
+
+       LOG_DEBUG("Delete all breakpoints for target: %s",
+                       target_type_name(target));
        while ((breakpoint = target->breakpoints) != NULL)
        {
                breakpoint_free(target, breakpoint);
@@ -290,7 +292,9 @@ void watchpoint_remove(struct target *target, uint32_t address)
 void watchpoint_clear_target(struct target *target)
 {
        struct watchpoint *watchpoint;
-       LOG_DEBUG("Delete all watchpoints for target: %s", target_get_name( target ));
+
+       LOG_DEBUG("Delete all watchpoints for target: %s",
+                       target_type_name(target));
        while ((watchpoint = target->watchpoints) != NULL)
        {
                watchpoint_free(target, watchpoint);
index 3947e26c9519bdabb602fae01cee6632cfaf5491..cca9cc06269a3281c468aa8e3297d64d215d6b92 100644 (file)
@@ -281,8 +281,8 @@ embeddedice_build_reg_cache(struct target *target, struct arm7_9_common *arm7_9)
                         * in some unusual bits.  Let feroceon.c validate it
                         * and do the appropriate setup itself.
                         */
-                       if (strcmp(target_get_name(target), "feroceon") == 0 ||
-                           strcmp(target_get_name(target), "dragonite") == 0)
+                       if (strcmp(target_type_name(target), "feroceon") == 0 ||
+                           strcmp(target_type_name(target), "dragonite") == 0)
                                break;
                        LOG_ERROR("unknown EmbeddedICE version "
                                "(comms ctrl: 0x%8.8" PRIx32 ")",
index 4e7f9172bf23a66b6a01557d4a2b2bc48f866a7d..2ea7345da9f430820de0996c9d1fd66cd26c21d6 100644 (file)
@@ -1374,7 +1374,7 @@ COMMAND_HANDLER(handle_etm_config_command)
        arm = target_to_arm(target);
        if (!is_arm(arm)) {
                command_print(CMD_CTX, "target '%s' is '%s'; not an ARM",
-                               target->cmd_name, target_get_name(target));
+                               target->cmd_name, target_type_name(target));
                return ERROR_FAIL;
        }
 
index 97a93c06121f409a6f10c14b96a7e4c821f06d7a..f46fc67b4bc35aa57883e3c71c0a35ed8c04debc 100644 (file)
@@ -522,7 +522,7 @@ int target_examine(void)
        }
        return retval;
 }
-const char *target_get_name(struct target *target)
+const char *target_type_name(struct target *target)
 {
        return target->type->name;
 }
@@ -766,7 +766,7 @@ int target_init(struct command_context *cmd_ctx)
 
                if ((retval = target->type->init_target(cmd_ctx, target)) != ERROR_OK)
                {
-                       LOG_ERROR("target '%s' init failed", target_get_name(target));
+                       LOG_ERROR("target '%s' init failed", target_type_name(target));
                        return retval;
                }
 
@@ -1698,7 +1698,7 @@ DumpTargets:
                                          target->target_number,
                                          marker,
                                          target->cmd_name,
-                                         target_get_name(target),
+                                         target_type_name(target),
                                          Jim_Nvp_value2name_simple(nvp_target_endian,
                                                                target->endianness)->name,
                                          target->tap->dotted_name,
@@ -3511,7 +3511,7 @@ void target_handle_event(struct target *target, enum target_event e)
                        LOG_DEBUG("target: (%d) %s (%s) event: %d (%s) action: %s",
                                           target->target_number,
                                           target->cmd_name,
-                                          target_get_name(target),
+                                          target_type_name(target),
                                           e,
                                           Jim_Nvp_value2name_simple(nvp_target_event, e)->name,
                                           Jim_GetString(teap->body, NULL));
@@ -3585,16 +3585,20 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target)
                case TCFG_TYPE:
                        /* not setable */
                        if (goi->isconfigure) {
-                               Jim_SetResult_sprintf(goi->interp, "not setable: %s", n->name);
+                               Jim_SetResult_sprintf(goi->interp,
+                                               "not settable: %s", n->name);
                                return JIM_ERR;
                        } else {
                        no_params:
                                if (goi->argc != 0) {
-                                       Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "NO PARAMS");
+                                       Jim_WrongNumArgs(goi->interp,
+                                                       goi->argc, goi->argv,
+                                                       "NO PARAMS");
                                        return JIM_ERR;
                                }
                        }
-                       Jim_SetResultString(goi->interp, target_get_name(target), -1);
+                       Jim_SetResultString(goi->interp,
+                                       target_type_name(target), -1);
                        /* loop for more */
                        break;
                case TCFG_EVENT:
index ee40209cb99bc01fd87a89c5574a2695d7b68036..61bc68aefd22d910b937142aa8998539c090dd78 100644 (file)
@@ -280,11 +280,12 @@ struct target* get_current_target(struct command_context *cmd_ctx);
 struct target *get_target(const char *id);
 
 /**
- * Get the target name.
+ * Get the target type name.
  *
  * This routine is a wrapper for the target->type->name field.
+ * Note that this is not an instance-specific name for his target.
  */
-const char *target_get_name(struct target *target);
+const char *target_type_name(struct target *target);
 
 /**
  * Examine the specified @a target, letting it perform any
index 9a0709d859e33837d6dbb6cef508a547281596f7..333b58b41f49201d6b2204728c05e405f4be5b2c 100644 (file)
@@ -39,7 +39,7 @@ struct target_type
 {
        /**
         * Name of this type of target.  Do @b not access this
-        * field directly, use target_get_name() instead.
+        * field directly, use target_type_name() instead.
         */
        char *name;
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)