[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH v3 4/4] lib/ukdebug: Add thread info to debug messages
Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> On 17.03.2018 18:04, Dafna Hirschfeld wrote: Add the name of the thread to the debug messages. If the name is null or the thread was not created with uksched library, the pointer returned from uk_thread_current is printed. This will be an invalid pointer if the thread was not created with uksched library -the boot process for example. Signed-off-by: Dafna Hirschfeld <dafna3@xxxxxxxxx> --- lib/ukdebug/Config.uk | 5 +++++ lib/ukdebug/print.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/lib/ukdebug/Config.uk b/lib/ukdebug/Config.uk index d5e5cdd..2a1ea7e 100644 --- a/lib/ukdebug/Config.uk +++ b/lib/ukdebug/Config.uk @@ -44,6 +44,11 @@ config LIBUKDEBUG_PRINTD_TIME default y depends on LIBUKDEBUG_PRINTD+config LIBUKDEBUG_PRINTD_THREAD+ bool "Show name of thread in debug messages" + default y + depends on LIBUKDEBUG_PRINTD && LIBUKSCHED + choice prompt "Message redirection" default LIBUKDEBUG_NOREDIR diff --git a/lib/ukdebug/print.c b/lib/ukdebug/print.c index e5acae6..9673dc9 100644 --- a/lib/ukdebug/print.c +++ b/lib/ukdebug/print.c @@ -44,6 +44,10 @@ #include <uk/plat/console.h> #include <uk/plat/time.h> #include <uk/print.h> +#if LIBUKSCHED +#include <uk/thread.h> +#endif +#include <uk/errptr.h> #include <uk/arch/lcpu.h>/*@@ -92,6 +96,27 @@ static void _printd_timestamp(void) } #endif+#if LIBUKDEBUG_PRINTD_THREAD+static void _printd_thread(void) +{ + struct uk_thread *thread; + + thread = uk_thread_current(); + if (!PTRISERR(thread) && thread->name) { + _ukplat_coutd("<", 1); + _ukplat_coutd((char *)thread->name, + strlen(thread->name)); + _ukplat_coutd("> ", 2); + } else { + char buf[BUFLEN]; + int len; + + len = snprintf(buf, BUFLEN, "<%p> ", thread); + _ukplat_coutd((char *)buf, len); + } +} +#endif + static inline void _vprintd(int lvl, const char *libname, const char *srcname, unsigned int srcline, const char *fmt, va_list ap) { @@ -150,6 +175,9 @@ static inline void _vprintd(int lvl, const char *libname, const char *srcname, _printd_timestamp(); #endif _ukplat_coutd(DECONST(char *, msghdr), 6); +#if LIBUKDEBUG_PRINTD_THREAD + _printd_thread(); +#endif if (libname) { _ukplat_coutd("[", 1); _ukplat_coutd(DECONST(char *, libname), _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |