qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/6] dma/pl330: Convert to support tracing


From: Guenter Roeck
Subject: Re: [PATCH 1/6] dma/pl330: Convert to support tracing
Date: Fri, 17 Jan 2020 08:46:25 -0800
User-agent: Mutt/1.9.4 (2018-02-28)

On Fri, Jan 17, 2020 at 01:23:46PM +0000, Peter Maydell wrote:
> On Fri, 10 Jan 2020 at 20:39, Guenter Roeck <address@hidden> wrote:
> >
> > Replace debug logging code with tracing.
> >
> > Signed-off-by: Guenter Roeck <address@hidden>
> > ---
> >  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 ?
> 
That is correct. Can I check
        if (trace_event_get_state(TRACE_PL330_HEXDUMP) &&
            qemu_loglevel_mask(LOG_TRACE)) {
directly in pl330_hexdump(), or is there some other means to handle
this kind of situation ?

Thanks,
Guenter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]