diff --git a/src/DebugServers/DebugServer.hpp b/src/DebugServers/DebugServer.hpp index 908f70d4..8cd45665 100644 --- a/src/DebugServers/DebugServer.hpp +++ b/src/DebugServers/DebugServer.hpp @@ -39,8 +39,6 @@ namespace Bloom::DebugServers environmentConfig(environmentConfig), debugServerConfig(debugServerConfig) {}; - virtual ~DebugServer() = default; - /** * Entry point for the DebugServer. This must called from a dedicated thread. */ diff --git a/src/DebugServers/GdbRsp/Packet.hpp b/src/DebugServers/GdbRsp/Packet.hpp index fb198b57..8be18cd4 100644 --- a/src/DebugServers/GdbRsp/Packet.hpp +++ b/src/DebugServers/GdbRsp/Packet.hpp @@ -17,12 +17,19 @@ namespace Bloom::DebugServers::Gdb class Packet { public: - Packet() = default; explicit Packet(const std::vector& rawPacket) { this->init(rawPacket); } + + Packet() = default; virtual ~Packet() = default; + Packet(const Packet& other) = default; + Packet(Packet&& other) = default; + + Packet& operator = (const Packet& other) = default; + Packet& operator = (Packet&& other) = default; + [[nodiscard]] virtual std::vector getData() const { return this->data; } diff --git a/src/DebugToolDrivers/DebugTool.hpp b/src/DebugToolDrivers/DebugTool.hpp index 4f20da0e..f3908f36 100644 --- a/src/DebugToolDrivers/DebugTool.hpp +++ b/src/DebugToolDrivers/DebugTool.hpp @@ -15,8 +15,15 @@ namespace Bloom class DebugTool { public: + DebugTool() = default; virtual ~DebugTool() = default; + DebugTool(const DebugTool& other) = default; + DebugTool(DebugTool&& other) = default; + + DebugTool& operator = (const DebugTool& other) = default; + DebugTool& operator = (DebugTool&& other) = default; + /** * Should establish a connection to the device and prepare it for a debug session. */ diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.cpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.cpp index d69303a8..b3421fc3 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.cpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.cpp @@ -12,8 +12,8 @@ using namespace Bloom::Exceptions; void CmsisDapInterface::sendCommand(const Command& cmsisDapCommand) { if (this->msSendCommandDelay.count() > 0) { using namespace std::chrono; - long now = duration_cast(high_resolution_clock::now().time_since_epoch()).count(); - long difference = (now - this->lastCommandSentTimeStamp); + std::int64_t now = duration_cast(high_resolution_clock::now().time_since_epoch()).count(); + std::int64_t difference = (now - this->lastCommandSentTimeStamp); if (difference < this->msSendCommandDelay.count()) { std::this_thread::sleep_for(milliseconds(this->msSendCommandDelay.count() - difference)); @@ -28,7 +28,7 @@ void CmsisDapInterface::sendCommand(const Command& cmsisDapCommand) { std::unique_ptr CmsisDapInterface::getResponse() { auto rawResponse = this->getUsbHidInterface().read(10000); - if (rawResponse.size() == 0) { + if (rawResponse.empty()) { throw DeviceCommunicationFailure("Empty CMSIS-DAP response received"); } diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.hpp index 22461806..b3a8da53 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.hpp @@ -19,6 +19,13 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap { public: explicit CmsisDapInterface() = default; + virtual ~CmsisDapInterface() = default; + + CmsisDapInterface(const CmsisDapInterface& other) = default; + CmsisDapInterface(CmsisDapInterface&& other) = default; + + CmsisDapInterface& operator = (const CmsisDapInterface& other) = default; + CmsisDapInterface& operator = (CmsisDapInterface&& other) = default; Usb::HidInterface& getUsbHidInterface() { return this->usbHidInterface; @@ -80,6 +87,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap * being sent, where x is the value of msSendCommandDelay. */ std::chrono::milliseconds msSendCommandDelay = std::chrono::milliseconds(0); - long lastCommandSentTimeStamp = 0; + std::int64_t lastCommandSentTimeStamp = 0; }; } diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/Command.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/Command.hpp index 1294e049..4119732e 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/Command.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/Command.hpp @@ -8,8 +8,15 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap class Command { public: + Command() = default; virtual ~Command() = default; + Command(const Command& other) = default; + Command(Command&& other) = default; + + Command& operator = (const Command& other) = default; + Command& operator = (Command&& other) = default; + [[nodiscard]] unsigned char getCommandId() const { return this->commandId; } @@ -28,11 +35,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap [[nodiscard]] int getCommandSize() const { // +1 for the command ID - return (int) (1 + this->getData().size()); + return static_cast(1 + this->getData().size()); } [[nodiscard]] std::uint16_t getDataSize() const { - return (std::uint16_t) this->getData().size(); + return static_cast(this->getData().size()); } /** diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/Response.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/Response.hpp index f1eefc9c..a3f74ffd 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/Response.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/Response.hpp @@ -10,6 +10,12 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap Response() = default; virtual ~Response() = default; + Response(const Response& other) = default; + Response(Response&& other) = default; + + Response& operator = (const Response& other) = default; + Response& operator = (Response&& other) = default; + virtual void init(const std::vector& rawResponse); [[nodiscard]] unsigned char getResponseId() const { diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/AvrEvent.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/AvrEvent.hpp index eee452be..016954e4 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/AvrEvent.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/AvrEvent.hpp @@ -12,11 +12,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr AVR8_BREAK_EVENT = 0x40, }; - inline bool operator==(unsigned char rawId, AvrEventId id) { + inline bool operator == (unsigned char rawId, AvrEventId id) { return static_cast(id) == rawId; } - inline bool operator==(AvrEventId id, unsigned char rawId) { + inline bool operator == (AvrEventId id, unsigned char rawId) { return rawId == id; } diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AvrCommandFrame.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AvrCommandFrame.hpp index 7a3b6c7d..46dc76cc 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AvrCommandFrame.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AvrCommandFrame.hpp @@ -26,6 +26,13 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr AvrCommandFrame::lastSequenceId = 0; } }; + virtual ~AvrCommandFrame() = default; + + AvrCommandFrame(const AvrCommandFrame& other) = default; + AvrCommandFrame(AvrCommandFrame&& other) = default; + + AvrCommandFrame& operator = (const AvrCommandFrame& other) = default; + AvrCommandFrame& operator = (AvrCommandFrame&& other) = default; [[nodiscard]] unsigned char getProtocolVersion() const { return this->protocolVersion; diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/Discovery/DiscoveryCommandFrame.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/Discovery/DiscoveryCommandFrame.hpp index 9b89db57..fb2acbde 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/Discovery/DiscoveryCommandFrame.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/Discovery/DiscoveryCommandFrame.hpp @@ -18,19 +18,19 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames FAILED = 0xA0, }; - inline bool operator==(unsigned char rawId, ResponseId id) { + inline bool operator == (unsigned char rawId, ResponseId id) { return static_cast(id) == rawId; } - inline bool operator==(ResponseId id, unsigned char rawId) { + inline bool operator == (ResponseId id, unsigned char rawId) { return static_cast(id) == rawId; } - inline bool operator!=(unsigned char rawId, ResponseId id) { + inline bool operator != (unsigned char rawId, ResponseId id) { return static_cast(id) != rawId; } - inline bool operator!=(ResponseId id, unsigned char rawId) { + inline bool operator != (ResponseId id, unsigned char rawId) { return static_cast(id) != rawId; } diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/HouseKeeping/HouseKeepingCommandFrame.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/HouseKeeping/HouseKeepingCommandFrame.hpp index f5ba1217..662f7130 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/HouseKeeping/HouseKeepingCommandFrame.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/HouseKeeping/HouseKeepingCommandFrame.hpp @@ -13,11 +13,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames FAILED_WITH_DATA = 0xA1 }; - inline bool operator==(unsigned char rawId, ResponseId id) { + inline bool operator == (unsigned char rawId, ResponseId id) { return static_cast(id) == rawId; } - inline bool operator==(ResponseId id, unsigned char rawId) { + inline bool operator == (ResponseId id, unsigned char rawId) { return rawId == id; } diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/AvrResponseFrame.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/AvrResponseFrame.hpp index a932c3e6..ee9d6ea7 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/AvrResponseFrame.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/AvrResponseFrame.hpp @@ -20,6 +20,14 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr this->initFromAvrResponses(AVRResponses); } + virtual ~AvrResponseFrame() = default; + + AvrResponseFrame(const AvrResponseFrame& other) = default; + AvrResponseFrame(AvrResponseFrame&& other) = default; + + AvrResponseFrame& operator = (const AvrResponseFrame& other) = default; + AvrResponseFrame& operator = (AvrResponseFrame&& other) = default; + /** * An AVRResponse contains a single fragment of an AvrResponseFrame. * diff --git a/src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8Interface.hpp b/src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8Interface.hpp index e2dbb14b..16f294c0 100644 --- a/src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8Interface.hpp +++ b/src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8Interface.hpp @@ -26,6 +26,15 @@ namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8 class Avr8Interface { public: + Avr8Interface() = default; + virtual ~Avr8Interface() = default; + + Avr8Interface(const Avr8Interface& other) = default; + Avr8Interface(Avr8Interface&& other) = default; + + Avr8Interface& operator = (const Avr8Interface& other) = default; + Avr8Interface& operator = (Avr8Interface&& other) = default; + /** * Configures the interface. Any debug tool -> target interface specific configuration should take * place here. diff --git a/src/DebugToolDrivers/USB/HID/HidInterface.cpp b/src/DebugToolDrivers/USB/HID/HidInterface.cpp index 3faee7ac..057fa8eb 100644 --- a/src/DebugToolDrivers/USB/HID/HidInterface.cpp +++ b/src/DebugToolDrivers/USB/HID/HidInterface.cpp @@ -14,7 +14,7 @@ void HidInterface::init() { } hid_init(); - hid_device* hidDevice; + hid_device* hidDevice = nullptr; std::string hidInterfacePath = this->getDevicePathByInterfaceNumber(this->getNumber()); Logger::debug("HID device path: " + hidInterfacePath); @@ -36,7 +36,7 @@ void HidInterface::init() { } void HidInterface::close() { - auto hidDevice = this->getHidDevice(); + auto* hidDevice = this->getHidDevice(); if (hidDevice != nullptr) { this->libUsbDeviceHandle = nullptr; @@ -74,8 +74,9 @@ void HidInterface::write(std::vector buffer) { throw DeviceCommunicationFailure( "Cannot send data via HID interface - data exceeds maximum packet size." ); + } - } else if (buffer.size() < this->getInputReportSize()) { + if (buffer.size() < this->getInputReportSize()) { /* * Every report we send via the USB HID interface should be of a fixed size. * In the event of a report being too small, we just fill the buffer vector with 0. @@ -83,7 +84,7 @@ void HidInterface::write(std::vector buffer) { buffer.resize(this->getInputReportSize(), 0); } - int transferred; + int transferred = 0; auto length = buffer.size(); if ((transferred = hid_write(this->getHidDevice(), buffer.data(), length)) != length) { diff --git a/src/DebugToolDrivers/USB/Interface.hpp b/src/DebugToolDrivers/USB/Interface.hpp index 806cf51b..c646a9c5 100644 --- a/src/DebugToolDrivers/USB/Interface.hpp +++ b/src/DebugToolDrivers/USB/Interface.hpp @@ -15,6 +15,14 @@ namespace Bloom::Usb this->setNumber(interfaceNumber); } + virtual ~Interface() = default; + + Interface(const Interface& other) = default; + Interface(Interface&& other) = default; + + Interface& operator = (const Interface& other) = default; + Interface& operator = (Interface&& other) = default; + void setLibUsbDevice(libusb_device* libUsbDevice) { this->libUsbDevice = libUsbDevice; } diff --git a/src/DebugToolDrivers/USB/UsbDevice.hpp b/src/DebugToolDrivers/USB/UsbDevice.hpp index 394c7f6e..f7efb167 100644 --- a/src/DebugToolDrivers/USB/UsbDevice.hpp +++ b/src/DebugToolDrivers/USB/UsbDevice.hpp @@ -14,7 +14,14 @@ namespace Bloom::Usb { public: UsbDevice(std::uint16_t vendorId, std::uint16_t productId): vendorId(vendorId), productId(productId) {}; - ~UsbDevice() = default; + + virtual ~UsbDevice() = default; + + UsbDevice(const UsbDevice& other) = default; + UsbDevice(UsbDevice&& other) = default; + + UsbDevice& operator = (const UsbDevice& other) = default; + UsbDevice& operator = (UsbDevice&& other) = default; void init(); diff --git a/src/EventManager/Events/Event.hpp b/src/EventManager/Events/Event.hpp index 0be246d5..5ec69524 100644 --- a/src/EventManager/Events/Event.hpp +++ b/src/EventManager/Events/Event.hpp @@ -65,6 +65,15 @@ namespace Bloom::Events static constexpr EventType type = EventType::GENERIC; static inline const std::string name = "GenericEvent"; + Event() = default; + virtual ~Event() = default; + + Event(const Event& other) = default; + Event(Event&& other) = default; + + Event& operator = (const Event& other) = default; + Event& operator = (Event&& other) = default; + [[nodiscard]] virtual std::string getName() const { return Event::name; } diff --git a/src/Helpers/Thread.hpp b/src/Helpers/Thread.hpp index d86c5e59..5240bc4f 100644 --- a/src/Helpers/Thread.hpp +++ b/src/Helpers/Thread.hpp @@ -19,6 +19,15 @@ namespace Bloom class Thread { public: + Thread() = default; + virtual ~Thread() = default; + + Thread(const Thread& other) = delete; + Thread(Thread&& other) = delete; + + Thread& operator = (const Thread& other) = delete; + Thread& operator = (Thread&& other) = delete; + virtual ThreadState getThreadState() { return this->state.getValue(); }; diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegion.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegion.hpp index 67427452..a4dc5a3b 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegion.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegion.hpp @@ -40,6 +40,14 @@ namespace Bloom const Targets::TargetMemoryAddressRange& addressRange ): name(std::move(name)), type(type), memoryDescriptor(memoryDescriptor), addressRange(addressRange) {}; + virtual ~MemoryRegion() = default; + + MemoryRegion(const MemoryRegion& other) = default; + MemoryRegion(MemoryRegion&& other) = default; + + MemoryRegion& operator = (const MemoryRegion& other) = default; + MemoryRegion& operator = (MemoryRegion&& other) = default; + bool operator == (const MemoryRegion& other) const { return this->id == other.id; } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp index fcf818d7..6b8bd194 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp @@ -31,7 +31,7 @@ namespace Bloom::Widgets const Targets::TargetMemoryDescriptor& targetMemoryDescriptor, const TargetMemoryInspectionPaneSettings& settings, InsightWorker& insightWorker, - PanelWidget *parent + PanelWidget* parent ); void refreshMemoryValues(std::optional> callback = std::nullopt); diff --git a/src/Targets/TargetDescription/TargetDescriptionFile.hpp b/src/Targets/TargetDescription/TargetDescriptionFile.hpp index 3f98071a..4857c789 100644 --- a/src/Targets/TargetDescription/TargetDescriptionFile.hpp +++ b/src/Targets/TargetDescription/TargetDescriptionFile.hpp @@ -121,6 +121,13 @@ namespace Bloom::Targets::TargetDescription std::map interfacesByName; TargetDescriptionFile() = default; + virtual ~TargetDescriptionFile() = default; + + TargetDescriptionFile(const TargetDescriptionFile& other) = default; + TargetDescriptionFile(TargetDescriptionFile&& other) = default; + + TargetDescriptionFile& operator = (const TargetDescriptionFile& other) = default; + TargetDescriptionFile& operator = (TargetDescriptionFile&& other) = default; virtual void init(const QDomDocument& xml); void init(const QString& xmlFilePath);