mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
Fix size of buffer for backtrace
This commit is contained in:
parent
f15eb90b8a
commit
8dbb7ea40a
1 changed files with 15 additions and 10 deletions
|
@ -593,16 +593,21 @@ struct GSBacktraceState
|
||||||
static _Unwind_Reason_Code
|
static _Unwind_Reason_Code
|
||||||
GSUnwindCallback(struct _Unwind_Context* context, void* arg)
|
GSUnwindCallback(struct _Unwind_Context* context, void* arg)
|
||||||
{
|
{
|
||||||
struct GSBacktraceState *state = (struct GSBacktraceState*)arg;
|
struct GSBacktraceState *state = (struct GSBacktraceState*)arg;
|
||||||
uintptr_t pc = _Unwind_GetIP(context);
|
uintptr_t pc = _Unwind_GetIP(context);
|
||||||
if (pc) {
|
|
||||||
if (state->current == state->end) {
|
if (pc)
|
||||||
return _URC_END_OF_STACK;
|
{
|
||||||
} else {
|
if (state->current == state->end)
|
||||||
*state->current++ = (void*)pc;
|
{
|
||||||
}
|
return _URC_END_OF_STACK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*state->current++ = (void*)pc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0; //_URC_OK/_URC_NO_REASON
|
return 0; //_URC_OK/_URC_NO_REASON
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* WITH_UNWIND && !HAVE_BACKTRACE */
|
#endif /* WITH_UNWIND && !HAVE_BACKTRACE */
|
||||||
|
@ -994,7 +999,7 @@ GSPrivateReturnAddresses(NSUInteger **returns)
|
||||||
GS_MUTEX_UNLOCK(traceLock);
|
GS_MUTEX_UNLOCK(traceLock);
|
||||||
|
|
||||||
#elif defined(HAVE_BACKTRACE)
|
#elif defined(HAVE_BACKTRACE)
|
||||||
void *addr[MAXFRAMES*sizeof(NSUInteger)];
|
void *addr[MAXFRAMES];
|
||||||
|
|
||||||
numReturns = backtrace(addr, MAXFRAMES);
|
numReturns = backtrace(addr, MAXFRAMES);
|
||||||
if (numReturns > 0)
|
if (numReturns > 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue