aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@redhat.com>2004-02-03 01:26:12 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2004-02-03 01:26:12 +0000
commit7f7fb4ef6afe59f0df474b27741fae51e358fd7c (patch)
tree4f2e5d9085ead854d37b60439633afe6e37d93ee
parent040333a7ca1c7188f625da630f99a829e12b8cca (diff)
downloadgcc-7f7fb4ef6afe59f0df474b27741fae51e358fd7c.zip
gcc-7f7fb4ef6afe59f0df474b27741fae51e358fd7c.tar.gz
gcc-7f7fb4ef6afe59f0df474b27741fae51e358fd7c.tar.bz2
howto.html: Move verbose terminate documentation...
2004-02-02 Benjamin Kosnik <bkoz@redhat.com> * docs/html/19_diagnostics/howto.html: Move verbose terminate documentation... * docs/html/18_support/howto.html: Here. * docs/html/documentation.html: Add reference here. From-SVN: r77150
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/docs/html/18_support/howto.html83
-rw-r--r--libstdc++-v3/docs/html/19_diagnostics/howto.html70
-rw-r--r--libstdc++-v3/docs/html/documentation.html6
4 files changed, 86 insertions, 80 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index f59e01e..751858f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,10 @@
+2004-02-02 Benjamin Kosnik <bkoz@redhat.com>
+
+ * docs/html/19_diagnostics/howto.html: Move verbose terminate
+ documentation...
+ * docs/html/18_support/howto.html: Here.
+ * docs/html/documentation.html: Add reference here.
+
2004-02-02 Paolo Carlini <pcarlini@suse.de>
* config/locale/gnu/c++locale_internal.h: Remove prototypes
diff --git a/libstdc++-v3/docs/html/18_support/howto.html b/libstdc++-v3/docs/html/18_support/howto.html
index 7344c95..35fd930 100644
--- a/libstdc++-v3/docs/html/18_support/howto.html
+++ b/libstdc++-v3/docs/html/18_support/howto.html
@@ -42,8 +42,9 @@
<li><a href="#1">Types</a></li>
<li><a href="#2">Implementation properties</a></li>
<li><a href="#3">Start and Termination</a></li>
- <li><a href="#4">Dynamic memory management</a></li>
- <li><a href="#5">RTTI, the ABI, and demangling</a></li>
+ <li><a href="#4">Verbose <code>terminate</code></a></li>
+ <li><a href="#5">Dynamic memory management</a></li>
+ <li><a href="#6">RTTI, the ABI, and demangling</a></li>
</ul>
<hr />
@@ -216,10 +217,78 @@
</p>
<hr />
-<h2><a name="4">Dynamic memory management</a></h2>
- <p>There are six flavors each of <code>new</code> and <code>delete</code>, so
- make certain that you're using the right ones! Here are quickie
- descriptions of <code>new</code>:
+<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:
+ </p>
+ <pre>
+ #include &lt;exception&gt;
+
+ int main()
+ {
+ std::set_terminate(__gnu_cxx::__verbose_terminate_handler);
+ ...
+ throw <em>anything</em>;
+ }</pre>
+ <p>The <code> __verbose_terminate_handler </code> function obtains the name
+ 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:
+ </p>
+ <pre>
+ #include &lt;exception&gt;
+ #include &lt;stdexcept&gt;
+
+ struct argument_error : public std::runtime_error
+ {
+ argument_error(const std::string& s): std::runtime_error(s) { }
+ };
+
+ int main(int argc)
+ {
+ std::set_terminate(__gnu_cxx::__verbose_terminate_handler);
+ if (argc &gt; 5)
+ throw argument_error(&quot;argc is greater than 5!&quot;);
+ else
+ throw argc;
+ }
+ </pre>
+ <p>In GCC 3.1 and later, this gives
+ </p>
+ <pre>
+ % ./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 an instance of `argument_error'
+ what(): argc is greater than 5!
+ Aborted
+ %</pre>
+ <p>The 'Aborted' line comes from the call to abort(), of course.
+ </p>
+ <p><strong>UPDATE:</strong> Starting with GCC 3.4, this is the default
+ termination handler; nothing need be done to use it. To go back to
+ the previous &quot;silent death&quot; method, simply include
+ <code>&lt;exception&gt;</code> and <code>&lt;cstdlib&gt;</code>,
+ and call
+ </p>
+ <pre>
+ std::set_terminate(std::abort);</pre>
+ <p>Return <a href="#top">to top of page</a> or
+ <a href="../faq/index.html">to the FAQ</a>.
+ </p>
+
+<hr />
+<h2><a name="5">Dynamic memory management</a></h2>
+ <p>There are six flavors each of <code>new</code> and
+ <code>delete</code>, so make certain that you're using the right
+ ones! Here are quickie descriptions of <code>new</code>:
</p>
<ul>
<li>single object form, throwing a <code>bad_alloc</code> on errors;
@@ -277,7 +346,7 @@
</p>
<hr />
-<h2><a name="5">RTTI, the ABI, and demangling</a></h2>
+<h2><a name="6">RTTI, the ABI, and demangling</a></h2>
<p>If you have read the <a href="../documentation.html#4">source
documentation</a> for <code> namespace abi </code> then you are aware
of the cross-vendor C++ ABI which we use. One of the exposed
diff --git a/libstdc++-v3/docs/html/19_diagnostics/howto.html b/libstdc++-v3/docs/html/19_diagnostics/howto.html
index 2b5cd22..4cd2dc7 100644
--- a/libstdc++-v3/docs/html/19_diagnostics/howto.html
+++ b/libstdc++-v3/docs/html/19_diagnostics/howto.html
@@ -38,7 +38,6 @@
<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>
</ul>
<hr />
@@ -121,75 +120,6 @@
<a href="../faq/index.html">to the FAQ</a>.
</p>
-<hr />
-<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:
- </p>
- <pre>
- #include &lt;exception&gt;
-
- int main()
- {
- std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
- ...
- throw <em>anything</em>;
- }</pre>
- <p>The <code> __verbose_terminate_handler </code> function obtains the name
- 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:
- </p>
- <pre>
- #include &lt;exception&gt;
- #include &lt;stdexcept&gt;
-
- struct BLARGH : std::runtime_error
- {
- BLARGH (const string&amp; whatarg)
- : std::runtime_error(whatarg) { }
- };
-
- int main (int argc)
- {
- std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
- if (argc &gt; 5)
- throw BLARGH(&quot;argc is greater than 5!&quot;);
- else
- throw argc;
- }</pre>
- <p>In GCC 3.1 and later, this gives
- </p>
- <pre>
- % ./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>
- <p>The 'Aborted' line comes from the call to abort(), of course.
- </p>
- <p><strong>UPDATE:</strong> Starting with GCC 3.4, this is the default
- termination handler; nothing need be done to use it. To go back to
- the previous &quot;silent death&quot; method, simply include
- <code>&lt;exception&gt;</code> and <code>&lt;cstdlib&gt;</code>,
- and call
- </p>
- <pre>
- std::set_terminate (std::abort);</pre>
- <p>Return <a href="#top">to top of page</a> or
- <a href="../faq/index.html">to the FAQ</a>.
- </p>
-
-
<!-- ####################################################### -->
<hr />
diff --git a/libstdc++-v3/docs/html/documentation.html b/libstdc++-v3/docs/html/documentation.html
index a4be76e..ceb6076 100644
--- a/libstdc++-v3/docs/html/documentation.html
+++ b/libstdc++-v3/docs/html/documentation.html
@@ -125,8 +125,9 @@
<li><a href="18_support/howto.html#1">Types</a></li>
<li><a href="18_support/howto.html#2">Implementation properties</a></li>
<li><a href="18_support/howto.html#3">Start and Termination</a></li>
- <li><a href="18_support/howto.html#4">Dynamic memory management</a></li>
- <li><a href="18_support/howto.html#5">RTTI, the ABI, and demangling</a></li>
+ <li><a href="18_support/howto.html#4">Verbose <code>terminate</code></a></li>
+ <li><a href="18_support/howto.html#6">Dynamic memory management</a></li>
+ <li><a href="18_support/howto.html#7">RTTI, the ABI, and demangling</a></li>
</ul>
</li>
@@ -135,7 +136,6 @@
<li><a href="19_diagnostics/howto.html#1">Adding data to exceptions</a></li>
<li><a href="19_diagnostics/howto.html#2">Exception class hierarchy diagram</a></li>
<li><a href="19_diagnostics/howto.html#3">Concept checkers -- <strong>new and improved!</strong></a></li>
- <li><a href="19_diagnostics/howto.html#4">Verbose <code>terminate</code></a></li>
</ul>
</li>