Bug 696376 - Change how we find critical ranges so that it works on 10.6 too. r=dbaron.
Currently we use dlsym on pthread_cond_wait$UNIX2003 to find a function that indicates that new_sem_from_pool is on the stack. This works on 10.5, but on 10.6 I could not find a single reliable indicator that would work with dlsym. The good news is that dladdr works with any symbol, not just exported ones. To find the address of new_sem_from_pool, we set up a malloc logger and force a call to new_sem_from_pool. From the logger callback we walk the stack trying dladdr on every address. To force a call to new_sem_from_pool, the initialization code has to be the first to use semaphores, so it is now run from NS_LogInit. This works on 10.6 and 10.5 (but we have to look for "pthread_cond_wait$UNIX2003"). In 10.7 the call to malloc is gone, so we don't have to worry about critical addresses on it anymore.
This commit is contained in:
@@ -957,7 +957,7 @@ backtrace(tm_thread *t, int skip, int *immediate_abort)
|
||||
t->suppress_tracing++;
|
||||
|
||||
if (!stacks_enabled) {
|
||||
#if defined(XP_MACOSX) && defined(__i386)
|
||||
#if defined(XP_MACOSX)
|
||||
/* Walk the stack, even if stacks_enabled is false. We do this to
|
||||
check if we must set immediate_abort. */
|
||||
info->entries = 0;
|
||||
|
||||
Reference in New Issue
Block a user