8 #ifndef BOOSTER_BACKTRACE_H 9 #define BOOSTER_BACKTRACE_H 11 #include <booster/config.h> 24 namespace stack_trace {
33 BOOSTER_API
int trace(
void **addresses,
int size);
39 BOOSTER_API
void write_symbols(
void *
const *addresses,
int size,std::ostream &);
43 BOOSTER_API std::string
get_symbol(
void *address);
47 BOOSTER_API std::string
get_symbols(
void *
const *address,
int size);
62 static size_t const default_stack_size = 32;
71 frames_.resize(frames_no,0);
85 return frames_.size();
93 if(frame_no < stack_size())
94 return frames_[frame_no];
103 if(frame_no < frames_.size())
112 if(frame_no < frames_.size())
114 return std::string();
123 return std::string();
138 std::vector<void *> frames_;
160 explicit runtime_error(std::string
const &s) : std::runtime_error(s)
170 explicit range_error(std::string
const &s) : std::range_error(s)
180 explicit overflow_error(std::string
const &s) : std::overflow_error(s)
190 explicit underflow_error(std::string
const &s) : std::underflow_error(s)
200 explicit logic_error(std::string
const &s) : std::logic_error(s)
210 explicit domain_error(std::string
const &s) : std::domain_error(s)
220 explicit length_error(std::string
const &s) : std::length_error(s)
240 explicit out_of_range(std::string
const &s) : std::out_of_range(s)
253 std::ostream &write(std::ostream &out)
const 263 inline std::ostream &operator<<(std::ostream &out,details::trace_manip
const &t)
285 details::trace_manip
trace(E
const &e)
288 return details::trace_manip(tr);
Same as std::length_error but records stack trace.
Definition: backtrace.h:218
Same as std::runtime_error but records stack trace.
Definition: backtrace.h:158
Same as std::exception but records stack trace.
Definition: backtrace.h:144
BOOSTER_API std::string get_symbols(void *const *address, int size)
Get stack trace information about multiple address recorded.
Same as std::underflow_error but records stack trace.
Definition: backtrace.h:188
Same as std::domain_error but records stack trace.
Definition: backtrace.h:208
Same as std::range_error but records stack trace.
Definition: backtrace.h:168
backtrace(size_t frames_no=default_stack_size)
Definition: backtrace.h:67
void * return_address(unsigned frame_no) const
Definition: backtrace.h:91
BOOSTER_API int trace(void **addresses, int size)
Record stack frame.
std::string trace_line(unsigned frame_no) const
Definition: backtrace.h:110
Same as std::overflow_error but records stack trace.
Definition: backtrace.h:178
Same as std::out_of_range but records stack trace.
Definition: backtrace.h:238
size_t stack_size() const
Definition: backtrace.h:83
Same as std::logic_error but records stack trace.
Definition: backtrace.h:198
BOOSTER_API void write_symbols(void *const *addresses, int size, std::ostream &)
Print stack trace.
the class that records the stack trace when it is created,
Definition: backtrace.h:56
Same as std::bad_cast but records stack trace.
Definition: backtrace.h:151
std::string trace() const
Definition: backtrace.h:120
Same as std::invalid_argument but records stack trace.
Definition: backtrace.h:228
void trace(std::ostream &out) const
Definition: backtrace.h:130
Booster library namespace. The library that implements Boost Like API in ABI backward compatible way...
Definition: application.h:23
BOOSTER_API std::string get_symbol(void *address)
Get stack trace information about a single address recorded.
void trace_line(unsigned frame_no, std::ostream &out) const
Definition: backtrace.h:101