mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-24 15:56:41 +00:00
Print pthread stub messages to Genode log console
With this patch, the 'not implemented' messages of the pthread function stubs always get printed to the Genode log console instead of stdout. Issue #815.
This commit is contained in:
parent
9b6d37649b
commit
adf895acad
@ -8,6 +8,9 @@ SRC_C = $(filter-out $(FILTER_OUT_C),$(notdir $(wildcard $(LIBC_GEN_DIR)/*.c)))
|
|||||||
# 'sysconf.c' includes the local 'stdtime/tzfile.h'
|
# 'sysconf.c' includes the local 'stdtime/tzfile.h'
|
||||||
INC_DIR += $(REP_DIR)/src/lib/libc/stdtime
|
INC_DIR += $(REP_DIR)/src/lib/libc/stdtime
|
||||||
|
|
||||||
|
# '_pthread_stubs.c' includes the local 'libc_pdbg.h'
|
||||||
|
INC_DIR += $(REP_DIR)/src/lib/libc
|
||||||
|
|
||||||
include $(REP_DIR)/lib/mk/libc-common.inc
|
include $(REP_DIR)/lib/mk/libc-common.inc
|
||||||
|
|
||||||
vpath %.c $(LIBC_GEN_DIR)
|
vpath %.c $(LIBC_GEN_DIR)
|
||||||
|
@ -13,7 +13,8 @@ SRC_CC = atexit.cc dummies.cc rlimit.cc sysctl.cc \
|
|||||||
issetugid.cc errno.cc gai_strerror.cc clock_gettime.cc \
|
issetugid.cc errno.cc gai_strerror.cc clock_gettime.cc \
|
||||||
gettimeofday.cc malloc.cc progname.cc fd_alloc.cc file_operations.cc \
|
gettimeofday.cc malloc.cc progname.cc fd_alloc.cc file_operations.cc \
|
||||||
plugin.cc plugin_registry.cc select.cc exit.cc environ.cc nanosleep.cc \
|
plugin.cc plugin_registry.cc select.cc exit.cc environ.cc nanosleep.cc \
|
||||||
libc_mem_alloc.cc pread_pwrite.cc readv_writev.cc poll.cc
|
libc_mem_alloc.cc pread_pwrite.cc readv_writev.cc poll.cc \
|
||||||
|
libc_pdbg.cc
|
||||||
|
|
||||||
#
|
#
|
||||||
# Files from string library that are not included in libc-raw_string because
|
# Files from string library that are not included in libc-raw_string because
|
||||||
|
22
libports/src/lib/libc/libc_pdbg.cc
Normal file
22
libports/src/lib/libc/libc_pdbg.cc
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* \brief C implementation of 'Genode::printf()'
|
||||||
|
* \author Christian Prochaska
|
||||||
|
* \date 2013-07-29
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2013 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
|
* under the terms of the GNU General Public License version 2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <base/printf.h>
|
||||||
|
|
||||||
|
extern "C" void genode_printf(const char *format, ...)
|
||||||
|
{
|
||||||
|
va_list list;
|
||||||
|
va_start(list, format);
|
||||||
|
Genode::vprintf(format, list);
|
||||||
|
va_end(list);
|
||||||
|
}
|
39
libports/src/lib/libc/libc_pdbg.h
Normal file
39
libports/src/lib/libc/libc_pdbg.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* \brief 'PDBG()' implementation for use in '.c' files
|
||||||
|
* \author Christian Prochaska
|
||||||
|
* \date 2013-07-29
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2013 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
|
* under the terms of the GNU General Public License version 2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _LIBC_PDBG_H_
|
||||||
|
#define _LIBC_PDBG_H_
|
||||||
|
|
||||||
|
extern void genode_printf(const char *format, ...) __attribute__((format(printf, 1, 2)));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Suppress debug messages in release version
|
||||||
|
*/
|
||||||
|
#ifdef GENODE_RELEASE
|
||||||
|
#define DO_PDBG 0
|
||||||
|
#else
|
||||||
|
#define DO_PDBG 1
|
||||||
|
#endif /* GENODE_RELEASE */
|
||||||
|
|
||||||
|
#define ESC_DBG "\033[33m"
|
||||||
|
#define ESC_END "\033[0m"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print debug message with function name
|
||||||
|
*/
|
||||||
|
#define PDBG(fmt, ...) \
|
||||||
|
if (DO_PDBG) {\
|
||||||
|
genode_printf("%s: " ESC_DBG fmt ESC_END "\n", \
|
||||||
|
__PRETTY_FUNCTION__, ##__VA_ARGS__ ); }
|
||||||
|
|
||||||
|
#endif /* _LIBC_DEBUG_H_ */
|
@ -4,45 +4,23 @@ From: Christian Prochaska <christian.prochaska@genode-labs.com>
|
|||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
libc/gen/_pthread_stubs.c | 29 +++++++++++++++++++++++++++++
|
libc/gen/_pthread_stubs.c | 10 ++++++++++
|
||||||
1 file changed, 29 insertions(+)
|
1 file changed, 10 insertions(+)
|
||||||
|
|
||||||
diff --git a/libc/gen/_pthread_stubs.c b/libc/gen/_pthread_stubs.c
|
diff --git a/libc/gen/_pthread_stubs.c b/libc/gen/_pthread_stubs.c
|
||||||
index 063676f..c5112c5 100644
|
index 063676f..5a79231 100644
|
||||||
--- libc/gen/_pthread_stubs.c
|
--- libc/gen/_pthread_stubs.c
|
||||||
+++ libc/gen/_pthread_stubs.c
|
+++ libc/gen/_pthread_stubs.c
|
||||||
@@ -30,9 +30,30 @@ __FBSDID("$FreeBSD$");
|
@@ -33,6 +33,8 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <signal.h>
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
+#include <stdio.h>
|
|
||||||
|
|
||||||
#include "libc_private.h"
|
#include "libc_private.h"
|
||||||
|
|
||||||
+#define ESC_DBG "\033[33m"
|
+#include <libc_pdbg.h>
|
||||||
+#define ESC_END "\033[0m"
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Suppress debug messages in release version
|
|
||||||
+ */
|
|
||||||
+#ifdef GENODE_RELEASE
|
|
||||||
+#define DO_PDBG 0
|
|
||||||
+#else
|
|
||||||
+#define DO_PDBG 1
|
|
||||||
+#endif /* GENODE_RELEASE */
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Print debug message with function name
|
|
||||||
+ */
|
|
||||||
+#define PDBG(fmt, ...) \
|
|
||||||
+ if (DO_PDBG) \
|
|
||||||
+ printf("%s: " ESC_DBG fmt ESC_END "\n", \
|
|
||||||
+ __PRETTY_FUNCTION__, ##__VA_ARGS__ )
|
|
||||||
+
|
+
|
||||||
/*
|
/*
|
||||||
* Weak symbols: All libc internal usage of these functions should
|
* Weak symbols: All libc internal usage of these functions should
|
||||||
* use the weak symbol versions (_pthread_XXX). If libpthread is
|
* use the weak symbol versions (_pthread_XXX). If libpthread is
|
||||||
@@ -138,12 +159,14 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = {
|
@@ -138,12 +140,14 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = {
|
||||||
typedef ret (*FUNC_TYPE(name))(void); \
|
typedef ret (*FUNC_TYPE(name))(void); \
|
||||||
static ret FUNC_EXP(name)(void) \
|
static ret FUNC_EXP(name)(void) \
|
||||||
{ \
|
{ \
|
||||||
@ -57,7 +35,7 @@ index 063676f..c5112c5 100644
|
|||||||
FUNC_TYPE(name) func; \
|
FUNC_TYPE(name) func; \
|
||||||
func = (FUNC_TYPE(name))__thr_jtable[idx][1]; \
|
func = (FUNC_TYPE(name))__thr_jtable[idx][1]; \
|
||||||
return (func()); \
|
return (func()); \
|
||||||
@@ -157,12 +180,14 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = {
|
@@ -157,12 +161,14 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = {
|
||||||
typedef ret (*FUNC_TYPE(name))(p0_type); \
|
typedef ret (*FUNC_TYPE(name))(p0_type); \
|
||||||
static ret FUNC_EXP(name)(p0_type p0) \
|
static ret FUNC_EXP(name)(p0_type p0) \
|
||||||
{ \
|
{ \
|
||||||
@ -72,7 +50,7 @@ index 063676f..c5112c5 100644
|
|||||||
FUNC_TYPE(name) func; \
|
FUNC_TYPE(name) func; \
|
||||||
func = (FUNC_TYPE(name))__thr_jtable[idx][1]; \
|
func = (FUNC_TYPE(name))__thr_jtable[idx][1]; \
|
||||||
return (func(p0)); \
|
return (func(p0)); \
|
||||||
@@ -176,12 +201,14 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = {
|
@@ -176,12 +182,14 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = {
|
||||||
typedef ret (*FUNC_TYPE(name))(p0_type, p1_type); \
|
typedef ret (*FUNC_TYPE(name))(p0_type, p1_type); \
|
||||||
static ret FUNC_EXP(name)(p0_type p0, p1_type p1) \
|
static ret FUNC_EXP(name)(p0_type p0, p1_type p1) \
|
||||||
{ \
|
{ \
|
||||||
@ -87,7 +65,7 @@ index 063676f..c5112c5 100644
|
|||||||
FUNC_TYPE(name) func; \
|
FUNC_TYPE(name) func; \
|
||||||
func = (FUNC_TYPE(name))__thr_jtable[idx][1]; \
|
func = (FUNC_TYPE(name))__thr_jtable[idx][1]; \
|
||||||
return (func(p0, p1)); \
|
return (func(p0, p1)); \
|
||||||
@@ -195,12 +222,14 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = {
|
@@ -195,12 +203,14 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = {
|
||||||
typedef ret (*FUNC_TYPE(name))(p0_type, p1_type, p2_type); \
|
typedef ret (*FUNC_TYPE(name))(p0_type, p1_type, p2_type); \
|
||||||
static ret FUNC_EXP(name)(p0_type p0, p1_type p1, p2_type p2) \
|
static ret FUNC_EXP(name)(p0_type p0, p1_type p1, p2_type p2) \
|
||||||
{ \
|
{ \
|
||||||
|
Loading…
Reference in New Issue
Block a user