47 #ifndef _MIRA_CALLSTACK_H_ 48 #define _MIRA_CALLSTACK_H_ 54 # include <execinfo.h> 69 #include <boost/shared_array.hpp> 70 #include <boost/lexical_cast.hpp> 90 CallStack(
void** stack, std::size_t stackSize, std::size_t stackStart) :
92 mStack(stack), mStackSize(stackSize),
93 mStackStart(stackStart) {}
96 CallStack(
const std::vector<STACKFRAME64>& stack,
98 std::size_t stackSize, std::size_t stackStart) :
99 mStack(stack), mStackSize(stackSize),
100 mStackStart(stackStart) {}
110 mStack(other.mStack), mStackSize(other.mStackSize),
111 mStackStart(other.mStackStart), mSymbols(other.mSymbols) {}
116 template<
typename Reflector>
121 r.property(
"stacksize", mStackSize,
"");
122 r.property(
"stackstart", mStackStart,
"");
123 r.property(
"symbols",
124 getter(&CallStack::getSymbols,
this),
125 setter(&CallStack::setSymbols,
this),
141 template<
typename Reflector>
144 r.property(
"address", address,
"");
145 r.property(
"addressStr", addressStr,
"");
146 r.property(
"offset", offset,
"");
147 r.property(
"name", name,
"");
148 r.property(
"nameDemangled", nameDemangled,
"");
149 r.property(
"file",
file,
"");
175 std::string sourceLocation()
const;
185 const Symbol& operator[](std::size_t i)
const;
188 std::size_t
size()
const {
return mStackSize-mStackStart; }
198 static CallStack backtrace(std::size_t maxSize = 10, std::size_t stackStart = 1);
202 void obtainSymbols()
const;
204 const std::vector<Symbol>& getSymbols();
205 void setSymbols(
const std::vector<Symbol>& symbols);
209 boost::shared_array<void*> mStack;
212 std::vector<STACKFRAME64> mStack;
214 std::size_t mStackSize;
215 std::size_t mStackStart;
217 mutable std::vector<Symbol> mSymbols;
Typedefs for OS independent basic data types.
int64 offset
The corresponding offset.
Definition: CallStack.h:157
PropertyHint file(const std::string &filters=std::string(), bool save=false)
Tells the property editor that the path is for a file, and that it should show a "File Open"/"File Sa...
Definition: Path.h:247
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
std::ostream & operator<<(std::ostream &s, const LibraryVersion &version)
std::size_t size() const
Returns the size of the call stack.
Definition: CallStack.h:188
CallStack(const CallStack &other)
Copy-Constructor.
Definition: CallStack.h:109
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:117
Encapsulates unix call stack functionality.
Definition: CallStack.h:86
std::string name
The mangled name of the function.
Definition: CallStack.h:159
std::string addressStr
The address of the code portion in a "human readable" format.
Definition: CallStack.h:155
std::string nameDemangled
The demangled name of the function (on Linux only available, if CALLSTACK_LINUX_USE_DEMANGLE is defin...
Definition: CallStack.h:162
Symbol()
Definition: CallStack.h:137
int64 address
The address of the code portion as a 64 bit integer.
Definition: CallStack.h:153
Contains all information of a single function symbol in the call stack.
Definition: CallStack.h:135
CallStack()
Constructor that creates an empty call stack.
Definition: CallStack.h:106
std::string file
the binary file
Definition: CallStack.h:164
Provides definition for getters and setters that are used with the serialization framework.
void reflect(Reflector &r)
Definition: CallStack.h:142