Commit ed7c8838 authored by Filippos Giannakos's avatar Filippos Giannakos

xseg: Refactor xseg_backtrace output

parent 522e9e4d
......@@ -273,14 +273,24 @@ void __xseg_log2(struct log_ctx *lc, enum log_level level, char *fmt, ...)
return;
}
/* FIXME: This is not async safe */
/* TODO: Make an async-safe alternative */
void xseg_printtrace(void)
{
void *array[20];
char **bt;
size_t size;
int i;
pid_t tid = __get_id();
XSEGLOG("Backtrace:");
size = backtrace(array, 20);
/* stderr should be open since we don't close it */
backtrace_symbols_fd(array, size, 2);
bt = backtrace_symbols(array, size);
if (!bt) {
return;
}
XSEGLOG("Backtrace of tid %d:", tid);
for (i = 0; i < size; ++i)
{
XSEGLOG("\t%s", bt[i]);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment