Attn: Remove --defaultbreakpoint add --defaultti
In order to support breakpoint handling and TI handling on systems that
did not support the get TI info interface the --defaultbreakpoint
configuration option was added. This switch is no longer needed and
breakpoint handling is now the default action for available but invalid
TI info data. A new option --defaultti was added to force handling of
TI's when TI info is available but not valid.
Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: I4bdf90dcbbf20b3428a1cef6f1a71ec32b3ca238
diff --git a/attn/attn_config.cpp b/attn/attn_config.cpp
index 6ab6e19..eae96f9 100644
--- a/attn/attn_config.cpp
+++ b/attn/attn_config.cpp
@@ -7,7 +7,7 @@
Config::Config()
{
setFlagAll();
- iv_flags.reset(dfltBreakpoint); // default value is clear
+ iv_flags.reset(dfltTi); // default value is clear
}
/** @brief Get state of flag */
diff --git a/attn/attn_config.hpp b/attn/attn_config.hpp
index e8ef101..7aad393 100644
--- a/attn/attn_config.hpp
+++ b/attn/attn_config.hpp
@@ -7,11 +7,11 @@
/** @brief configuration flags */
enum AttentionFlag
{
- enVital = 0,
- enCheckstop = 1,
- enTerminate = 2,
- enBreakpoints = 3,
- dfltBreakpoint = 4,
+ enVital = 0,
+ enCheckstop = 1,
+ enTerminate = 2,
+ enBreakpoints = 3,
+ dfltTi = 4,
lastFlag
};
diff --git a/attn/attn_handler.cpp b/attn/attn_handler.cpp
index f4454cf..1ed0ec8 100644
--- a/attn/attn_handler.cpp
+++ b/attn/attn_handler.cpp
@@ -345,29 +345,31 @@
}
}
- // If TI area not valid or not available
+ // TI area is available but was not valid data
if (false == tiInfoValid)
{
- trace<level::INFO>("TI info NOT available");
+ trace<level::INFO>("TI info NOT valid");
- // if configured to handle breakpoint as default special attention
- if (i_attention->getConfig()->getFlag(dfltBreakpoint))
- {
- if (true == (i_attention->getConfig()->getFlag(enBreakpoints)))
- {
- // Call the breakpoint special attention handler
- bpHandler();
- }
- }
// if configured to handle TI as default special attention
- else
+ if (i_attention->getConfig()->getFlag(dfltTi))
{
+ // TI handling may be disabled
if (true == (i_attention->getConfig()->getFlag(enTerminate)))
{
// Call TI special attention handler
rc = tiHandler(nullptr);
}
}
+ // breakpoint is default special attention when TI info NOT valid
+ else
+ {
+ // breakpoint handling may be disabled
+ if (true == (i_attention->getConfig()->getFlag(enBreakpoints)))
+ {
+ // Call the breakpoint special attention handler
+ rc = bpHandler();
+ }
+ }
}
// release TI data buffer
diff --git a/attn/bp_handler.cpp b/attn/bp_handler.cpp
index e25a243..408fe58 100644
--- a/attn/bp_handler.cpp
+++ b/attn/bp_handler.cpp
@@ -1,3 +1,4 @@
+#include <attn/attn_handler.hpp>
#include <attn/attn_logging.hpp>
#include <sdbusplus/bus.hpp>
@@ -10,22 +11,34 @@
* When the special attention is due to a breakpoint condition we will notify
* Cronus over the dbus interface.
*/
-void bpHandler()
+int bpHandler()
{
+ int rc = RC_SUCCESS; // assume success
+
// trace message
trace<level::INFO>("Notify Cronus");
// notify Cronus over dbus
- auto bus = sdbusplus::bus::new_system();
- auto msg = bus.new_signal("/", "org.openbmc.cronus", "Brkpt");
+ try
+ {
+ auto bus = sdbusplus::bus::new_system();
+ auto msg = bus.new_signal("/", "org.openbmc.cronus", "Brkpt");
- // Cronus will figure out proc, core, thread so just send 0,0,0
- std::array<uint32_t, 3> params{0, 0, 0};
- msg.append(params);
+ // Cronus will figure out proc, core, thread so just send 0,0,0
+ std::array<uint32_t, 3> params{0, 0, 0};
+ msg.append(params);
- msg.signal_send();
+ msg.signal_send();
+ }
+ catch (const sdbusplus::exception::SdBusError& e)
+ {
+ trace<level::INFO>("bpHandler() exception");
+ std::string traceMsg = std::string(e.what(), maxTraceLen);
+ trace<level::ERROR>(traceMsg.c_str());
+ rc = RC_NOT_HANDLED;
+ }
- return;
+ return rc;
}
} // namespace attn
diff --git a/attn/bp_handler.hpp b/attn/bp_handler.hpp
index 4c7dcb0..0d02bcb 100644
--- a/attn/bp_handler.hpp
+++ b/attn/bp_handler.hpp
@@ -7,7 +7,9 @@
* @brief Breakpoint special attention handler
*
* Handler for special attention events due to a breakpoint condition.
+ *
+ * @return RC_NOT_HANDLED if error, else RC_SUCCESS
*/
-void bpHandler();
+int bpHandler();
} // namespace attn
diff --git a/cli.cpp b/cli.cpp
index d68e041..8ab8023 100644
--- a/cli.cpp
+++ b/cli.cpp
@@ -91,12 +91,12 @@
}
// This option determines whether we service a TI or breakpoint in the
- // case where we cannot retrieve the TI info succesfully. The default
- // setting of this is "clear" meaning handle TI by default. This
- // flag is not affected by the set/clear all command line option.
- if (true == getCliOption(i_begin, i_end, "--defaultbreakpoint"))
+ // case where TI info is available but not valid. The default setting
+ // of this is "clear" meaning we will handle breakpoint by default.
+ // This flag is not affected by the set/clear all command line option.
+ if (true == getCliOption(i_begin, i_end, "--defaultti"))
{
- o_config->setFlag(attn::dfltBreakpoint);
+ o_config->setFlag(attn::dfltTi);
}
}
}