mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
The code in GSPrivateReturnAddresses() and the -symbols method must have ifdefs in matching order so that setup of the information from the stack matches the code used to generate the corresponding symbols.
This commit is contained in:
parent
5fb5fb46c4
commit
4e61056743
1 changed files with 22 additions and 22 deletions
|
@ -891,28 +891,7 @@ unsigned
|
|||
GSPrivateReturnAddresses(NSUInteger **returns)
|
||||
{
|
||||
unsigned numReturns;
|
||||
#if defined(HAVE_BACKTRACE)
|
||||
void *addr[MAXFRAMES*sizeof(void*)];
|
||||
|
||||
numReturns = backtrace(addr, MAXFRAMES);
|
||||
if (numReturns > 0)
|
||||
{
|
||||
*returns = malloc(numReturns * sizeof(void*));
|
||||
memcpy(*returns, addr, numReturns * sizeof(void*));
|
||||
}
|
||||
#elif defined(WITH_UNWIND)
|
||||
void *addr[MAXFRAMES];
|
||||
|
||||
struct GSBacktraceState state = {addr, addr + MAXFRAMES};
|
||||
_Unwind_Backtrace(GSUnwindCallback, &state);
|
||||
|
||||
numReturns = state.current - addr;
|
||||
if (numReturns > 0)
|
||||
{
|
||||
*returns = malloc(numReturns * sizeof(void*));
|
||||
memcpy(*returns, addr, numReturns * sizeof(void*));
|
||||
}
|
||||
#elif defined(_WIN32) && !defined(USE_BFD)
|
||||
#if defined(_WIN32) && !defined(USE_BFD)
|
||||
NSUInteger addr[MAXFRAMES];
|
||||
|
||||
(void)pthread_mutex_lock(&traceLock);
|
||||
|
@ -1004,6 +983,27 @@ GSPrivateReturnAddresses(NSUInteger **returns)
|
|||
|
||||
(void)pthread_mutex_unlock(&traceLock);
|
||||
|
||||
#elif defined(HAVE_BACKTRACE)
|
||||
void *addr[MAXFRAMES*sizeof(void*)];
|
||||
|
||||
numReturns = backtrace(addr, MAXFRAMES);
|
||||
if (numReturns > 0)
|
||||
{
|
||||
*returns = malloc(numReturns * sizeof(void*));
|
||||
memcpy(*returns, addr, numReturns * sizeof(void*));
|
||||
}
|
||||
#elif defined(WITH_UNWIND)
|
||||
void *addr[MAXFRAMES];
|
||||
|
||||
struct GSBacktraceState state = {addr, addr + MAXFRAMES};
|
||||
_Unwind_Backtrace(GSUnwindCallback, &state);
|
||||
|
||||
numReturns = state.current - addr;
|
||||
if (numReturns > 0)
|
||||
{
|
||||
*returns = malloc(numReturns * sizeof(void*));
|
||||
memcpy(*returns, addr, numReturns * sizeof(void*));
|
||||
}
|
||||
#else
|
||||
int n;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue