diff options
author | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2012-09-20 21:11:21 -0700 |
---|---|---|
committer | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2012-12-18 00:31:53 -0800 |
commit | 34fb39a960898f5a0bcc67f76f385ba8a91ea2ba (patch) | |
tree | d48a7d8c4c5ea1dd8e1a6f755a718d6d8fd939f8 | |
parent | 06e2ecd0df9b81dd518ae6017ec42765520e2e93 (diff) |
XQuartz: Add some verbose logging to debug xp_lock_window being unbalanced
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit f54987de97720200ee94eba1c7a737d4ad8c55c8)
-rw-r--r-- | hw/xquartz/xpr/xprFrame.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c index 01f1def20..aad375b52 100644 --- a/hw/xquartz/xpr/xprFrame.c +++ b/hw/xquartz/xpr/xprFrame.c @@ -49,6 +49,10 @@ #include <pthread.h> #endif +#ifdef DEBUG_XP_LOCK_WINDOW +#include <execinfo.h> +#endif + #define DEFINE_ATOM_HELPER(func, atom_name) \ static Atom func(void) { \ static int generation; \ @@ -376,6 +380,18 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) unsigned int rowbytes[2]; xp_error err; +#ifdef DEBUG_XP_LOCK_WINDOW + void* callstack[128]; + int i, frames = backtrace(callstack, 128); + char** strs = backtrace_symbols(callstack, frames); + + ErrorF("=== LOCK %d ===\n", (int)x_cvt_vptr_to_uint(wid)); + for (i = 0; i < frames; ++i) { + ErrorF(" %s\n", strs[i]); + } + free(strs); +#endif + err = xp_lock_window(x_cvt_vptr_to_uint( wid), NULL, NULL, data, rowbytes, NULL); if (err != Success) @@ -395,6 +411,18 @@ xprStopDrawing(RootlessFrameID wid, Bool flush) { xp_error err; +#ifdef DEBUG_XP_LOCK_WINDOW + void* callstack[128]; + int i, frames = backtrace(callstack, 128); + char** strs = backtrace_symbols(callstack, frames); + + ErrorF("=== UNLOCK %d ===\n", (int)x_cvt_vptr_to_uint(wid)); + for (i = 0; i < frames; ++i) { + ErrorF(" %s\n", strs[i]); + } + free(strs); +#endif + err = xp_unlock_window(x_cvt_vptr_to_uint(wid), flush); /* This should be a FatalError, but we started tripping over it. Make it a * FatalError after http://xquartz.macosforge.org/trac/ticket/482 is fixed. |