Trace PLDM response on unexpected states

Commit will trace the PLDM response packet when querying the OCC active
state sensors if the state is not one of the expected values:
  PLDM_STATE_SET_OPERATIONAL_RUNNING_STATUS_IN_SERVICE
  PLDM_STATE_SET_OPERATIONAL_RUNNING_STATUS_STOPPED
  PLDM_STATE_SET_OPERATIONAL_RUNNING_STATUS_DORMANT

Change-Id: I87d144b68aed76e473ebf28348ade3df910a5c5b
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/pldm.cpp b/pldm.cpp
index 6921861..687e3b4 100644
--- a/pldm.cpp
+++ b/pldm.cpp
@@ -549,7 +549,7 @@
         return;
     }
 
-    // Connect to MCTP scoket
+    // Connect to MCTP socket
     pldmFd = pldm_open();
     auto openErrno = errno;
     if (pldmFd == PLDM_REQUESTER_OPEN_FAIL)
@@ -795,6 +795,19 @@
                 "pldmRspCallback: OCC{} is not running (sensor state:{})",
                 instance, occSensorState)
                 .c_str());
+        if (occSensorState != PLDM_STATE_SET_OPERATIONAL_RUNNING_STATUS_STOPPED)
+        {
+            const size_t rspLength = responseMsgSize + sizeof(pldm_msg_hdr);
+            std::vector<std::uint8_t> pldmResponse(rspLength);
+            memcpy(&pldmResponse[0], reinterpret_cast<std::uint8_t*>(response),
+                   rspLength);
+            log<level::ERR>(
+                fmt::format(
+                    "pldmRspCallback: Bad State - PLDM response ({} bytes) for OCC{}:",
+                    rspLength, instance)
+                    .c_str());
+            dump_hex(pldmResponse);
+        }
         pldmIface->callBack(instance, false);
     }