summaryrefslogtreecommitdiff
path: root/libs/pbd/stacktrace.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-04-08 00:35:00 +0200
committerRobin Gareus <robin@gareus.org>2019-04-08 00:35:00 +0200
commite4f18c177161466d28e357bcfc5ad946c6f7634a (patch)
treeaf8872caca55e7c4941fc2533c9a7f08673b5175 /libs/pbd/stacktrace.cc
parenteeb2cddd26c67f31318db23cced30aa6c6340e67 (diff)
NO-OP: whitespace & revert samples -> [stack]frames
Diffstat (limited to 'libs/pbd/stacktrace.cc')
-rw-r--r--libs/pbd/stacktrace.cc36
1 files changed, 17 insertions, 19 deletions
diff --git a/libs/pbd/stacktrace.cc b/libs/pbd/stacktrace.cc
index 3b308f7db2..a1af1585dd 100644
--- a/libs/pbd/stacktrace.cc
+++ b/libs/pbd/stacktrace.cc
@@ -77,48 +77,46 @@ PBD::stacktrace (std::ostream& out, int levels)
#define CaptureStackBackTrace RtlCaptureStackBackTrace
extern "C" {
- __declspec(dllimport) USHORT WINAPI CaptureStackBackTrace (
- ULONG SamplesToSkip,
- ULONG SamplesToCapture,
- PVOID *BackTrace,
- PULONG BackTraceHash
- );
+ __declspec(dllimport) USHORT WINAPI CaptureStackBackTrace (
+ ULONG FramesToSkip,
+ ULONG FramesToCapture,
+ PVOID *BackTrace,
+ PULONG BackTraceHash);
}
#endif
void
-PBD::stacktrace( std::ostream& out, int)
+PBD::stacktrace (std::ostream& out, int)
{
#ifdef DEBUG
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;
process = GetCurrentProcess();
out << "+++++Backtrace process: " << DEBUG_THREAD_SELF << std::endl;
- SymInitialize( process, NULL, TRUE );
+ 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 = (SYMBOL_INFO*)calloc (sizeof (SYMBOL_INFO) + 256 * sizeof (char), 1);
symbol->MaxNameLen = 255;
- symbol->SizeOfStruct = sizeof( SYMBOL_INFO );
+ symbol->SizeOfStruct = sizeof (SYMBOL_INFO);
- for( i = 0; i < samples; i++ )
- {
- SymFromAddr( process, ( DWORD64 )( stack[ i ] ), 0, symbol );
- out << string_compose( "%1: %2 - %3\n", samples - i - 1, symbol->Name, symbol->Address );
+ 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);
}
- out.flush();
+ out.flush ();
- free( symbol );
+ free (symbol);
#endif
}