| 344 | } |
| 345 | |
| 346 | BX_NO_INLINE uint32_t getCallStackSystemVAbi(uint32_t _skip, uint32_t _max, uintptr_t* _outStack) |
| 347 | { |
| 348 | if (BX_ENABLED( (BX_PLATFORM_LINUX || BX_PLATFORM_OSX) && BX_ARCH_64BIT) ) |
| 349 | { |
| 350 | #if BX_COMPILER_GCC || BX_COMPILER_CLANG |
| 351 | const uintptr_t* stackFrame = (const uintptr_t*)__builtin_frame_address(0); |
| 352 | #else |
| 353 | const uintptr_t* stackFrame = NULL; |
| 354 | #endif // BX_COMPILER_... |
| 355 | |
| 356 | uint32_t num = 0; |
| 357 | |
| 358 | while (NULL != stackFrame |
| 359 | && num < _max) |
| 360 | { |
| 361 | if (uintptr_t(0) == stackFrame[1]) |
| 362 | { |
| 363 | break; |
| 364 | } |
| 365 | |
| 366 | if (BX_UNLIKELY(0 < _skip) ) |
| 367 | { |
| 368 | --_skip; |
| 369 | } |
| 370 | else |
| 371 | { |
| 372 | _outStack[num++] = stackFrame[1]; |
| 373 | } |
| 374 | |
| 375 | stackFrame = nextStackFrame(stackFrame); |
| 376 | } |
| 377 | |
| 378 | return num; |
| 379 | } |
| 380 | |
| 381 | return 0; |
| 382 | } |
| 383 | |
| 384 | BX_NO_INLINE uint32_t getCallStackGccBuiltin(uint32_t _skip, uint32_t _max, uintptr_t* _outStack) |
| 385 | { |
no test coverage detected