47 #ifndef _MIRA_CALLSTACK_H_ 48 #define _MIRA_CALLSTACK_H_ 59 #include <boost/shared_array.hpp> 79 CallStack(
void** stack, std::size_t stackSize, std::size_t stackStart) :
80 mStack(stack), mStackSize(stackSize),
81 mStackStart(stackStart) {}
90 mStack(other.mStack), mStackSize(other.mStackSize),
91 mStackStart(other.mStackStart), mSymbols(other.mSymbols) {}
96 template<
typename Reflector>
101 r.property(
"stacksize", mStackSize,
"");
102 r.property(
"stackstart", mStackStart,
"");
103 r.property(
"symbols",
104 getter(&CallStack::getSymbols,
this),
105 setter(&CallStack::setSymbols,
this),
121 template<
typename Reflector>
124 r.property(
"address",
address,
"");
126 r.property(
"offset",
offset,
"");
127 r.property(
"name",
name,
"");
129 r.property(
"file",
file,
"");
166 std::size_t
size()
const {
return mStackSize-mStackStart; }
180 void obtainSymbols()
const;
182 const std::vector<Symbol>& getSymbols();
183 void setSymbols(
const std::vector<Symbol>& symbols);
186 boost::shared_array<void*> mStack;
188 std::size_t mStackSize;
189 std::size_t mStackStart;
191 mutable std::vector<Symbol> mSymbols;
int64 offset
The corresponding offset.
Definition: CallStack.h:137
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
Setter< T > setter(void(*f)(const T &))
Creates a Setter for global or static class methods taking the argument by const reference.
Definition: GetterSetter.h:443
const CallStack & operator=(const CallStack &other)
Assignment operator with similar behaviour as copy-constructor.
const Symbol & operator[](std::size_t i) const
Returns the i-th symbol of the call stack.
CallStack(void **stack, std::size_t stackSize, std::size_t stackStart)
Constructor for internal use only.
Definition: CallStack.h:79
friend std::ostream & operator<<(std::ostream &os, const Symbol &s)
Prints the symbol in the similar format as the GDB shows function symbols into the stream...
std::size_t size() const
Returns the size of the call stack.
Definition: CallStack.h:166
friend std::ostream & operator<<(std::ostream &os, const CallStack &stack)
Prints the whole stack into a stream in a similar format as the GDB.
CallStack(const CallStack &other)
Copy-Constructor.
Definition: CallStack.h:89
std::string sourceLocation() const
Tries to obtain the source file name and line number for the given symbol using the debug information...
Getter< T > getter(T(*f)())
Creates a Getter for global or static class methods returning the result by value.
Definition: GetterSetter.h:136
void reflect(Reflector &r)
Definition: CallStack.h:97
Encapsulates unix call stack functionality.
Definition: CallStack.h:75
std::string name
The mangled name of the function.
Definition: CallStack.h:139
std::string addressStr
The address of the code portion in a "human readable" format.
Definition: CallStack.h:135
std::string nameDemangled
The demangled name of the function (on Linux only available, if CALLSTACK_LINUX_USE_DEMANGLE is defin...
Definition: CallStack.h:142
Symbol()
Definition: CallStack.h:117
static CallStack backtrace(std::size_t maxSize=10, std::size_t stackStart=1)
Creates the call stack object that contains the callstack starting at the current address of the inst...
int64 address
The address of the code portion as a 64 bit integer.
Definition: CallStack.h:133
Contains all information of a single function symbol in the call stack.
Definition: CallStack.h:115
CallStack()
Constructor that creates an empty call stack.
Definition: CallStack.h:86
std::string file
the binary file
Definition: CallStack.h:144
Provides definition for getters and setters that are used with the serialization framework.
void reflect(Reflector &r)
Definition: CallStack.h:122