diff --git a/src/plugins/serialoutput/SerialOutputLogger.cc b/src/plugins/serialoutput/SerialOutputLogger.cc index 78185767..8f5a2f54 100644 --- a/src/plugins/serialoutput/SerialOutputLogger.cc +++ b/src/plugins/serialoutput/SerialOutputLogger.cc @@ -10,7 +10,9 @@ bool SerialOutputLogger::run() while (true) { simulator.addListener(&ev_ioport); simulator.resume(); - m_output += ev_ioport.getData(); + if (m_output.size() < m_limit) { + m_output += ev_ioport.getData(); + } } return true; } diff --git a/src/plugins/serialoutput/SerialOutputLogger.hpp b/src/plugins/serialoutput/SerialOutputLogger.hpp index d7c0bfab..5027c8c8 100644 --- a/src/plugins/serialoutput/SerialOutputLogger.hpp +++ b/src/plugins/serialoutput/SerialOutputLogger.hpp @@ -22,6 +22,7 @@ class SerialOutputLogger : public fail::ExperimentFlow private: bool m_out; //!< Defines the direction of the listener. unsigned m_port; //!< the port the listener is listening on + unsigned m_limit; //!< character limit std::string m_output; //!< contains the traffic of ioport public: @@ -29,11 +30,13 @@ public: * Constructor of SerialOutput. * * @param port the port the listener is listening on + * @param char_limit limits the number of recorded characters (0 = no limit) * @param out Defines the direction of the listener. * \arg \c true Output on the given port is captured. This is default. * \arg \c false Input on the given port is captured. */ - SerialOutputLogger(unsigned port, bool out = true) : m_out(out), m_port(port) { } + SerialOutputLogger(unsigned port, unsigned char_limit = 0, bool out = true) + : m_out(out), m_port(port), m_limit(char_limit) { } bool run(); /** * Resets the output variable which contains the traffic of