Coverity reports multiple instances where formatting facilities can
throw (e.g. invalid format string).
A wrapper to handle formatting exceptions is added in a follow-up
change, but it is a good practice to catch exceptions at the top level
nonetheless.
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie55af338b9ef1f7d6e8825055cfc2e7037cdd80e
-cmd_error_code start_tracing(const lttng::cli::session_spec& spec) noexcept
+cmd_error_code start_tracing(const lttng::cli::session_spec& spec)
{
bool had_warning = false;
bool had_error = false;
{
bool had_warning = false;
bool had_error = false;
-cmd_error_code stop_tracing(const lttng::cli::session_spec& spec) noexcept
+cmd_error_code stop_tracing(const lttng::cli::session_spec& spec)
{
bool had_warning = false;
bool had_error = false;
{
bool had_warning = false;
bool had_error = false;
-int main(int argc, char *argv[])
+static int _main(int argc, char *argv[])
+
+int main(int argc, char **argv)
+{
+ try {
+ return _main(argc, argv);
+ } catch (const std::exception& e) {
+ ERR_FMT("Unhandled exception caught by client: %s", e.what());
+ abort();
+ }
+}
+#include <common/error.hpp>
+
#include <lttng/action/list-internal.hpp>
#include <lttng/condition/event-rule-matches.h>
#include <lttng/lttng.h>
#include <lttng/action/list-internal.hpp>
#include <lttng/condition/event-rule-matches.h>
#include <lttng/lttng.h>
-int main(int argc, char **argv)
+static int _main(int argc, char **argv)
free(expected_trigger_name);
return !!ret;
}
free(expected_trigger_name);
return !!ret;
}
+
+int main(int argc, char **argv)
+{
+ try {
+ return _main(argc, argv);
+ } catch (const std::exception& e) {
+ ERR_FMT("Unhandled exception caught by notification client: %s", e.what());
+ abort();
+ }
+}
+#include <common/error.hpp>
#include <common/payload-view.hpp>
#include <common/payload.hpp>
#include <common/payload-view.hpp>
#include <common/payload.hpp>
lttng_payload_reset(&payload);
}
lttng_payload_reset(&payload);
}
{
plan_tests(NUM_TESTS);
test_action_notify();
{
plan_tests(NUM_TESTS);
test_action_notify();
test_action_snapshot_session();
return exit_status();
}
test_action_snapshot_session();
return exit_status();
}
+
+int main()
+{
+ try {
+ return _main();
+ } catch (const std::exception& e) {
+ ERR_FMT("Unhandled exception caught by action unit test: %s", e.what());
+ abort();
+ }
+}