debug collector: use sdbus++ for exception files
Log sbusplus exceptions instead of phosphor-logging
error exceptions.
For metadata use manually generated elog-errors.hpp this
is to cater for building repositories without depending
on phosphor-logging
Resolves openbmc/openbmc#1469
Change-Id: I9789edd80f3477eeb66b93dff6e12a95e89a0005
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
diff --git a/Makefile.am b/Makefile.am
index 4f6770d..90651d6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,31 @@
AM_DEFAULT_SOURCE_EXT = .cpp
sbin_PROGRAMS = checkstop_app
-checkstop_app_SOURCES = checkstop_app.cpp
-checkstop_app_LDFLAGS = $(PHOSPHOR_LOGGING_LIBS)
-checkstop_app_CXXFLAGS = $(PHOSPHOR_LOGGING_CFLAGS)
+nobase_nodist_include_HEADERS = \
+ org/open_power/Host/error.hpp
+
+BUILT_SOURCES = \
+ org/open_power/Host/error.cpp \
+ org/open_power/Host/error.hpp
+
+CLEANFILES = ${BUILT_SOURCES}
+
+checkstop_app_SOURCES = checkstop_app.cpp \
+ org/open_power/Host/error.cpp
+
+checkstop_app_LDFLAGS = \
+ $(PHOSPHOR_LOGGING_LIBS) \
+ $(SDBUSPLUS_LIBS)
+
+checkstop_app_CXXFLAGS = \
+ $(PHOSPHOR_LOGGING_CFLAGS) \
+ $(SDBUSPLUS_CFLAGS)
+
+org/open_power/Host/error.hpp: ${top_srcdir}/org/open_power/Host.errors.yaml
+ @mkdir -p `dirname $@`
+ $(SDBUSPLUSPLUS) -r $(srcdir) error exception-header org.open_power.Host > $@
+
+org/open_power/Host/error.cpp: ${top_srcdir}/org/open_power/Host.errors.yaml
+ @mkdir -p `dirname $@`
+ $(SDBUSPLUSPLUS) -r $(srcdir) error exception-cpp org.open_power.Host > $@
+
diff --git a/checkstop_app.cpp b/checkstop_app.cpp
index f3a044b..a67499e 100644
--- a/checkstop_app.cpp
+++ b/checkstop_app.cpp
@@ -1,10 +1,11 @@
#include <phosphor-logging/elog.hpp>
#include "elog-errors.hpp"
+#include "org/open_power/Host/error.hpp"
int main(int argc, char* argv[])
{
using namespace phosphor::logging;
- using error = org::open_power::Host::Checkstop;
+ using error = sdbusplus::org::open_power::Host::Error::Checkstop;
report<error>();
return 0;
diff --git a/configure.ac b/configure.ac
index 476dc72..d862a43 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,6 +15,11 @@
AX_CXX_COMPILE_STDCXX_14([noext])
AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
+# Check for sdbus++
+AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
+AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
+ AC_MSG_ERROR(["Requires sdbus++"]))
+
LT_INIT
# Checks for libraries.
diff --git a/elog-errors.hpp b/elog-errors.hpp
index 92dc044..31a2fc5 100644
--- a/elog-errors.hpp
+++ b/elog-errors.hpp
@@ -1,89 +1,89 @@
-// This file was autogenerated. Do not edit!
-// See elog-gen.py for more details
-#pragma once
-
-#include <string>
-#include <tuple>
-#include <type_traits>
-#include <sdbusplus/exception.hpp>
-#include <phosphor-logging/log.hpp>
-
-namespace sdbusplus
-{
-namespace org
-{
-namespace open_power
-{
-namespace Host
-{
-namespace Error
-{
- struct Checkstop;
-} // namespace Error
-} // namespace Host
-} // namespace open_power
-} // namespace org
-} // namespace sdbusplus
-
-
-namespace phosphor
-{
-
-namespace logging
-{
-
-namespace org
-{
-namespace open_power
-{
-namespace Host
-{
-namespace _Checkstop
-{
-
-
-} // namespace _Checkstop
-
-struct Checkstop : public sdbusplus::exception_t
-{
- static constexpr auto errName = "org.open_power.Host.Checkstop";
- static constexpr auto errDesc = "Checkstop condition detected";
- static constexpr auto L = level::ERR;
- using metadata_types = std::tuple<>;
-
- const char* name() const noexcept
- {
- return errName;
- }
-
- const char* description() const noexcept
- {
- return errDesc;
- }
-
- const char* what() const noexcept
- {
- return errName;
- }
-};
-
-} // namespace Host
-} // namespace open_power
-} // namespace org
-
-
-namespace details
-{
-
-template <>
-struct map_exception_type<sdbusplus::org::open_power::Host::Error::Checkstop>
-{
- using type = org::open_power::Host::Checkstop;
-};
-
-}
-
-
-} // namespace logging
-
-} // namespace phosphor
+// This file was autogenerated. Do not edit!
+// See elog-gen.py for more details
+#pragma once
+
+#include <string>
+#include <tuple>
+#include <type_traits>
+#include <sdbusplus/exception.hpp>
+#include <phosphor-logging/log.hpp>
+
+namespace sdbusplus
+{
+namespace org
+{
+namespace open_power
+{
+namespace Host
+{
+namespace Error
+{
+ struct Checkstop;
+} // namespace Error
+} // namespace Host
+} // namespace open_power
+} // namespace org
+} // namespace sdbusplus
+
+
+namespace phosphor
+{
+
+namespace logging
+{
+
+namespace org
+{
+namespace open_power
+{
+namespace Host
+{
+namespace _Checkstop
+{
+
+
+} // namespace _Checkstop
+
+struct Checkstop : public sdbusplus::exception_t
+{
+ static constexpr auto errName = "org.open_power.Host.Checkstop";
+ static constexpr auto errDesc = "Checkstop condition detected";
+ static constexpr auto L = level::ERR;
+ using metadata_types = std::tuple<>;
+
+ const char* name() const noexcept
+ {
+ return errName;
+ }
+
+ const char* description() const noexcept
+ {
+ return errDesc;
+ }
+
+ const char* what() const noexcept
+ {
+ return errName;
+ }
+};
+
+} // namespace Host
+} // namespace open_power
+} // namespace org
+
+
+namespace details
+{
+
+template <>
+struct map_exception_type<sdbusplus::org::open_power::Host::Error::Checkstop>
+{
+ using type = org::open_power::Host::Checkstop;
+};
+
+}
+
+
+} // namespace logging
+
+} // namespace phosphor
diff --git a/org/open_power/Host.metadata.yaml b/org/open_power/Host.metadata.yaml
deleted file mode 100644
index 39c312f..0000000
--- a/org/open_power/Host.metadata.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-- name: Checkstop
- level: ERR