NO-OP: whitespace & revert samples -> [stack]frames

This commit is contained in:
Robin Gareus 2019-04-08 00:35:00 +02:00
parent eeb2cddd26
commit e4f18c1771
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 65 additions and 67 deletions

View file

@ -78,11 +78,10 @@ PBD::stacktrace (std::ostream& out, int levels)
extern "C" {
__declspec(dllimport) USHORT WINAPI CaptureStackBackTrace (
ULONG SamplesToSkip,
ULONG SamplesToCapture,
ULONG FramesToSkip,
ULONG FramesToCapture,
PVOID *BackTrace,
PULONG BackTraceHash
);
PULONG BackTraceHash);
}
#endif
@ -93,7 +92,7 @@ PBD::stacktrace( std::ostream& out, int)
const size_t levels = 62; // does not support more then 62 levels of stacktrace
unsigned int i;
void * stack[ levels ];
unsigned short samples;
unsigned short frames;
SYMBOL_INFO * symbol;
HANDLE process;
@ -102,16 +101,15 @@ PBD::stacktrace( std::ostream& out, int)
SymInitialize (process, NULL, TRUE);
samples = CaptureStackBackTrace( 0, levels, stack, NULL );
frames = CaptureStackBackTrace (0, levels, stack, NULL);
out << "+++++Backtrace samples: " << samples << std::endl;
out << "+++++Backtrace frames: " << frames << std::endl;
symbol = (SYMBOL_INFO*)calloc (sizeof (SYMBOL_INFO) + 256 * sizeof (char), 1);
symbol->MaxNameLen = 255;
symbol->SizeOfStruct = sizeof (SYMBOL_INFO);
for( i = 0; i < samples; i++ )
{
for (i = 0; i < frames; ++i) {
SymFromAddr (process, (DWORD64)(stack[i]), 0, symbol);
out << string_compose ("%1: %2 - %3\n", samples - i - 1, symbol->Name, symbol->Address);
}