All of lore.kernel.org
 help / color / mirror / Atom feed
* better file/line info for format string errors in trace events
@ 2020-08-25 21:49 Peter Maydell
  2020-08-27 10:09 ` Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2020-08-25 21:49 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Stefan Hajnoczi

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 ?

thanks
-- PMM


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: better file/line info for format string errors in trace events
  2020-08-25 21:49 better file/line info for format string errors in trace events Peter Maydell
@ 2020-08-27 10:09 ` Stefan Hajnoczi
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2020-08-27 10:09 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 1386 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-27 10:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25 21:49 better file/line info for format string errors in trace events Peter Maydell
2020-08-27 10:09 ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.