On Friday 07 August 2009, Spencer Oliver wrote:
>
> Just wondering what the general concensus is on this?
*MY* concensus is that it should merge. ;)
> Do we need also need a 'reg all' when you do want to see all the regsiters
On an ARM9 with EmbeddedICE, ETM, and ETB there are over 160 registers;
showing "all" would be nasty. "reg r0 r3 r8 sp" would be nice; in fact
it's surprising (and unfriendly) to need to ask for them one at a time.
I think register caching needs attention. I was debugging something
recently at 30 KHz clock and the pointless refreshing of the small CM3
register cache was a big slowdown (design goofage); better to refresh
selectively (design fix) and not be so sloppy about caching (lots of
implementation goofs all over). I like to think this patch would be
a step in the right direction.
- Dave
========= CUT HERE
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).
---
src/target/target.c | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -1741,17 +1741,28 @@ static int handle_reg_command(struct com
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;
}
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).
---
src/target/target.c | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -1741,17 +1741,28 @@ static int handle_reg_command(struct com
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;
}
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development