os: prettify backtrace output

Changes to output:
* "Backtrace:" now appears on a separate line _with_ a timestamp
* A blank line is inserted after the last backtrace line

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:
Peter Hutterer 2012-01-11 09:04:02 +10:00
parent c495a839ac
commit a60d87ffe6

View File

@ -43,7 +43,8 @@ void xorg_backtrace(void)
const char *mod;
int size, i;
Dl_info info;
ErrorF("\nBacktrace:\n");
ErrorF("\n");
ErrorF("Backtrace:\n");
size = backtrace(array, 64);
for (i = 0; i < size; i++) {
int rc = dladdr(array[i], &info);
@ -59,6 +60,7 @@ void xorg_backtrace(void)
ErrorF("%d: %s (%p+0x%lx) [%p]\n", i, mod,
info.dli_fbase, (long unsigned int)((char *) array[i] - (char *) info.dli_fbase), array[i]);
}
ErrorF("\n");
}
#else /* not glibc or glibc < 2.1 */
@ -188,7 +190,8 @@ static int xorg_backtrace_pstack(void) {
void xorg_backtrace(void) {
ErrorF("\nBacktrace:\n");
ErrorF("\n");
ErrorF("Backtrace:\n");
# ifdef HAVE_PSTACK
/* First try fork/exec of pstack - otherwise fall back to walkcontext
@ -207,6 +210,7 @@ void xorg_backtrace(void) {
# endif
ErrorF("Failed to get backtrace info: %s\n", strerror(errno));
}
ErrorF("\n");
}
# else