PEL: Let SRC class create a debug section

Add functionality so that when the SRC PEL section is being created, it
can save debug data (a vector of strings) along the way, and the PEL
class will then add that data into a JSON UserData section with any
other debug data.  The PEL class will then also write the debug data to
the journal.

This will be used for things like failure messages when looking up
callouts, additional information for device callouts, etc.

The functionality to save debug data is in the Section base class, so in
the future other Section classes can also save debug data for display in
the PEL.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I2f7923303e953c100c94ac81ba7c85152080fb72
diff --git a/extensions/openpower-pels/section.hpp b/extensions/openpower-pels/section.hpp
index 183268c..bf08aa5 100644
--- a/extensions/openpower-pels/section.hpp
+++ b/extensions/openpower-pels/section.hpp
@@ -90,6 +90,16 @@
         return false;
     }
 
+    /**
+     * @brief Returns any debug data stored in the object
+     *
+     * @return std::vector<std::string>& - The debug data
+     */
+    const std::vector<std::string>& getDebugData() const
+    {
+        return _debugData;
+    }
+
   protected:
     /**
      * @brief Returns the flattened size of the section header
@@ -100,6 +110,17 @@
     }
 
     /**
+     * @brief Adds debug data to the object that may be displayed
+     *        in a UserData section in the PEL.
+     *
+     * @param[in] data - The new entry to add to the vector of data.
+     */
+    void addDebugData(const std::string& data)
+    {
+        _debugData.push_back(data);
+    }
+
+    /**
      * @brief Used to validate the section.
      *
      * Implemented by derived classes.
@@ -119,6 +140,14 @@
      * This is determined by the derived class.
      */
     bool _valid = false;
+
+    /**
+     * @brief Messages that derived classes can add during construction
+     *        of a PEL when something happens that would be useful to
+     *        store in the PEL.  This may get added into a UserData section
+     *        in the PEL.
+     */
+    std::vector<std::string> _debugData;
 };
 } // namespace pels
 } // namespace openpower