Mac: Fix bug in backtrace code

svn path=/trunk/boinc/; revision=20090
This commit is contained in:
Charlie Fenton 2010-01-07 11:29:48 +00:00
parent 0388c6d7e0
commit 727d356e2c
2 changed files with 11 additions and 4 deletions

View File

@ -168,3 +168,10 @@ David 6 Jan 2010
client/
boinc_cmd.cpp
Charlie 7 Jan 2010
- Mac: Fix bug in backtrace code which showed up only under OS 10.6.
lib/
mac/
mac_backtrace.C

View File

@ -178,17 +178,17 @@ void PrintBacktrace(void) {
if (f) {
setbuf(f, 0);
for (i=0; i<frames; i++) {
fprintf(f, "%#lx\n", (long)callstack[i]);
fprintf(f, "%#lx\n", (long)callstack[i]);
PersistentFGets(pipeBuf, sizeof(pipeBuf), f);
#ifdef __LP64__
fprintf(stderr, "%3d 0x%016llx %s", i, (unsigned long long)callstack[i], pipeBuf);
#else
fprintf(stderr, "%3d 0x%08lx %s", i, (unsigned long)callstack[i], pipeBuf);
#endif
}
}
pclose(f);
}
fprintf(stderr, "\n");
pclose(f);
if (env) {
setenv("NSUnbufferedIO", saved_env, 1);
@ -251,7 +251,7 @@ static void GetNameOfAndPathToThisProcess(char *nameBuf, size_t nameBufLen, char
return;
PersistentFGets(nameBuf, nameBufLen, f); // Discard header line
PersistentFGets(nameBuf, nameBufLen, f); // Get just the name of our application
fclose(f);
pclose(f);
// Remove trailing newline if present
p = strchr(nameBuf, '\n');