Improving stack trace, fixing compile error without MPI
This commit is contained in:
47
common/StackTrace.h
Normal file
47
common/StackTrace.h
Normal 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
|
||||
|
||||
Reference in New Issue
Block a user