configopts.html, [...]: Add DOCTYPEs.
2002-10-07 Jonathan Wakely <jw@kayari.org>
* docs/html/configopts.html, docs/html/documentation.html,
docs/html/explanations.html, docs/html/install.html,
docs/html/17_intro/contribute.html, docs/html/17_intro/howto.html,
docs/html/17_intro/license.html, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html, docs/html/22_locale/codecvt.html,
docs/html/22_locale/ctype.html, docs/html/22_locale/howto.html,
docs/html/22_locale/locale.html, docs/html/22_locale/messages.html,
docs/html/23_containers/howto.html, docs/html/24_iterators/howto.html,
docs/html/25_algorithms/howto.html, docs/html/26_numerics/howto.html,
docs/html/27_io/howto.html, docs/html/ext/howto.html,
docs/html/ext/sgiexts.html, docs/html/faq/index.html: Add DOCTYPEs.
From-SVN: r57903
2002-10-08 02:11:23 +08:00
|
|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
|
|
<!DOCTYPE html
|
|
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
2001-09-18 07:24:40 +08:00
|
|
|
<head>
|
Makefile: Use more portable shell wildcard.
2002-09-05 Jonathan Wakely <jw@kayari.org>
* docs/html/Makefile: Use more portable shell wildcard.
* docs/html/makedoc.awk: Nest elements correctly for XHTML conversion.
* docs/html/configopts.html, docs/html/documentation.html,
docs/html/explanations.html, docs/html/install.html,
docs/html/17_intro/contribute.html, docs/html/17_intro/howto.html,
docs/html/17_intro/license.html, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html, docs/html/22_locale/codecvt.html,
docs/html/22_locale/ctype.html, docs/html/22_locale/howto.html,
docs/html/22_locale/locale.html, docs/html/22_locale/messages.html,
docs/html/23_containers/howto.html, docs/html/24_iterators/howto.html,
docs/html/25_algorithms/howto.html, docs/html/26_numerics/howto.html,
docs/html/27_io/howto.html, docs/html/ext/howto.html,
docs/html/ext/sgiexts.html, docs/html/faq/index.html: Convert
to XHTML.
* docs/html/faq/index.txt: Regenerate.
From-SVN: r56845
2002-09-05 23:47:54 +08:00
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
|
|
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)" />
|
|
|
|
<meta name="KEYWORDS" content="HOWTO, libstdc++, GCC, g++, libg++, STL" />
|
|
|
|
<meta name="DESCRIPTION" content="HOWTO for the libstdc++ chapter 19." />
|
|
|
|
<meta name="GENERATOR" content="vi and eight fingers" />
|
2001-09-18 07:24:40 +08:00
|
|
|
<title>libstdc++-v3 HOWTO: Chapter 19</title>
|
Makefile: Use more portable shell wildcard.
2002-09-05 Jonathan Wakely <jw@kayari.org>
* docs/html/Makefile: Use more portable shell wildcard.
* docs/html/makedoc.awk: Nest elements correctly for XHTML conversion.
* docs/html/configopts.html, docs/html/documentation.html,
docs/html/explanations.html, docs/html/install.html,
docs/html/17_intro/contribute.html, docs/html/17_intro/howto.html,
docs/html/17_intro/license.html, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html, docs/html/22_locale/codecvt.html,
docs/html/22_locale/ctype.html, docs/html/22_locale/howto.html,
docs/html/22_locale/locale.html, docs/html/22_locale/messages.html,
docs/html/23_containers/howto.html, docs/html/24_iterators/howto.html,
docs/html/25_algorithms/howto.html, docs/html/26_numerics/howto.html,
docs/html/27_io/howto.html, docs/html/ext/howto.html,
docs/html/ext/sgiexts.html, docs/html/faq/index.html: Convert
to XHTML.
* docs/html/faq/index.txt: Regenerate.
From-SVN: r56845
2002-09-05 23:47:54 +08:00
|
|
|
<link rel="StyleSheet" href="../lib3styles.css" />
|
2001-09-18 07:24:40 +08:00
|
|
|
</head>
|
|
|
|
<body>
|
2000-04-22 04:33:34 +08:00
|
|
|
|
2001-10-10 04:18:14 +08:00
|
|
|
<h1 class="centered"><a name="top">Chapter 19: Diagnostics</a></h1>
|
2000-04-22 04:33:34 +08:00
|
|
|
|
2001-09-18 07:24:40 +08:00
|
|
|
<p>Chapter 19 deals with program diagnostics, such as exceptions
|
2000-07-08 05:13:28 +08:00
|
|
|
and assertions. You know, all the things we wish weren't even
|
|
|
|
necessary at all.
|
2001-09-18 07:24:40 +08:00
|
|
|
</p>
|
2000-04-22 04:33:34 +08:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ####################################################### -->
|
Makefile: Use more portable shell wildcard.
2002-09-05 Jonathan Wakely <jw@kayari.org>
* docs/html/Makefile: Use more portable shell wildcard.
* docs/html/makedoc.awk: Nest elements correctly for XHTML conversion.
* docs/html/configopts.html, docs/html/documentation.html,
docs/html/explanations.html, docs/html/install.html,
docs/html/17_intro/contribute.html, docs/html/17_intro/howto.html,
docs/html/17_intro/license.html, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html, docs/html/22_locale/codecvt.html,
docs/html/22_locale/ctype.html, docs/html/22_locale/howto.html,
docs/html/22_locale/locale.html, docs/html/22_locale/messages.html,
docs/html/23_containers/howto.html, docs/html/24_iterators/howto.html,
docs/html/25_algorithms/howto.html, docs/html/26_numerics/howto.html,
docs/html/27_io/howto.html, docs/html/ext/howto.html,
docs/html/ext/sgiexts.html, docs/html/faq/index.html: Convert
to XHTML.
* docs/html/faq/index.txt: Regenerate.
From-SVN: r56845
2002-09-05 23:47:54 +08:00
|
|
|
<hr />
|
2001-09-18 07:24:40 +08:00
|
|
|
<h1>Contents</h1>
|
|
|
|
<ul>
|
Makefile: Use more portable shell wildcard.
2002-09-05 Jonathan Wakely <jw@kayari.org>
* docs/html/Makefile: Use more portable shell wildcard.
* docs/html/makedoc.awk: Nest elements correctly for XHTML conversion.
* docs/html/configopts.html, docs/html/documentation.html,
docs/html/explanations.html, docs/html/install.html,
docs/html/17_intro/contribute.html, docs/html/17_intro/howto.html,
docs/html/17_intro/license.html, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html, docs/html/22_locale/codecvt.html,
docs/html/22_locale/ctype.html, docs/html/22_locale/howto.html,
docs/html/22_locale/locale.html, docs/html/22_locale/messages.html,
docs/html/23_containers/howto.html, docs/html/24_iterators/howto.html,
docs/html/25_algorithms/howto.html, docs/html/26_numerics/howto.html,
docs/html/27_io/howto.html, docs/html/ext/howto.html,
docs/html/ext/sgiexts.html, docs/html/faq/index.html: Convert
to XHTML.
* docs/html/faq/index.txt: Regenerate.
From-SVN: r56845
2002-09-05 23:47:54 +08:00
|
|
|
<li><a href="#1">Adding data to exceptions</a></li>
|
|
|
|
<li><a href="#2">Exception class hierarchy diagram</a></li>
|
|
|
|
<li><a href="#3">Concept checkers -- <strong>new and improved!</strong></a></li>
|
|
|
|
<li><a href="#4">Verbose <code>terminate</code></a></li>
|
2001-09-18 07:24:40 +08:00
|
|
|
</ul>
|
2000-04-22 04:33:34 +08:00
|
|
|
|
Makefile: Use more portable shell wildcard.
2002-09-05 Jonathan Wakely <jw@kayari.org>
* docs/html/Makefile: Use more portable shell wildcard.
* docs/html/makedoc.awk: Nest elements correctly for XHTML conversion.
* docs/html/configopts.html, docs/html/documentation.html,
docs/html/explanations.html, docs/html/install.html,
docs/html/17_intro/contribute.html, docs/html/17_intro/howto.html,
docs/html/17_intro/license.html, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html, docs/html/22_locale/codecvt.html,
docs/html/22_locale/ctype.html, docs/html/22_locale/howto.html,
docs/html/22_locale/locale.html, docs/html/22_locale/messages.html,
docs/html/23_containers/howto.html, docs/html/24_iterators/howto.html,
docs/html/25_algorithms/howto.html, docs/html/26_numerics/howto.html,
docs/html/27_io/howto.html, docs/html/ext/howto.html,
docs/html/ext/sgiexts.html, docs/html/faq/index.html: Convert
to XHTML.
* docs/html/faq/index.txt: Regenerate.
From-SVN: r56845
2002-09-05 23:47:54 +08:00
|
|
|
<hr />
|
2000-04-22 04:33:34 +08:00
|
|
|
|
|
|
|
<!-- ####################################################### -->
|
|
|
|
|
2001-09-18 07:24:40 +08:00
|
|
|
<h2><a name="1">Adding data to exceptions</a></h2>
|
|
|
|
<p>The standard exception classes carry with them a single string as
|
2000-04-22 04:33:34 +08:00
|
|
|
data (usually describing what went wrong or where the 'throw' took
|
|
|
|
place). It's good to remember that you can add your own data to
|
ChangeLog, [...]: Fix spelling errors.
* ChangeLog, docs/doxygen/maint.cfg.in, docs/doxygen/user.cfg.in,
docs/doxygen/doxygroups.cc, docs/doxygen/Intro.3,
docs/html/17_intro/BUGS, docs/html/17_intro/C++STYLE,
docs/html/17_intro/CHECKLIST, docs/html/17_intro/DESIGN,
docs/html/17_intro/howto.html, docs/html/17_intro/porting.html,
docs/html/17_intro/porting.texi, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html,
docs/html/23_containers/howto.html,
docs/html/26_numerics/howto.html, docs/html/27_io/howto.html,
docs/html/27_io/binary_iostreams_kuehl.txt,
docs/html/ext/sgiexts.html, docs/html/faq/index.html,
docs/html/faq/index.txt, testsuite/24_iterators/iterator.cc,
include/bits/basic_file.h, include/bits/locale_facets.h,
include/bits/locale_facets.tcc, include/bits/std_sstream.h,
include/ext/ropeimpl.h, include/ext/stl_rope.h,
libsupc++/tinfo.cc, libsupc++/cxxabi.h, libsupc++/typeinfo,
libsupc++/eh_throw.cc, acinclude.m4, aclocal.m4, configure,
configure.target, ChangeLog-2000: Fix spelling errors.
From-SVN: r47291
2001-11-24 00:29:02 +08:00
|
|
|
these exceptions when extending the hierarchy:
|
2001-09-18 07:24:40 +08:00
|
|
|
</p>
|
2001-10-10 04:18:14 +08:00
|
|
|
<pre>
|
|
|
|
struct My_Exception : public std::runtime_error
|
2000-04-22 04:33:34 +08:00
|
|
|
{
|
|
|
|
public:
|
2001-03-25 08:01:57 +08:00
|
|
|
My_Exception (const string& whatarg)
|
2001-10-10 04:18:14 +08:00
|
|
|
: std::runtime_error(whatarg), e(errno), id(GetDataBaseID()) { }
|
2000-04-22 04:33:34 +08:00
|
|
|
int errno_at_time_of_throw() const { return e; }
|
|
|
|
DBID id_of_thing_that_threw() const { return id; }
|
|
|
|
protected:
|
|
|
|
int e;
|
|
|
|
DBID id; // some user-defined type
|
|
|
|
};
|
2001-10-10 04:18:14 +08:00
|
|
|
</pre>
|
2001-09-18 07:24:40 +08:00
|
|
|
<p>Return <a href="#top">to top of page</a> or
|
|
|
|
<a href="../faq/index.html">to the FAQ</a>.
|
|
|
|
</p>
|
2000-04-22 04:33:34 +08:00
|
|
|
|
Makefile: Use more portable shell wildcard.
2002-09-05 Jonathan Wakely <jw@kayari.org>
* docs/html/Makefile: Use more portable shell wildcard.
* docs/html/makedoc.awk: Nest elements correctly for XHTML conversion.
* docs/html/configopts.html, docs/html/documentation.html,
docs/html/explanations.html, docs/html/install.html,
docs/html/17_intro/contribute.html, docs/html/17_intro/howto.html,
docs/html/17_intro/license.html, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html, docs/html/22_locale/codecvt.html,
docs/html/22_locale/ctype.html, docs/html/22_locale/howto.html,
docs/html/22_locale/locale.html, docs/html/22_locale/messages.html,
docs/html/23_containers/howto.html, docs/html/24_iterators/howto.html,
docs/html/25_algorithms/howto.html, docs/html/26_numerics/howto.html,
docs/html/27_io/howto.html, docs/html/ext/howto.html,
docs/html/ext/sgiexts.html, docs/html/faq/index.html: Convert
to XHTML.
* docs/html/faq/index.txt: Regenerate.
From-SVN: r56845
2002-09-05 23:47:54 +08:00
|
|
|
<hr />
|
2001-09-18 07:24:40 +08:00
|
|
|
<h2><a name="2">Exception class hierarchy diagram</a></h2>
|
|
|
|
<p>At one point we were going to make up a PDF of the exceptions
|
2001-09-15 08:41:11 +08:00
|
|
|
hierarchy, akin to the one done for the I/O class hierarchy.
|
|
|
|
Time was our enemy. Since then we've moved to Doxygen, which has
|
|
|
|
the useful property of not sucking. Specifically, when the source
|
|
|
|
code is changed, the diagrams are automatically brought up to date.
|
|
|
|
For the old way, we had to update the diagrams separately.
|
2001-09-18 07:24:40 +08:00
|
|
|
</p>
|
|
|
|
<p>There are several links to the Doxygen-generated pages from
|
|
|
|
<a href="../documentation.html">here</a>.
|
|
|
|
</p>
|
|
|
|
<p>Return <a href="#top">to top of page</a> or
|
|
|
|
<a href="../faq/index.html">to the FAQ</a>.
|
|
|
|
</p>
|
2000-04-22 04:33:34 +08:00
|
|
|
|
Makefile: Use more portable shell wildcard.
2002-09-05 Jonathan Wakely <jw@kayari.org>
* docs/html/Makefile: Use more portable shell wildcard.
* docs/html/makedoc.awk: Nest elements correctly for XHTML conversion.
* docs/html/configopts.html, docs/html/documentation.html,
docs/html/explanations.html, docs/html/install.html,
docs/html/17_intro/contribute.html, docs/html/17_intro/howto.html,
docs/html/17_intro/license.html, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html, docs/html/22_locale/codecvt.html,
docs/html/22_locale/ctype.html, docs/html/22_locale/howto.html,
docs/html/22_locale/locale.html, docs/html/22_locale/messages.html,
docs/html/23_containers/howto.html, docs/html/24_iterators/howto.html,
docs/html/25_algorithms/howto.html, docs/html/26_numerics/howto.html,
docs/html/27_io/howto.html, docs/html/ext/howto.html,
docs/html/ext/sgiexts.html, docs/html/faq/index.html: Convert
to XHTML.
* docs/html/faq/index.txt: Regenerate.
From-SVN: r56845
2002-09-05 23:47:54 +08:00
|
|
|
<hr />
|
2001-09-18 07:24:40 +08:00
|
|
|
<h2><a name="3">Concept checkers -- <strong>new and improved!</strong></a></h2>
|
|
|
|
<p>Better taste! Less fat! Literally!</p>
|
|
|
|
<p>In 1999, SGI added <em>concept checkers</em> to their implementation
|
2001-04-03 08:26:58 +08:00
|
|
|
of the STL: code which checked the template parameters of
|
|
|
|
instantiated pieces of the STL, in order to insure that the parameters
|
|
|
|
being used met the requirements of the standard. For example,
|
|
|
|
the Standard requires that types passed as template parameters to
|
2001-09-18 07:24:40 +08:00
|
|
|
<code>vector</code> be "Assignable" (which means what you think
|
2001-04-03 08:26:58 +08:00
|
|
|
it means). The checking was done during compilation, and none of
|
|
|
|
the code was executed at runtime.
|
2001-09-18 07:24:40 +08:00
|
|
|
</p>
|
|
|
|
<p>Unfortunately, the size of the compiler files grew significantly
|
2001-04-03 08:26:58 +08:00
|
|
|
as a result. The checking code itself was cumbersome. And bugs
|
|
|
|
were found in it on more than one occasion.
|
2001-09-18 07:24:40 +08:00
|
|
|
</p>
|
|
|
|
<p>The primary author of the checking code, Jeremy Siek, had already
|
Makefile: Use more portable shell wildcard.
2002-09-05 Jonathan Wakely <jw@kayari.org>
* docs/html/Makefile: Use more portable shell wildcard.
* docs/html/makedoc.awk: Nest elements correctly for XHTML conversion.
* docs/html/configopts.html, docs/html/documentation.html,
docs/html/explanations.html, docs/html/install.html,
docs/html/17_intro/contribute.html, docs/html/17_intro/howto.html,
docs/html/17_intro/license.html, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html, docs/html/22_locale/codecvt.html,
docs/html/22_locale/ctype.html, docs/html/22_locale/howto.html,
docs/html/22_locale/locale.html, docs/html/22_locale/messages.html,
docs/html/23_containers/howto.html, docs/html/24_iterators/howto.html,
docs/html/25_algorithms/howto.html, docs/html/26_numerics/howto.html,
docs/html/27_io/howto.html, docs/html/ext/howto.html,
docs/html/ext/sgiexts.html, docs/html/faq/index.html: Convert
to XHTML.
* docs/html/faq/index.txt: Regenerate.
From-SVN: r56845
2002-09-05 23:47:54 +08:00
|
|
|
started work on a replacement implementation. The new code has been
|
2001-04-03 08:26:58 +08:00
|
|
|
formally reviewed and accepted into
|
2001-09-18 07:24:40 +08:00
|
|
|
<a href="http://www.boost.org/libs/concept_check/concept_check.htm">the
|
|
|
|
Boost libraries</a>, and we are pleased to incorporate it into the
|
2001-04-03 08:26:58 +08:00
|
|
|
GNU C++ library.
|
2001-09-18 07:24:40 +08:00
|
|
|
</p>
|
|
|
|
<p>The new version imposes a much smaller space overhead on the generated
|
2001-04-03 08:26:58 +08:00
|
|
|
object file. The checks are also cleaner and easier to read and
|
|
|
|
understand.
|
2001-09-18 07:24:40 +08:00
|
|
|
</p>
|
Makefile.am (doxygen, [...]): Tweak targets.
2002-01-28 Phil Edwards <pme@gcc.gnu.org>
* Makefile.am (doxygen, doxygen-maint, doxygen-man): Tweak targets.
* Makefile.in: Regenerate.
* docs/doxygen/run_doxygen: Update, mostly for man pages.
* docs/doxygen/Intro.3: Update.
* docs/doxygen/TODO: Update.
* docs/doxygen/doxygroups.cc: Add namespace hook for __gnu_cxx.
* docs/doxygen/mainpage.doxy: Update.
* docs/doxygen/user.cfg.in: Update for header rename. Also
regenerate comments and variables with 1.2.12.
* docs/doxygen/maint.cfg.in: Remove file.
* include/bits/stl_relops.h: Doxygenate.
* include/bits/stl_tempbuf.h (std::_Temporary_buffer): Likewise.
* include/c_std/std_cassert.h, include/c_std/std_cctype.h,
include/c_std/std_cerrno.h, include/c_std/std_cfloat.h,
include/c_std/std_ciso646.h, include/c_std/std_climits.h,
include/c_std/std_clocale.h, include/c_std/std_cmath.h,
include/c_std/std_csetjmp.h, include/c_std/std_csignal.h,
include/c_std/std_cstdarg.h, include/c_std/std_cstddef.h,
include/c_std/std_cstdio.h, include/c_std/std_cstdlib.h,
include/c_std/std_cstring.h, include/c_std/std_ctime.h,
include/c_std/std_cwchar.h, include/c_std/std_cwctype.h,
include/ext/algorithm, include/ext/functional, include/ext/hash_map,
include/ext/hash_set, include/ext/iterator, include/ext/memory,
include/ext/numeric, include/ext/rb_tree, include/ext/rope,
include/ext/ropeimpl.h, include/ext/slist, include/ext/stl_hash_fun.h,
include/ext/stl_hashtable.h, include/ext/stl_rope.h,
include/std/std_algorithm.h, include/std/std_bitset.h,
include/std/std_complex.h, include/std/std_deque.h,
include/std/std_fstream.h, include/std/std_functional.h,
include/std/std_iomanip.h, include/std/std_ios.h,
include/std/std_iosfwd.h, include/std/std_iostream.h,
include/std/std_istream.h, include/std/std_iterator.h,
include/std/std_limits.h, include/std/std_list.h,
include/std/std_locale.h, include/std/std_map.h,
include/std/std_memory.h, include/std/std_numeric.h,
include/std/std_ostream.h, include/std/std_queue.h,
include/std/std_set.h, include/std/std_sstream.h,
include/std/std_stack.h, include/std/std_stdexcept.h,
include/std/std_streambuf.h, include/std/std_string.h,
include/std/std_utility.h, include/std/std_valarray.h,
include/std/std_vector.h: Add/correct @file doxygen hook.
* include/ext/memory: Doxygenate most of rest of file.
* libsupc++/exception: Doxygen output formatting.
* libsupc++/new: Say which header it is.
* testsuite/lib/libstdc++-v3-dg.exp: Fix spacing.
* docs/html/19_diagnostics/howto.html: Describe concept-checks switch.
* docs/html/23_containers/howto.html: Describe O(n) list::size().
* docs/html/27_io/howto.html: Also link to Langer and Kreft text.
From-SVN: r49300
2002-01-29 06:13:12 +08:00
|
|
|
<p>For GCC 3.0 and 3.1 they are off by default. They can be enabled at
|
|
|
|
configure time with
|
|
|
|
<a href="../configopts.html"><code>--enable-concept-checks</code></a>.
|
2002-03-07 05:22:56 +08:00
|
|
|
For 3.1 you can instead #define _GLIBCPP_CONCEPT_CHECKS to enable them
|
|
|
|
on a per-translation-unit basis.
|
2001-09-18 07:24:40 +08:00
|
|
|
</p>
|
2001-11-20 08:51:37 +08:00
|
|
|
<p>Return <a href="#top">to top of page</a> or
|
|
|
|
<a href="../faq/index.html">to the FAQ</a>.
|
|
|
|
</p>
|
|
|
|
|
Makefile: Use more portable shell wildcard.
2002-09-05 Jonathan Wakely <jw@kayari.org>
* docs/html/Makefile: Use more portable shell wildcard.
* docs/html/makedoc.awk: Nest elements correctly for XHTML conversion.
* docs/html/configopts.html, docs/html/documentation.html,
docs/html/explanations.html, docs/html/install.html,
docs/html/17_intro/contribute.html, docs/html/17_intro/howto.html,
docs/html/17_intro/license.html, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html, docs/html/22_locale/codecvt.html,
docs/html/22_locale/ctype.html, docs/html/22_locale/howto.html,
docs/html/22_locale/locale.html, docs/html/22_locale/messages.html,
docs/html/23_containers/howto.html, docs/html/24_iterators/howto.html,
docs/html/25_algorithms/howto.html, docs/html/26_numerics/howto.html,
docs/html/27_io/howto.html, docs/html/ext/howto.html,
docs/html/ext/sgiexts.html, docs/html/faq/index.html: Convert
to XHTML.
* docs/html/faq/index.txt: Regenerate.
From-SVN: r56845
2002-09-05 23:47:54 +08:00
|
|
|
<hr />
|
2001-11-20 08:51:37 +08:00
|
|
|
<h2><a name="4">Verbose <code>terminate</code></a></h2>
|
|
|
|
<p>If you are having difficulty with uncaught exceptions and want a
|
|
|
|
little bit of help debugging the causes of the core dumps, you can
|
|
|
|
make use of a GNU extension in GCC 3.1 and later:
|
Makefile: Use more portable shell wildcard.
2002-09-05 Jonathan Wakely <jw@kayari.org>
* docs/html/Makefile: Use more portable shell wildcard.
* docs/html/makedoc.awk: Nest elements correctly for XHTML conversion.
* docs/html/configopts.html, docs/html/documentation.html,
docs/html/explanations.html, docs/html/install.html,
docs/html/17_intro/contribute.html, docs/html/17_intro/howto.html,
docs/html/17_intro/license.html, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html, docs/html/22_locale/codecvt.html,
docs/html/22_locale/ctype.html, docs/html/22_locale/howto.html,
docs/html/22_locale/locale.html, docs/html/22_locale/messages.html,
docs/html/23_containers/howto.html, docs/html/24_iterators/howto.html,
docs/html/25_algorithms/howto.html, docs/html/26_numerics/howto.html,
docs/html/27_io/howto.html, docs/html/ext/howto.html,
docs/html/ext/sgiexts.html, docs/html/faq/index.html: Convert
to XHTML.
* docs/html/faq/index.txt: Regenerate.
From-SVN: r56845
2002-09-05 23:47:54 +08:00
|
|
|
</p>
|
|
|
|
<pre>
|
2001-11-20 08:51:37 +08:00
|
|
|
#include <exception>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2002-04-02 05:56:42 +08:00
|
|
|
std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
|
2001-11-20 08:51:37 +08:00
|
|
|
...
|
|
|
|
throw <em>anything</em>;
|
|
|
|
}</pre>
|
2002-04-02 05:56:42 +08:00
|
|
|
<p>The <code> __verbose_terminate_handler </code> function obtains the name
|
2001-11-20 08:51:37 +08:00
|
|
|
of the current exception, attempts to demangle it, and prints it to
|
|
|
|
stderr. If the exception is derived from <code> std::exception </code>
|
|
|
|
then the output from <code>what()</code> will be included.
|
|
|
|
</p>
|
|
|
|
<p>Any replacement termination function is required to kill the program
|
|
|
|
without returning; this one calls abort.
|
|
|
|
</p>
|
|
|
|
<p>For example:
|
Makefile: Use more portable shell wildcard.
2002-09-05 Jonathan Wakely <jw@kayari.org>
* docs/html/Makefile: Use more portable shell wildcard.
* docs/html/makedoc.awk: Nest elements correctly for XHTML conversion.
* docs/html/configopts.html, docs/html/documentation.html,
docs/html/explanations.html, docs/html/install.html,
docs/html/17_intro/contribute.html, docs/html/17_intro/howto.html,
docs/html/17_intro/license.html, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html, docs/html/22_locale/codecvt.html,
docs/html/22_locale/ctype.html, docs/html/22_locale/howto.html,
docs/html/22_locale/locale.html, docs/html/22_locale/messages.html,
docs/html/23_containers/howto.html, docs/html/24_iterators/howto.html,
docs/html/25_algorithms/howto.html, docs/html/26_numerics/howto.html,
docs/html/27_io/howto.html, docs/html/ext/howto.html,
docs/html/ext/sgiexts.html, docs/html/faq/index.html: Convert
to XHTML.
* docs/html/faq/index.txt: Regenerate.
From-SVN: r56845
2002-09-05 23:47:54 +08:00
|
|
|
</p>
|
|
|
|
<pre>
|
2001-11-20 08:51:37 +08:00
|
|
|
#include <exception>
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
struct BLARGH : std::runtime_error
|
|
|
|
{
|
|
|
|
BLARGH (const string& whatarg)
|
|
|
|
: std::runtime_error(whatarg) { }
|
|
|
|
};
|
2001-04-03 08:26:58 +08:00
|
|
|
|
2001-11-20 08:51:37 +08:00
|
|
|
int main (int argc)
|
|
|
|
{
|
2002-04-02 05:56:42 +08:00
|
|
|
std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
|
2001-11-20 08:51:37 +08:00
|
|
|
if (argc > 5)
|
|
|
|
throw BLARGH("argc is greater than 5!");
|
|
|
|
else
|
|
|
|
throw argc;
|
|
|
|
}</pre>
|
|
|
|
<p>In GCC 3.1 and later, this gives
|
Makefile: Use more portable shell wildcard.
2002-09-05 Jonathan Wakely <jw@kayari.org>
* docs/html/Makefile: Use more portable shell wildcard.
* docs/html/makedoc.awk: Nest elements correctly for XHTML conversion.
* docs/html/configopts.html, docs/html/documentation.html,
docs/html/explanations.html, docs/html/install.html,
docs/html/17_intro/contribute.html, docs/html/17_intro/howto.html,
docs/html/17_intro/license.html, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html, docs/html/22_locale/codecvt.html,
docs/html/22_locale/ctype.html, docs/html/22_locale/howto.html,
docs/html/22_locale/locale.html, docs/html/22_locale/messages.html,
docs/html/23_containers/howto.html, docs/html/24_iterators/howto.html,
docs/html/25_algorithms/howto.html, docs/html/26_numerics/howto.html,
docs/html/27_io/howto.html, docs/html/ext/howto.html,
docs/html/ext/sgiexts.html, docs/html/faq/index.html: Convert
to XHTML.
* docs/html/faq/index.txt: Regenerate.
From-SVN: r56845
2002-09-05 23:47:54 +08:00
|
|
|
</p>
|
|
|
|
<pre>
|
2001-11-20 08:51:37 +08:00
|
|
|
% ./a.out
|
|
|
|
terminate called after throwing a `int'
|
|
|
|
Aborted
|
|
|
|
% ./a.out f f f f f f f f f f f
|
|
|
|
terminate called after throwing a `BLARGH'
|
|
|
|
what(): argc is greater than 5!
|
|
|
|
Aborted
|
|
|
|
%</pre>
|
Makefile: Use more portable shell wildcard.
2002-09-05 Jonathan Wakely <jw@kayari.org>
* docs/html/Makefile: Use more portable shell wildcard.
* docs/html/makedoc.awk: Nest elements correctly for XHTML conversion.
* docs/html/configopts.html, docs/html/documentation.html,
docs/html/explanations.html, docs/html/install.html,
docs/html/17_intro/contribute.html, docs/html/17_intro/howto.html,
docs/html/17_intro/license.html, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html, docs/html/22_locale/codecvt.html,
docs/html/22_locale/ctype.html, docs/html/22_locale/howto.html,
docs/html/22_locale/locale.html, docs/html/22_locale/messages.html,
docs/html/23_containers/howto.html, docs/html/24_iterators/howto.html,
docs/html/25_algorithms/howto.html, docs/html/26_numerics/howto.html,
docs/html/27_io/howto.html, docs/html/ext/howto.html,
docs/html/ext/sgiexts.html, docs/html/faq/index.html: Convert
to XHTML.
* docs/html/faq/index.txt: Regenerate.
From-SVN: r56845
2002-09-05 23:47:54 +08:00
|
|
|
<p>The 'Aborted' line comes from the call to abort(), of course.
|
2001-11-20 08:51:37 +08:00
|
|
|
</p>
|
2001-09-18 07:24:40 +08:00
|
|
|
<p>Return <a href="#top">to top of page</a> or
|
|
|
|
<a href="../faq/index.html">to the FAQ</a>.
|
|
|
|
</p>
|
2000-07-08 05:13:28 +08:00
|
|
|
|
|
|
|
|
2000-04-22 04:33:34 +08:00
|
|
|
<!-- ####################################################### -->
|
|
|
|
|
Makefile: Use more portable shell wildcard.
2002-09-05 Jonathan Wakely <jw@kayari.org>
* docs/html/Makefile: Use more portable shell wildcard.
* docs/html/makedoc.awk: Nest elements correctly for XHTML conversion.
* docs/html/configopts.html, docs/html/documentation.html,
docs/html/explanations.html, docs/html/install.html,
docs/html/17_intro/contribute.html, docs/html/17_intro/howto.html,
docs/html/17_intro/license.html, docs/html/18_support/howto.html,
docs/html/19_diagnostics/howto.html, docs/html/20_util/howto.html,
docs/html/21_strings/howto.html, docs/html/22_locale/codecvt.html,
docs/html/22_locale/ctype.html, docs/html/22_locale/howto.html,
docs/html/22_locale/locale.html, docs/html/22_locale/messages.html,
docs/html/23_containers/howto.html, docs/html/24_iterators/howto.html,
docs/html/25_algorithms/howto.html, docs/html/26_numerics/howto.html,
docs/html/27_io/howto.html, docs/html/ext/howto.html,
docs/html/ext/sgiexts.html, docs/html/faq/index.html: Convert
to XHTML.
* docs/html/faq/index.txt: Regenerate.
From-SVN: r56845
2002-09-05 23:47:54 +08:00
|
|
|
<hr />
|
2001-10-10 04:18:14 +08:00
|
|
|
<p class="fineprint"><em>
|
2001-10-05 04:03:22 +08:00
|
|
|
See <a href="../17_intro/license.html">license.html</a> for copying conditions.
|
2000-04-22 04:33:34 +08:00
|
|
|
Comments and suggestions are welcome, and may be sent to
|
2001-10-10 04:18:14 +08:00
|
|
|
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
2001-09-18 07:24:40 +08:00
|
|
|
</em></p>
|
2000-04-22 04:33:34 +08:00
|
|
|
|
|
|
|
|
2001-09-18 07:24:40 +08:00
|
|
|
</body>
|
|
|
|
</html>
|