L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
std_exc_io
Go to the documentation of this file.
1// vi:set ft=cpp: -*- Mode: C++ -*-
7/*
8 * (c) 2011 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
9 * Alexander Warg <warg@os.inf.tu-dresden.de>
10 * economic rights: Technische Universität Dresden (Germany)
11 *
12 * This file is part of TUD:OS and distributed under the terms of the
13 * GNU General Public License 2.
14 * Please see the COPYING-GPL-2 file for details.
15 *
16 * As a special exception, you may use this file as part of a free software
17 * library without restriction. Specifically, if other files instantiate
18 * templates or use macros or inline functions from this file, or you compile
19 * this file and link it with other files to produce an executable, this
20 * file does not by itself cause the resulting executable to be covered by
21 * the GNU General Public License. This exception does not however
22 * invalidate any other reasons why the executable file might be covered by
23 * the GNU General Public License.
24 */
25#pragma once
26
27#include <l4/cxx/exceptions>
28#include <iostream>
29
30inline
31std::ostream &
32operator << (std::ostream &o, L4::Base_exception const &e)
33{
34 o << "Exception: " << e.str() << ", backtrace ...\n";
35 for (int i = 0; i < e.frame_count(); ++i)
36 o << (void *)(e.pc_array()[i]) << '\n';
37
38 return o;
39}
40
41inline
42std::ostream &
43operator << (std::ostream &o, L4::Runtime_error const &e)
44{
45 o << "Exception: " << e.str() << ": ";
46 if (e.extra_str())
47 o << e.extra_str() << ": ";
48 o << "backtrace ...\n";
49 for (int i = 0; i < e.frame_count(); ++i)
50 o << (void *)(e.pc_array()[i]) << '\n';
51
52 return o;
53}
Base class for all exceptions, thrown by the L4Re framework.
Definition exceptions:117
virtual char const * str() const noexcept=0
Return a human readable string for the exception.
void const *const * pc_array() const noexcept
Get the array containing the call trace.
Definition exceptions:84
int frame_count() const noexcept
Get the number of entries that are valid in the call trace.
Definition exceptions:88
Exception for an abstract runtime error.
Definition exceptions:140
char const * extra_str() const
Get the description text for this runtime error.
Definition exceptions:173
char const * str() const noexcept override
Return a human readable string for the exception.
Definition exceptions:165
Base exceptions.
IO Stream.