Improving stack trace, fixing compile error without MPI

This commit is contained in:
Mark Berrill
2015-07-17 11:27:59 -04:00
parent a0a8b578e2
commit a8733a3ac3
7 changed files with 466 additions and 112 deletions

47
common/StackTrace.h Normal file
View File

@@ -0,0 +1,47 @@
#ifndef included_StackTrace
#define included_StackTrace
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
namespace StackTrace {
struct stack_info {
void *address;
void *address2;
std::string object;
std::string function;
std::string filename;
int line;
//! Default constructor
stack_info(): address(NULL), address2(NULL), line(0) {}
//! Print the stack info
std::string print() const;
};
//! Function to return the current call stack
std::vector<stack_info> getCallStack();
//! Function to return the stack info for a given address
stack_info getStackInfo( void* address );
/*!
* Return the symbols from the current executable (not availible for all platforms)
* @return Returns 0 if sucessful
*/
int getSymbols( std::vector<void*>& address, std::vector<char>& type, std::vector<std::string>& obj );
} // namespace StackTrace
#endif