Mac: Fix new backtrace code for x86_64 Client and project applications

svn path=/trunk/boinc/; revision=15022
This commit is contained in:
Charlie Fenton 2008-04-07 07:55:26 +00:00
parent d071562191
commit 89538db7c4
2 changed files with 20 additions and 2 deletions

View File

@ -3125,3 +3125,10 @@ David April 5 2008
parse.h
procinfo_unix.C
Charlie April 4 2008
Mac: Fix new backtrace code for x86_64 Client and project applcations.
lib/
mac/
mac_backtrace.C

View File

@ -90,7 +90,7 @@ void PrintBacktrace(void) {
QCrashReportRef crRef = NULL;
char nameBuf[256], pathToThisProcess[1024], pipeBuf[1024];
int pathLen;
const NXArchInfo *localArch;
char OSMinorVersion;
time_t t;
@ -167,9 +167,20 @@ void PrintBacktrace(void) {
}
setenv("NSUnbufferedIO", "YES", 1);
// pathLen = readlink(pathToThisProcess, pathToThisProcess, sizeof(pathToThisProcess));
// if (pathLen >= 0) { // readlink() returns -1 if not a aymbolic link
// pathToThisProcess[pathLen] = '\0';
// }
// For some reason, using the -p option with the value from getpid()
// fails here but the -o option with a path does work.
snprintf(pipeBuf, sizeof(pipeBuf), "/usr/bin/atos -o %s", pathToThisProcess);
#ifdef __x86_64__
snprintf(pipeBuf, sizeof(pipeBuf), "/usr/bin/atos -o \"%s\" -arch x86_64", pathToThisProcess);
#elif defined (__i386__)
snprintf(pipeBuf, sizeof(pipeBuf), "/usr/bin/atos -o \"%s\" -arch i386", pathToThisProcess);
#else
snprintf(pipeBuf, sizeof(pipeBuf), "/usr/bin/atos -o \"%s\" -arch ppc", pathToThisProcess);
#endif
f = popen(pipeBuf, "r+");
if (f) {
setbuf(f, 0);