mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
NO-OP: whitespace & revert samples -> [stack]frames
This commit is contained in:
parent
eeb2cddd26
commit
e4f18c1771
2 changed files with 65 additions and 67 deletions
|
|
@ -45,7 +45,7 @@ namespace PBD {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class /*LIBPBD_API*/ thing_with_backtrace
|
class /*LIBPBD_API*/ thing_with_backtrace
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
thing_with_backtrace () {
|
thing_with_backtrace () {
|
||||||
trace_twb();
|
trace_twb();
|
||||||
#ifdef HAVE_EXECINFO
|
#ifdef HAVE_EXECINFO
|
||||||
|
|
|
||||||
|
|
@ -78,47 +78,45 @@ PBD::stacktrace (std::ostream& out, int levels)
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
__declspec(dllimport) USHORT WINAPI CaptureStackBackTrace (
|
__declspec(dllimport) USHORT WINAPI CaptureStackBackTrace (
|
||||||
ULONG SamplesToSkip,
|
ULONG FramesToSkip,
|
||||||
ULONG SamplesToCapture,
|
ULONG FramesToCapture,
|
||||||
PVOID *BackTrace,
|
PVOID *BackTrace,
|
||||||
PULONG BackTraceHash
|
PULONG BackTraceHash);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
PBD::stacktrace( std::ostream& out, int)
|
PBD::stacktrace (std::ostream& out, int)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
const size_t levels = 62; // does not support more then 62 levels of stacktrace
|
const size_t levels = 62; // does not support more then 62 levels of stacktrace
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
void * stack[ levels ];
|
void * stack[ levels ];
|
||||||
unsigned short samples;
|
unsigned short frames;
|
||||||
SYMBOL_INFO * symbol;
|
SYMBOL_INFO * symbol;
|
||||||
HANDLE process;
|
HANDLE process;
|
||||||
|
|
||||||
process = GetCurrentProcess();
|
process = GetCurrentProcess();
|
||||||
out << "+++++Backtrace process: " << DEBUG_THREAD_SELF << std::endl;
|
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->MaxNameLen = 255;
|
||||||
symbol->SizeOfStruct = sizeof( SYMBOL_INFO );
|
symbol->SizeOfStruct = sizeof (SYMBOL_INFO);
|
||||||
|
|
||||||
for( i = 0; i < samples; i++ )
|
for (i = 0; i < frames; ++i) {
|
||||||
{
|
SymFromAddr (process, (DWORD64)(stack[i]), 0, symbol);
|
||||||
SymFromAddr( process, ( DWORD64 )( stack[ i ] ), 0, symbol );
|
out << string_compose ("%1: %2 - %3\n", samples - i - 1, symbol->Name, symbol->Address);
|
||||||
out << string_compose( "%1: %2 - %3\n", samples - i - 1, symbol->Name, symbol->Address );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out.flush();
|
out.flush ();
|
||||||
|
|
||||||
free( symbol );
|
free (symbol);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue