Revert "Fix: lttng-destroy: string formating error when default session is unset"
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 22 Mar 2024 14:51:20 +0000 (10:51 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 22 Mar 2024 14:53:24 +0000 (10:53 -0400)
This reverts commit e8c353ad12851366573d9bfe45d333a9e9ff742d as it is
missing files (wrong revision of the change picked-up from gerrit).

Change-Id: Ia426a8004d9827ee72ed39db52d7894f5d4eb34f
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng/Makefile.am
src/bin/lttng/commands/destroy.cpp
src/bin/lttng/commands/start.cpp
src/bin/lttng/commands/stop.cpp
src/bin/lttng/utils.cpp
src/common/exception.hpp

index e3718374637deda24acccd4bc1ccc5c0cd7443ae..09c5171d8f99f7b055b4bf7c7f25a1d57426c3fa 100644 (file)
@@ -34,8 +34,7 @@ lttng_SOURCES = command.hpp conf.cpp conf.hpp commands/start.cpp \
                                commands/list_triggers.cpp \
                                commands/remove_trigger.cpp \
                                utils.cpp utils.hpp lttng.cpp \
-                               uprobe.cpp uprobe.hpp \
-                               exception.hpp exception.cpp
+                               uprobe.cpp uprobe.hpp
 
 lttng_CXXFLAGS = $(AM_CXXFLAGS) $(POPT_CFLAGS)
 
index ef4b914d38bd39f124debce1dfb31600ba572a50..5e19d4189025181682d2040d503290cc9d0172cf 100644 (file)
@@ -7,7 +7,6 @@
 
 #define _LGPL_SOURCE
 #include "../command.hpp"
-#include "../exception.hpp"
 
 #include <common/exception.hpp>
 #include <common/make-unique-wrapper.hpp>
@@ -273,14 +272,6 @@ cmd_error_code destroy_sessions(const lttng::cli::session_spec& spec)
                                lttng_strerror(-ctl_exception.code()));
                        listing_failed = true;
                        return {};
-               } catch (const lttng::cli::no_default_session_error& cli_exception) {
-                       /*
-                        * The retrieval of the default session name already logs
-                        * an error when it fails. There is no value in printing
-                        * anything about this exception.
-                        */
-                       listing_failed = true;
-                       return {};
                }
        }();
 
index f00ce973e39c59034dec8c3c270d7bd229ab496f..f78d3e708aa80c0fd05865cd36ef965ada3790e8 100644 (file)
@@ -7,7 +7,6 @@
 
 #define _LGPL_SOURCE
 #include "../command.hpp"
-#include "../exception.hpp"
 #include "../utils.hpp"
 
 #include <common/exception.hpp>
@@ -118,14 +117,6 @@ cmd_error_code start_tracing(const lttng::cli::session_spec& spec)
                                lttng_strerror(-ctl_exception.code()));
                        listing_failed = true;
                        return {};
-               } catch (const lttng::cli::no_default_session_error& cli_exception) {
-                       /*
-                        * The retrieval of the default session name already logs
-                        * an error when it fails. There is no value in printing
-                        * anything about this exception.
-                        */
-                       listing_failed = true;
-                       return {};
                }
        }();
 
index 9d5533a2175c361be78f159a56628517afed9c13..af42d98db1f291f12d615976b29d3646cd573316 100644 (file)
@@ -7,7 +7,6 @@
 
 #define _LGPL_SOURCE
 #include "../command.hpp"
-#include "../exception.hpp"
 #include "../utils.hpp"
 
 #include <common/exception.hpp>
@@ -147,14 +146,6 @@ cmd_error_code stop_tracing(const lttng::cli::session_spec& spec)
                                lttng_strerror(-ctl_exception.code()));
                        listing_failed = true;
                        return {};
-               } catch (const lttng::cli::no_default_session_error& cli_exception) {
-                       /*
-                        * The retrieval of the default session name already logs
-                        * an error when it fails. There is no value in printing
-                        * anything about this exception.
-                        */
-                       listing_failed = true;
-                       return {};
                }
        }();
 
index 45fe256a579d092b4a1d92ddd81e26459b315a1e..403ee018579f755819877ce5d25109b7f94f24a4 100644 (file)
@@ -8,7 +8,6 @@
 #define _LGPL_SOURCE
 #include "command.hpp"
 #include "conf.hpp"
-#include "exception.hpp"
 #include "utils.hpp"
 
 #include <common/defaults.hpp>
@@ -716,14 +715,15 @@ lttng::cli::session_list lttng::cli::list_sessions(const struct session_spec& sp
                                lttng::make_unique_wrapper<char, lttng::memory::free>(
                                        get_session_name());
 
-                       if (!configured_name) {
-                               LTTNG_THROW_CLI_NO_DEFAULT_SESSION();
-                       }
+                       if (configured_name) {
+                               const struct lttng::cli::session_spec new_spec(
+                                       lttng::cli::session_spec::type::NAME,
+                                       configured_name.get());
 
-                       const struct lttng::cli::session_spec new_spec(
-                               lttng::cli::session_spec::type::NAME, configured_name.get());
+                               return list_sessions(new_spec);
+                       }
 
-                       return list_sessions(new_spec);
+                       return lttng::cli::session_list();
                }
 
                return get_sessions(
index 1880978e76997c3ee9df65f556516fd5f16b9581..e43094bb6e3a0baae83466295b4f41abba1d3047 100644 (file)
@@ -20,7 +20,7 @@
        throw lttng::posix_error(msg, errno_code, __FILE__, __func__, __LINE__)
 #define LTTNG_THROW_ERROR(msg) throw lttng::runtime_error(msg, __FILE__, __func__, __LINE__)
 #define LTTNG_THROW_UNSUPPORTED_ERROR(msg) \
-       throw lttng::unsupported_error(msg, __FILE__, __func__, __LINE__)
+       throw lttng::runtime_error(msg, __FILE__, __func__, __LINE__)
 #define LTTNG_THROW_COMMUNICATION_ERROR(msg) \
        throw lttng::communication_error(msg, __FILE__, __func__, __LINE__)
 #define LTTNG_THROW_PROTOCOL_ERROR(msg) \
This page took 0.027867 seconds and 4 git commands to generate.