This is an automated email from Gerrit. Colin Baumgarten ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/3938
-- gerrit commit da685352c23a4a0b28e2658c7d626e355c3fa7b1 Author: Colin Baumgarten <[email protected]> Date: Thu Jan 5 21:52:27 2017 +0100 contrib/itmdump: fix dumping multybyte SWIT messages When using itmdump -d 1 to dump ITM software trace messages from a Cortex M3 I noticed that some bytes were lost. This only happened when more than one byte was written to the stimulus port at once. In this case a multibyte SWIT message is generated but itmdump only prints the first byte of this message. Fix this by correctly evaluating the size of SWIT messages and printing all contained bytes. Change-Id: I66153a60c22fd807baf6c1c6ec0b4a5b3f329285 Signed-off-by: Colin Baumgarten <[email protected]> diff --git a/contrib/itmdump.c b/contrib/itmdump.c index 8963894..4910920 100644 --- a/contrib/itmdump.c +++ b/contrib/itmdump.c @@ -108,7 +108,7 @@ static void show_reserved(FILE *f, char *label, int c) printf("\n"); } -static bool read_varlen(FILE *f, int c, unsigned *value) +static unsigned read_varlen(FILE *f, int c, unsigned *value) { unsigned size; unsigned char buf[4]; @@ -127,7 +127,7 @@ static bool read_varlen(FILE *f, int c, unsigned *value) break; default: printf("INVALID SIZE\n"); - return false; + return 0; } memset(buf, 0, sizeof buf); @@ -138,11 +138,11 @@ static bool read_varlen(FILE *f, int c, unsigned *value) + (buf[2] << 16) + (buf[1] << 8) + (buf[0] << 0); - return true; + return size; err: printf("(ERROR %d - %s)\n", errno, strerror(errno)); - return false; + return 0; } static void show_hard(FILE *f, int c) @@ -254,9 +254,13 @@ static void show_swit(FILE *f, int c) unsigned i; if (port + 1 == dump_swit) { - if (!read_varlen(f, c, &value)) - return; - printf("%c", value); + unsigned size = read_varlen(f, c, &value); + + for (i = 0; i < size; ++i) + { + printf("%c", value); + value >>= 8; + } return; } -- ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
