diff options
author | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2014-05-24 14:13:33 -0700 |
---|---|---|
committer | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2014-05-24 20:41:35 -0700 |
commit | 9eb1d36c978a9b15ae2e999c630492dfffd7f165 (patch) | |
tree | 9bff570350e964d57eb579550dcf23b7bf4d75c6 | |
parent | 404387ecd72a4a9ace8c1fa6895823aabfd759ad (diff) | |
download | external_mesa3d-9eb1d36c978a9b15ae2e999c630492dfffd7f165.zip external_mesa3d-9eb1d36c978a9b15ae2e999c630492dfffd7f165.tar.gz external_mesa3d-9eb1d36c978a9b15ae2e999c630492dfffd7f165.tar.bz2 |
darwin: Write errors in choosing the pixel format to the crash log
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-rw-r--r-- | src/glx/apple/apple_visual.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c index c6ede51..951b213 100644 --- a/src/glx/apple/apple_visual.c +++ b/src/glx/apple/apple_visual.c @@ -63,6 +63,16 @@ enum MAX_ATTR = 60 }; +static char __crashreporter_info_buff__[4096] = { 0 }; +static const char *__crashreporter_info__ __attribute__((__used__)) = + &__crashreporter_info_buff__[0]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 +// This is actually a toolchain requirement, but I'm not sure the correct check, +// but it should be fine to just only include it for Leopard and later. This line +// just tells the linker to never strip this symbol (such as for space optimization) +__asm__ (".desc ___crashreporter_info__, 0x10"); +#endif + void apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * mode, bool * double_buffered, bool * uses_stereo, @@ -164,12 +174,16 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref); if (error) { - fprintf(stderr, "error: %s\n", apple_cgl.error_string(error)); + snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__), + "CGLChoosePixelFormat error: %s\n", apple_cgl.error_string(error)); + fprintf(stderr, "%s", __crashreporter_info_buff__); abort(); } if (!*pfobj) { - fprintf(stderr, "No matching pixelformats found, perhaps try using LIBGL_ALLOW_SOFTWARE\n"); + snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__), + "No matching pixelformats found, perhaps try using LIBGL_ALLOW_SOFTWARE\n"); + fprintf(stderr, "%s", __crashreporter_info_buff__); abort(); } } |