forked from speed-dreams/speed-dreams-code
Added a way to get return address with gcc
But WIN32 should be replaced by a definition of the compiler!!! not the OS (Windows with mingw!). #if defined(WIN32) // Has to be replaced by a definition of VC++ versus gcc void* RetAddr = _ReturnAddress(); // VC++ #else void* RetAddr = __builtin_return_address (0); // gcc #endif git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5830 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: a7946fbc9317a21de01819886634a836fbe7f400 Former-commit-id: eb5d67dbcea2d07eb0d4ba94e0895715e6e45b9a
This commit is contained in:
parent
5c7340a953
commit
47b20ed0a9
1 changed files with 6 additions and 6 deletions
|
@ -49,10 +49,10 @@ static unsigned int GfMM_Counter = 0; // Counter of memory blocks
|
|||
//
|
||||
void* operator new (size_t size)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
void* RetAddr = _ReturnAddress();
|
||||
#if defined(WIN32) // Has to be replaced by a definition of VC++ versus gcc
|
||||
void* RetAddr = _ReturnAddress(); // VC++
|
||||
#else
|
||||
void* RetAddr = _ReturnAddress();
|
||||
void* RetAddr = __builtin_return_address (0); // gcc
|
||||
#endif
|
||||
return GfMemoryManagerAlloc(size, GF_MM_ALLOCTYPE_NEW,RetAddr);
|
||||
}
|
||||
|
@ -74,10 +74,10 @@ void operator delete (void *b)
|
|||
|
||||
void * _tgf_win_malloc(size_t size)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
void* RetAddr = _ReturnAddress();
|
||||
#if defined(WIN32) // Has to be replaced by a definition of VC++ versus gcc
|
||||
void* RetAddr = _ReturnAddress(); // VC++
|
||||
#else
|
||||
void* RetAddr = _ReturnAddress();
|
||||
void* RetAddr = __builtin_return_address (0); // gcc
|
||||
#endif
|
||||
return GfMemoryManagerAlloc(size, GF_MM_ALLOCTYPE_MALLOC,RetAddr);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue