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/pel.hpp b/extensions/openpower-pels/pel.hpp
index abcb673..ac1bddc 100644
--- a/extensions/openpower-pels/pel.hpp
+++ b/extensions/openpower-pels/pel.hpp
@@ -317,6 +317,28 @@
     std::map<uint16_t, size_t> getPluralSections() const;
 
     /**
+     * @brief Adds the UserData section to this PEL object,
+     *        shrinking it if necessary
+     *
+     * @param[in] userData - The section to add
+     *
+     * @return bool - If the section was added or not.
+     */
+    bool addUserDataSection(std::unique_ptr<UserData> userData);
+
+    /**
+     * @brief helper function for printing PELs.
+     * @param[in] Section& - section object reference
+     * @param[in] std::string - PEL string
+     * @param[in|out] pluralSections - Map used to track sections counts for
+     *                                 when there is more than 1.
+     * @param[in] registry - Registry object reference
+     */
+    void printSectionInJSON(const Section& section, std::string& buf,
+                            std::map<uint16_t, size_t>& pluralSections,
+                            message::Registry& registry) const;
+
+    /**
      * @brief The PEL Private Header section
      */
     std::unique_ptr<PrivateHeader> _ph;
@@ -332,18 +354,6 @@
     std::vector<std::unique_ptr<Section>> _optionalSections;
 
     /**
-     * @brief helper function for printing PELs.
-     * @param[in] Section& - section object reference
-     * @param[in] std::string - PEL string
-     * @param[in|out] pluralSections - Map used to track sections counts for
-     *                                 when there is more than 1.
-     * @param[in] registry - Registry object reference
-     */
-    void printSectionInJSON(const Section& section, std::string& buf,
-                            std::map<uint16_t, size_t>& pluralSections,
-                            message::Registry& registry) const;
-
-    /**
      * @brief The maximum size a PEL can be in bytes.
      */
     static constexpr size_t _maxPELSize = 16384;
@@ -353,6 +363,15 @@
 {
 
 /**
+ * @brief Creates a UserData section object that contains JSON.
+ *
+ * @param[in] json - The JSON contents
+ *
+ * @return std::unique_ptr<UserData> - The UserData object
+ */
+std::unique_ptr<UserData> makeJSONUserDataSection(const nlohmann::json& json);
+
+/**
  * @brief Create a UserData section containing the AdditionalData
  *        contents as a JSON string.
  *