summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/terminate_handler.h
diff options
context:
space:
mode:
authorPaul Wicks <pwicks86@gmail.com>2018-07-10 13:38:27 -0700
committerMarcus Müller <marcus@hostalia.de>2020-12-19 12:59:25 +0100
commit6d6c9a254102374d3fdbc4c39eac0b67e07168b7 (patch)
tree62028d8c95483062382c334bb4cdb8ef98fa5967 /gnuradio-runtime/lib/terminate_handler.h
parenta5e49d9120e8d0d7adf4de792cc3c4bc1a6defbc (diff)
runtime: Add terminate handling
This consists of the following changes: 1. Add a top_block parameter to control exception handling This restores past behavior where the scheduler catches exceptions raised in block threads, allowing flowgraphs to continue running after the failure of an individual block. It also adds optional new behavior, selected by setting catch_exceptions=False to the top block, which causes exceptions to not be caught. In this mode of operation, a std::terminate handler can be installed to print a stack trace before the flowgraph exits. 2. Add terminate_handler to top_block_impl This adds a terminate_handler function that prints information about any uncaught exceptions and also attempts to print a backtrace for said exception after which it calls std::abort. The backtrace is printed via libunwind, which is a new optional dependency. If libunwind is not found/installed, then the terminate handler will still print information about the exception and then exit. Co-Authored-By: Scott Torborg <storborg@gmail.com>
Diffstat (limited to 'gnuradio-runtime/lib/terminate_handler.h')
-rw-r--r--gnuradio-runtime/lib/terminate_handler.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/gnuradio-runtime/lib/terminate_handler.h b/gnuradio-runtime/lib/terminate_handler.h
new file mode 100644
index 0000000000..a7a671b06a
--- /dev/null
+++ b/gnuradio-runtime/lib/terminate_handler.h
@@ -0,0 +1,19 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2018 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#ifndef INCLUDED_GR_TERMINATE_HANDLER_H
+#define INCLUDED_GR_TERMINATE_HANDLER_H
+
+#include <gnuradio/api.h>
+
+namespace gr {
+void install_terminate_handler() GR_RUNTIME_API;
+}
+
+#endif /* INCLUDED_TERMINATE_HANDLER_H */