Grab a call stack fast

I am trying to grab a call stack as quickly as possible. Right now this is what I have:

void* addrs[10] = {};
DWORD hash;
RtlCaptureStackBackTrace(0, 10, addrs, &hash);

for( size_t i = 0; i <10; ++i )
{
    std::cout << addrs[i] << '\n';
}

This is intended for use in a memory tracking system, so it’s absolutely wonderful that in the end I get an array of addresses if they can later be turned into something human readable (with some user-controlled event).

  • How can I turn addrsinto something human readable? (see below)
  • Is there anything faster than RtlCaptureStackBackTrace?
  • Is there a cross-platform way to grab a call stack?

Edit:

, SymFromAddr SymGetLineFromAddr64. new, CaptureStackBackTrace, ~ 30 , , - . !

+5
2

- ?

, , , . -, "" ... , - EBP RBP, , 32- x86 x86_64. , , UNIX (ABI) Windows ABI, . , , :

  • 32- ABI Unix
  • Unix 64- ABI
  • 32- ABI Windows
  • Windows 64-bit ABI

, 64- ABI UNIX , -... ; . 64- ABI UNIX.

, , - -. , , . , , , , , , .

+2

- , - , . .

, , . MMgc - ( ). , .

, , , RtlCaptureStackBacktrace Windows. , - , ; , - . - - Windows API .

0

All Articles