Tidying
This commit is contained in:
@@ -108,7 +108,7 @@ namespace Bloom::DebugServers::Gdb
|
||||
auto output = std::vector<unsigned char>();
|
||||
constexpr size_t bufferSize = 1024;
|
||||
std::array<unsigned char, bufferSize> buffer = {};
|
||||
ssize_t bytesRead;
|
||||
ssize_t bytesRead = 0;
|
||||
|
||||
if (interruptible) {
|
||||
if (this->readInterruptEnabled != interruptible) {
|
||||
@@ -145,8 +145,10 @@ namespace Bloom::DebugServers::Gdb
|
||||
}
|
||||
|
||||
size_t bytesToRead = (bytes > bufferSize || bytes == 0) ? bufferSize : bytes;
|
||||
while (bytesToRead > 0
|
||||
&& (bytesRead = ::read(this->socketFileDescriptor, buffer.data(), bytesToRead)) > 0) {
|
||||
while (
|
||||
bytesToRead > 0
|
||||
&& (bytesRead = ::read(this->socketFileDescriptor, buffer.data(), bytesToRead)) > 0
|
||||
) {
|
||||
output.insert(output.end(), buffer.begin(), buffer.begin() + bytesRead);
|
||||
|
||||
if (bytesRead < bytesToRead) {
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace Bloom::DebugServers::Gdb
|
||||
class Connection
|
||||
{
|
||||
public:
|
||||
Connection() = delete;
|
||||
|
||||
explicit Connection(EventNotifier& interruptEventNotifier)
|
||||
: interruptEventNotifier(interruptEventNotifier)
|
||||
@@ -103,7 +104,11 @@ namespace Bloom::DebugServers::Gdb
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
std::vector<unsigned char> read(std::size_t bytes = 0, bool interruptible = true, std::optional<int> msTimeout = std::nullopt);
|
||||
std::vector<unsigned char> read(
|
||||
std::size_t bytes = 0,
|
||||
bool interruptible = true,
|
||||
std::optional<int> msTimeout = std::nullopt
|
||||
);
|
||||
|
||||
/**
|
||||
* Does the same as Connection::read(), but only reads a single byte.
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "Connection.hpp"
|
||||
#include "TargetDescriptor.hpp"
|
||||
#include "Connection.hpp"
|
||||
|
||||
namespace Bloom::DebugServers::Gdb
|
||||
{
|
||||
|
||||
@@ -11,12 +11,12 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
public:
|
||||
explicit GetParameter(const EdbgParameter& parameter) {
|
||||
/*
|
||||
* The EDBG Get Parameter command consists of 6 bytes:
|
||||
* The EDBG Get Parameter command consists of 5 bytes:
|
||||
*
|
||||
* 1. Command ID (0x02)
|
||||
* 2. Version (0x00)
|
||||
* 3. Parameter context
|
||||
* 4. Parameter
|
||||
* 4. Parameter ID
|
||||
* 5. Parameter size
|
||||
*/
|
||||
this->payload = {
|
||||
|
||||
Reference in New Issue
Block a user