mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
lx_emul: function to generate trace messages
lx_emul_trace_msg() uses Genode::trace() as message function for lightweight trace points, but also supports Linux format-string attributes by using vsnprintf().
This commit is contained in:
parent
66286d6f17
commit
38d2b8d46a
@ -23,6 +23,8 @@ __attribute__((noreturn)) void lx_emul_trace_and_stop(const char * func);
|
||||
|
||||
void lx_emul_trace(const char * func);
|
||||
|
||||
__attribute__((__format__(printf, 1, 2))) void lx_emul_trace_msg(char const *fmt, ...);
|
||||
|
||||
void lx_emul_backtrace(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -29,7 +29,7 @@ extern "C" void lx_emul_trace_and_stop(const char * func)
|
||||
}
|
||||
|
||||
|
||||
extern "C" void lx_emul_trace(const char *) {}
|
||||
extern "C" void lx_emul_trace(const char *s) { trace(s); }
|
||||
|
||||
|
||||
extern "C" void lx_emul_backtrace()
|
||||
|
@ -56,3 +56,13 @@ asmlinkage int vprintk_emit(int facility, int level,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void lx_emul_trace_msg(char const *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(print_string, sizeof(print_string), fmt, args);
|
||||
va_end(args);
|
||||
|
||||
lx_emul_trace(print_string);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user