28 #include <l4/cxx/l4types.h>
29 #include <l4/cxx/basic_ostream>
30 #include <l4/sys/err.h>
31 #include <l4/sys/capability>
40 #ifndef L4_CXX_NO_EXCEPTION_BACKTRACE
41 # define L4_CXX_EXCEPTION_BACKTRACE 20
44 #if defined(L4_CXX_EXCEPTION_BACKTRACE)
45 #include <l4/util/backtrace.h>
66 #if defined(L4_CXX_EXCEPTION_BACKTRACE)
68 void *_pc_array[L4_CXX_EXCEPTION_BACKTRACE];
78 Exception_tracer() throw() : _frame_cnt(l4util_backtrace(_pc_array, L4_CXX_EXCEPTION_BACKTRACE)) {}
85 void const *
const *
pc_array()
const throw() {
return _pc_array; }
101 void const *
const *
pc_array()
const throw() {
return 0; }
127 virtual char const *
str()
const throw () = 0;
147 explicit Runtime_error(
long err_no,
char const *extra = 0)
throw ()
154 for (
unsigned i = 0; i <
sizeof(_extra) && extra[i]; ++i)
155 _extra[i] = extra[i];
156 _extra[
sizeof(_extra) - 1] = 0;
159 char const *
str()
const throw ()
160 {
return l4sys_errtostr(_errno); }
161 char const *extra_str()
const {
return _extra; }
162 ~Runtime_error() throw () {}
164 long err_no()
const throw() {
return _errno; }
206 char const *
str()
const throw() {
return "unknown error"; }
240 template<
typename T>
242 char const *
str()
const throw() {
return "invalid object"; }
287 o <<
"Exception: " << e.
str() <<
", backtrace ...\n";
298 o <<
"Exception: " << e.
str() <<
": ";
300 o << e.extra_str() <<
": ";
301 o <<
"backtrace ...\n";