[Xquartz-changes] xserver: Branch 'master'
Jeremy Huddleston
jeremyhu at freedesktop.org
Sat Mar 27 18:51:30 PDT 2010
Rebased ref, commits from common ancestor:
commit f23d66e30ae617fc80fe89bab9f4bb623053a328
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Mar 27 17:35:10 2010 -0700
darwin: Generate crash reports on FatalError()
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/GL/capabilities.c b/hw/xquartz/GL/capabilities.c
index 2c5ec65..fc7dd57 100644
--- a/hw/xquartz/GL/capabilities.c
+++ b/hw/xquartz/GL/capabilities.c
@@ -525,8 +525,7 @@ bool getGlCapabilities(struct glCapabilities *cap) {
conf = malloc(sizeof(*conf));
if(NULL == conf) {
- perror("malloc");
- OsAbort();
+ FatalError("Unable to allocate memory for OpenGL capabilities\n");
}
/* Copy the struct. */
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 066f5a5..d3f4488 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -602,7 +602,7 @@ void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv )
/*
- * OsVendorFataError
+ * OsVendorFatalError
*/
void OsVendorFatalError( void )
{
@@ -760,7 +760,7 @@ void ddxUseMsg( void )
*/
void ddxGiveUp( void )
{
- ErrorF( "Quitting Xquartz...\n" );
+ ErrorF( "Quitting Xquartz\n" );
}
@@ -773,11 +773,7 @@ void ddxGiveUp( void )
void AbortDDX( void )
{
ErrorF( " AbortDDX\n" );
- /*
- * This is needed for a abnormal server exit, since the normal exit stuff
- * MUST also be performed (i.e. the vt must be left in a defined state)
- */
- ddxGiveUp();
+ OsAbort();
}
#include "mivalidate.h" // for union _Validate used by windowstr.h
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 4872ff5..625b8b4 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -73,10 +73,11 @@ extern int noPanoramiXExtension;
#define XSERVER_VERSION "?"
#endif
-const int __crashreporter_info__len = 4096;
-const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION " Build Date: " BUILD_DATE;
-char __crashreporter_info__buf[4096];
-char *__crashreporter_info__ = __crashreporter_info__buf;
+static char __crashreporter_info_buff__[4096] = {0};
+static const char *__crashreporter_info__ = &__crashreporter_info_buff__[0];
+asm (".desc __crashreporter_info__, 0x10");
+
+static const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION " Build Date: " BUILD_DATE;
static char *launchd_id_prefix = NULL;
static char *server_bootstrap_name = NULL;
@@ -548,7 +549,7 @@ int main(int argc, char **argv, char **envp) {
noPanoramiXExtension = TRUE;
/* Setup the initial crasherporter info */
- strlcpy(__crashreporter_info__, __crashreporter_info__base, __crashreporter_info__len);
+ strlcpy(__crashreporter_info_buff__, __crashreporter_info__base, sizeof(__crashreporter_info_buff__));
fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
for(i=0; i < argc; i++) {
diff --git a/os/log.c b/os/log.c
index f4832c1..c1301d7 100644
--- a/os/log.c
+++ b/os/log.c
@@ -117,6 +117,12 @@ static char *saveBuffer = NULL;
static int bufferSize = 0, bufferUnused = 0, bufferPos = 0;
static Bool needBuffer = TRUE;
+#ifdef __APPLE__
+static char __crashreporter_info_buff__[4096] = {0};
+static const char *__crashreporter_info__ = &__crashreporter_info_buff__[0];
+asm (".desc __crashreporter_info__, 0x10");
+#endif
+
/* Prefix strings for log messages. */
#ifndef X_UNKNOWN_STRING
#define X_UNKNOWN_STRING "(\?\?)"
@@ -527,6 +533,9 @@ FatalError(const char *f, ...)
ErrorF("\nFatal server error:\n");
va_start(args, f);
+#ifdef __APPLE__
+ (void)vsnprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__), f, args);
+#endif
VErrorF(f, args);
va_end(args);
ErrorF("\n");
diff --git a/os/utils.c b/os/utils.c
index 5a5a203..13d3b3f 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1315,7 +1315,9 @@ OsReleaseSignals (void)
void
OsAbort (void)
{
+#ifndef __APPLE__
OsBlockSignals();
+#endif
abort();
}
More information about the Xquartz-changes
mailing list