David Brownell [david-b@pacbell.net]:
authorntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 18 Aug 2009 19:55:01 +0000 (19:55 +0000)
committerntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 18 Aug 2009 19:55:01 +0000 (19:55 +0000)
Simplify dumping of register lists by only printing cached values
if they are marked as valid.  Most of the time, they are invalid;
so printing *any* value is just misleading.

Note that for ARM7 and ARM9 most EmbeddedICE registers (except for
debug status) could be cached most of the time; and their register
cache isn't maintained properly (many accesses seem to bypass that
cache code).

git-svn-id: svn://svn.berlios.de/openocd/trunk@2594 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/target/target.c

index 670b4ba8b5921e3230e48cddc34ab5562fd82fd7..946090787b2f53109d9e260a667c3f3a717934f8 100644 (file)
@@ -1741,17 +1741,28 @@ static int handle_reg_command(struct command_context_s *cmd_ctx, char *cmd, char
                while (cache)
                {
                        int i;
-                       for (i = 0; i < cache->num_regs; i++)
+
+                       for (i = 0, reg = cache->reg_list;
+                                       i < cache->num_regs;
+                                       i++, reg++, count++)
                        {
-                               value = buf_to_str(cache->reg_list[i].value, cache->reg_list[i].size, 16);
-                               command_print(cmd_ctx, "(%i) %s (/%i): 0x%s (dirty: %i, valid: %i)",
-                                                         count++,
-                                                         cache->reg_list[i].name,
-                                                         (int)(cache->reg_list[i].size),
-                                                         value,
-                                                         cache->reg_list[i].dirty,
-                                                         cache->reg_list[i].valid);
-                               free(value);
+                               /* only print cached values if they are valid */
+                               if (reg->valid) {
+                                       value = buf_to_str(reg->value,
+                                                       reg->size, 16);
+                                       command_print(cmd_ctx,
+                                                       "(%i) %s (/%u): 0x%s%s",
+                                                       count, reg->name,
+                                                       reg->size, value,
+                                                       reg->dirty
+                                                               ? " (dirty)"
+                                                               : "");
+                                       free(value);
+                               } else {
+                                       command_print(cmd_ctx, "(%i) %s (/%u)",
+                                                         count, reg->name,
+                                                         reg->size) ;
+                               }
                        }
                        cache = cache->next;
                }

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)