[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: better file/line info for format string errors in trace events
From: |
Stefan Hajnoczi |
Subject: |
Re: better file/line info for format string errors in trace events |
Date: |
Thu, 27 Aug 2020 11:09:46 +0100 |
On Tue, Aug 25, 2020 at 10:49:08PM +0100, Peter Maydell wrote:
> If you have a format string error in a trace event it fails
> like this:
>
> In file included from ../../hw/block/trace.h:1:0,
> from ../../hw/block/fdc.c:48:
> ./trace/trace-hw_block.h: In function '_nocheck__trace_pci_nvme_err_mdts':
> ./trace/trace-hw_block.h:2162:18: error: format '%llu' expects
> argument of type 'long long unsigned int', but argument 6 has type
> 'size_t {aka unsigned int}' [-Werror=format=]
> qemu_log("%d@%zu.%06zu:pci_nvme_err_mdts " "cid %"PRIu16" len
> %"PRIu64"" "\n",
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from /home/peter.maydell/qemu/include/qemu/osdep.h:89:0,
> from ../../hw/block/fdc.c:30:
> /usr/include/inttypes.h:105:34: note: format string is defined here
> # define PRIu64 __PRI64_PREFIX "u"
>
>
> which doesn't anywhere give the filename where the format
> string is actually defined (hw/block/trace-events in this case),
> let alone the line number in that file of the trace event.
>
> Bit of a long shot, but I don't suppose it's possible for the
> tracing subsystem to give more targeted error messages in this
> situation ?
I will send a patch to make tracetool emit #line directives:
https://gcc.gnu.org/onlinedocs/gcc-10.2.0/cpp/Line-Control.html
Stefan
signature.asc
Description: PGP signature