[PATCH v2] os: prettify backtrace output

Peter Hutterer peter.hutterer at who-t.net
Wed Jan 11 16:21:01 PST 2012


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 at who-t.net>
---
yeah, ok, I didn't test the first version and only noticed now that I was
missing one function.

Changes to v1:
- prettify both xorg_backtrace functions

 os/backtrace.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/os/backtrace.c b/os/backtrace.c
index 298bf18..edaeb17 100644
--- a/os/backtrace.c
+++ b/os/backtrace.c
@@ -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
-- 
1.7.7.5


More information about the xorg-devel mailing list