From 2201bfec303f19c01a5cdfc76ab7e1186945062d Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Wed, 20 Oct 2010 03:11:45 +0000 Subject: [PATCH] lib: Display message if attempting backtrace on a PowerPC Mac running under OS 10.5.x svn path=/trunk/boinc/; revision=22559 --- checkin_notes | 9 +++++++++ lib/mac/mac_backtrace.cpp | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/checkin_notes b/checkin_notes index 788b11af5c..df033cfb05 100644 --- a/checkin_notes +++ b/checkin_notes @@ -7519,3 +7519,12 @@ Rom 19 Oct 2010 clientgui/ AdvancedFrame.cpp NoticeListCtrl.cpp + +Charlie 16 Oct 2010 + - lib: Mac backtrace code (including the backtrace() API) doesn't work + on PowerPC Macs running under OS 10.5.x, so display explanatory text + when attempting a backtrace on those machines. + + lib/ + mac/ + mac_backtrace.cpp diff --git a/lib/mac/mac_backtrace.cpp b/lib/mac/mac_backtrace.cpp index 5cd22665ba..ab2a3f62b6 100644 --- a/lib/mac/mac_backtrace.cpp +++ b/lib/mac/mac_backtrace.cpp @@ -47,6 +47,10 @@ // The old way still seems to work better under OS 10.6.4 #define USE_NEW_ROUTINES false +#ifdef __ppc__ +#include +#endif + #include #include #include @@ -154,7 +158,16 @@ void PrintBacktrace(void) { fputs(asctime(localtime(&t)), stderr); fputc('\n', stderr); - err = QCRCreateFromSelf(&crRef); +#ifdef __ppc__ + long OSVersion = 0; + OSStatus gestaltErr = Gestalt(gestaltSystemVersion, &OSVersion); + if ((gestaltErr == noErr) && ((OSVersion & 0xfff0) == 0x1050)) { + fputs("BOINC backtrace is not supported for PowerPC under OS 10.5.x\n", stderr); + fputs("To get a backtrace run under OS 10.4.x or run on an Intel Mac\n\n", stderr); + } +#endif + + err = QCRCreateFromSelf(&crRef); #if USE_NEW_ROUTINES // Use new backtrace functions if available (only in OS 10.5 and later)