On Fri, 10 Jan 2020 at 20:39, Guenter Roeck <[email protected]> wrote:
>
> Replace debug logging code with tracing.
>
> Signed-off-by: Guenter Roeck <[email protected]>
> ---
> hw/dma/pl330.c | 88 +++++++++++++++++++++++----------------------
> hw/dma/trace-events | 24 +++++++++++++
> +static void pl330_hexdump(uint8_t *buf, size_t size)
> +{
> + unsigned int b, i, len;
> + char tmpbuf[80];
> +
> + for (b = 0; b < size; b += 16) {
> + len = size - b;
> + if (len > 16) {
> + len = 16;
> + }
> + tmpbuf[0] = '\0';
> + for (i = 0; i < len; i++) {
> + if ((i % 4) == 0) {
> + strcat(tmpbuf, " ");
> + }
> + sprintf(tmpbuf + strlen(tmpbuf), " %02x", buf[b + i]);
> + }
> + trace_pl330_hexdump(b, tmpbuf);
> + }
> +}
>
> @@ -1175,11 +1186,8 @@ static int pl330_exec_cycle(PL330Chan *channel)
> int len = q->len - (q->addr & (q->len - 1));
>
> dma_memory_read(&address_space_memory, q->addr, buf, len);
> - if (PL330_ERR_DEBUG > 1) {
> - DB_PRINT("PL330 read from memory @%08" PRIx32 " (size =
> %08x):\n",
> - q->addr, len);
> - qemu_hexdump((char *)buf, stderr, "", len);
> - }
> + trace_pl330_exec_cycle(q->addr, len);
> + pl330_hexdump(buf, len);
Won't this now do all the work of constructing the hexdump strings,
even if tracing is disabled ?
thanks
-- PMM