[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH] lib/ukdebug: print DLVL_EXTRA messages only in debug build
Hey Yuri,in general this is a feasible solution to enable selective debug messages, although I dislike the fact that it requires to manually modify the Makefiles.uk. But maybe we could add later a debug option into each libraries menu so that their Makefile.uk's set -D__UK_DEBUG__ by themselves. This way libraries could provide a menu option to enable/disable debugging. Having this in mind I would change the behavior of this patch. I would actually add a bool option in ukdebug if debug messages should be on globally (default) or selective only. I would make this option independent of the chosen debug-verbosity-level. I think it is still a valuable option to select the verbosity-level even if you enable debug message printing only for a subset of libraries or objects. This would even enable that libraries would not compile in the call to uk_printd() if they were unselected and global debugging is off. What do you think? On 18.07.2018 23:23, Yuri Volchkov wrote: At this point enabling LIBUKDEBUG_PRINTD_EXTRA does not help. You will be drowned with the output. Basically this became a real debug-level of message explicitness. So let's use it for debug purposes. With this patch, messages of DLVL_EXTRA will be printed ONLY if UK_DEBUG is defined. Now a developer can chose for which parts of Unikraft he wants an extra verbosity of the output, by adding a single line into the Makefile.uk. For example: /* Enable for one lib */ LIBNAME_CFLAGS-y += -DUK_DEBUG /* Enable globally in Unikraft (brace yourself) */ CFLAGS-y += -DUK_DEBUG Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx> --- lib/ukdebug/Config.uk | 2 +- lib/ukdebug/include/uk/hexdump.h | 2 +- lib/ukdebug/include/uk/print.h | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/ukdebug/Config.uk b/lib/ukdebug/Config.uk index dcaeb3a..ff6279c 100644 --- a/lib/ukdebug/Config.uk +++ b/lib/ukdebug/Config.uk @@ -24,7 +24,7 @@ choice Set the level of detail of debug messagesconfig LIBUKDEBUG_PRINTD_EXTRA- bool "Show all types of debug messages" + bool "Same as info + debug level messages (UK_DEBUG needs to be defined)"config LIBUKDEBUG_PRINTD_INFObool "Show critical, error, warning, and information messages" diff --git a/lib/ukdebug/include/uk/hexdump.h b/lib/ukdebug/include/uk/hexdump.h index 4d32647..927769d 100644 --- a/lib/ukdebug/include/uk/hexdump.h +++ b/lib/ukdebug/include/uk/hexdump.h @@ -92,7 +92,7 @@ void _uk_hexdumpd(int lvl, const char *libname, const char *srcname, */ #define uk_hexdumpd(lvl, data, len, flags, grps_per_line) \ do { \ - if ((lvl) <= DLVL_MAX) \ + if (__ukdebug_is_printable_lvl(lvl)) \ _uk_hexdumpd((lvl), __STR_LIBNAME__, __STR_BASENAME__, \ __LINE__, (data), (len), \ ((size_t)(data)), (flags), \ diff --git a/lib/ukdebug/include/uk/print.h b/lib/ukdebug/include/uk/print.h index c5c5557..61e6bf6 100644 --- a/lib/ukdebug/include/uk/print.h +++ b/lib/ukdebug/include/uk/print.h @@ -120,16 +120,28 @@ void _uk_printd(int lvl, const char *libname, const char *srcname, #define __STR_BASENAME__ (NULL) #endif+#ifdef UK_DEBUG+#define __uk_is_debug_lvl(lvl) (lvl <= DLVL_EXTRA) +#else +#define __uk_is_debug_lvl(lvl) (0) +#endif + +#if defined(UK_DEBUG) && DLVL_MAX == DLVL_EXTRA +#define __ukdebug_is_printable_lvl(lvl) (lvl <= DLVL_MAX) +#else +#define __ukdebug_is_printable_lvl(lvl) (lvl <= MIN(DLVL_MAX, DLVL_INFO)) +#endif + #define uk_vprintd(lvl, fmt, ap) \ do { \ - if ((lvl) <= DLVL_MAX) \ + if (__ukdebug_is_printable_lvl(lvl)) \ _uk_vprintd((lvl), __STR_LIBNAME__, __STR_BASENAME__, \ __LINE__, (fmt), ap); \ } while (0)#define uk_printd(lvl, fmt, ...) \do { \ - if ((lvl) <= DLVL_MAX) \ + if (__ukdebug_is_printable_lvl(lvl)) \ _uk_printd((lvl), __STR_LIBNAME__, __STR_BASENAME__, \ __LINE__, (fmt), ##__VA_ARGS__); \ } while (0) _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |