[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 05/43] windbg: added helper features
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 05/43] windbg: added helper features |
Date: |
Tue, 26 Sep 2017 12:27:29 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 09/26/2017 12:13 PM, Alistair Francis wrote:
>> +#if (WINDBG_DEBUG_ON)
>> +
>> +# define WINDBG_DEBUG(...) do { \
>> + printf("Debug: " __VA_ARGS__); \
>> + printf("\n"); \
>> +} while (false)
>> +
>> +# define WINDBG_ERROR(...) do { \
>> + printf("Error: " __VA_ARGS__); \
>> + printf("\n"); \
>> +} while (false)
>
> Use qemu_log() instead of printf().
>
> Have a look as some other files for the usual way we handle debug printing.
>
>> +
>> +#else
>> +
>> +# define WINDBG_DEBUG(...)
>> +# define WINDBG_ERROR(...) error_report(WINDBG ": " __VA_ARGS__)
What's more - as written, your approach is prone to bit-rot: the
debug/error statements are not compared against -Werror except for the
rare person that enables debugging. Better is go make the macro
unconditionally expand to something that triggers -Wformat checking, but
guarded by an if(0) for normal use. Or even switch to trace points
rather than debugging statements, so that you can control at runtime how
much debugging information you want, rather than having to recompile to
turn it on and off.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 00/43] Windbg supporting, Mihail Abakumov, 2017/09/26
- [Qemu-devel] [PATCH 01/43] windbg: added empty windbgstub files, Mihail Abakumov, 2017/09/26
- [Qemu-devel] [PATCH 02/43] windbg: added windbg's KD header file, Mihail Abakumov, 2017/09/26
- [Qemu-devel] [PATCH 03/43] windbg: modified windbgkd.h, Mihail Abakumov, 2017/09/26
- [Qemu-devel] [PATCH 04/43] windbg: added '-windbg' option, Mihail Abakumov, 2017/09/26
- [Qemu-devel] [PATCH 05/43] windbg: added helper features, Mihail Abakumov, 2017/09/26
- [Qemu-devel] [PATCH 06/43] windbg: added WindbgState, Mihail Abakumov, 2017/09/26
- [Qemu-devel] [PATCH 07/43] windbg: added chardev, Mihail Abakumov, 2017/09/26
- [Qemu-devel] [PATCH 09/43] windbg: handler of fs/gs register, Mihail Abakumov, 2017/09/26
- [Qemu-devel] [PATCH 08/43] windbg: hook to wrmsr operation, Mihail Abakumov, 2017/09/26
- [Qemu-devel] [PATCH 10/43] windbg: structures for parsing data stream, Mihail Abakumov, 2017/09/26
- [Qemu-devel] [PATCH 12/43] windbg: send data and control packets, Mihail Abakumov, 2017/09/26
- [Qemu-devel] [PATCH 13/43] windbg: handler of parsing context, Mihail Abakumov, 2017/09/26
- [Qemu-devel] [PATCH 11/43] windbg: parsing data stream, Mihail Abakumov, 2017/09/26