Removed all using declarations and directives from header files
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "src/DebugServers/GdbRsp/GdbRspDebugServer.hpp"
|
||||
#include "src/DebugServers/GdbRsp/Register.hpp"
|
||||
#include "src/Helpers/BiMap.hpp"
|
||||
|
||||
namespace Bloom::DebugServers::Gdb
|
||||
{
|
||||
@@ -44,7 +45,10 @@ namespace Bloom::DebugServers::Gdb
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
BiMap<GdbRegisterNumber, TargetRegisterDescriptor> getRegisterNumberToDescriptorMapping() override {
|
||||
BiMap<GdbRegisterNumber, Targets::TargetRegisterDescriptor> getRegisterNumberToDescriptorMapping() override {
|
||||
using Targets::TargetRegisterDescriptor;
|
||||
using Targets::TargetRegisterType;
|
||||
|
||||
static BiMap<GdbRegisterNumber, TargetRegisterDescriptor> mapping = {
|
||||
{0, TargetRegisterDescriptor(0, TargetRegisterType::GENERAL_PURPOSE_REGISTER)},
|
||||
{1, TargetRegisterDescriptor(1, TargetRegisterType::GENERAL_PURPOSE_REGISTER)},
|
||||
@@ -93,12 +97,12 @@ namespace Bloom::DebugServers::Gdb
|
||||
* @param address
|
||||
* @return
|
||||
*/
|
||||
TargetMemoryType getMemoryTypeFromGdbAddress(std::uint32_t address) override {
|
||||
Targets::TargetMemoryType getMemoryTypeFromGdbAddress(std::uint32_t address) override {
|
||||
if (address & this->gdbInternalMemoryMask) {
|
||||
return TargetMemoryType::RAM;
|
||||
return Targets::TargetMemoryType::RAM;
|
||||
}
|
||||
|
||||
return TargetMemoryType::FLASH;
|
||||
return Targets::TargetMemoryType::FLASH;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "CommandPacketFactory.hpp"
|
||||
|
||||
using namespace Bloom::DebugServers::Gdb;
|
||||
using namespace Bloom::DebugServers::Gdb::CommandPackets;
|
||||
|
||||
std::unique_ptr<CommandPacket> CommandPacketFactory::create(std::vector<unsigned char> rawPacket) {
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
namespace Bloom::DebugServers::Gdb
|
||||
{
|
||||
using namespace CommandPackets;
|
||||
|
||||
/**
|
||||
* The CommandPacketFactory class provides a means for extracting raw packet data from a raw buffer, and
|
||||
* constructing the appropriate CommandPacket objects.
|
||||
@@ -46,6 +44,6 @@ namespace Bloom::DebugServers::Gdb
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
static std::unique_ptr<CommandPacket> create(std::vector<unsigned char> rawPacket);
|
||||
static std::unique_ptr<CommandPackets::CommandPacket> create(std::vector<unsigned char> rawPacket);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
namespace Bloom::DebugServers::Gdb::CommandPackets
|
||||
{
|
||||
using namespace Bloom::DebugServers::Gdb;
|
||||
|
||||
/**
|
||||
* The ContinueExecution class implements a structure for "c" packets. These packets instruct the server
|
||||
* to continue execution on the target.
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
namespace Bloom::DebugServers::Gdb::CommandPackets
|
||||
{
|
||||
using namespace Bloom::DebugServers::Gdb;
|
||||
|
||||
/**
|
||||
* The InterruptException class represents interrupt command packets. Upon receiving an interrupt packet, the
|
||||
* server is expected to interrupt execution on the target.
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
namespace Bloom::DebugServers::Gdb::CommandPackets
|
||||
{
|
||||
using namespace Bloom::DebugServers::Gdb;
|
||||
|
||||
/**
|
||||
* The ReadGeneralRegisters class implements a structure for "g" and "p" command packets. In response to these
|
||||
* packets, the server is expected to send register values for all registers (for "g" packets) or for a single
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
namespace Bloom::DebugServers::Gdb::CommandPackets
|
||||
{
|
||||
using namespace Bloom::DebugServers::Gdb;
|
||||
|
||||
/**
|
||||
* The ReadMemory class implements a structure for "m" packets. Upon receiving these packets, the server is
|
||||
* expected to read memory from the target and send it the client.
|
||||
|
||||
@@ -7,14 +7,13 @@
|
||||
#include "../BreakpointType.hpp"
|
||||
#include "CommandPacket.hpp"
|
||||
|
||||
namespace Bloom::DebugServers::Gdb {
|
||||
namespace Bloom::DebugServers::Gdb
|
||||
{
|
||||
enum class Feature: int;
|
||||
}
|
||||
|
||||
namespace Bloom::DebugServers::Gdb::CommandPackets
|
||||
{
|
||||
using namespace Bloom::DebugServers::Gdb;
|
||||
|
||||
/**
|
||||
* The RemoveBreakpoint class implements the structure for "z" command packets. Upon receiving this command, the
|
||||
* server is expected to remove a breakpoint at the specified address.
|
||||
|
||||
@@ -7,14 +7,13 @@
|
||||
#include "../BreakpointType.hpp"
|
||||
#include "CommandPacket.hpp"
|
||||
|
||||
namespace Bloom::DebugServers::Gdb {
|
||||
namespace Bloom::DebugServers::Gdb
|
||||
{
|
||||
enum class Feature: int;
|
||||
}
|
||||
|
||||
namespace Bloom::DebugServers::Gdb::CommandPackets
|
||||
{
|
||||
using namespace Bloom::DebugServers::Gdb;
|
||||
|
||||
/**
|
||||
* The SetBreakpoint class implements the structure for "Z" command packets. Upon receiving this command, the
|
||||
* server is expected to set a breakpoint at the specified address.
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
namespace Bloom::DebugServers::Gdb::CommandPackets
|
||||
{
|
||||
using namespace Bloom::DebugServers::Gdb;
|
||||
|
||||
/**
|
||||
* The StepExecution class implements the structure for "s" command packets. Upon receiving this command, the
|
||||
* server is expected to step execution on the target.
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#include "SupportedFeaturesQuery.hpp"
|
||||
#include <QtCore/QString>
|
||||
|
||||
#include "SupportedFeaturesQuery.hpp"
|
||||
#include "src/DebugServers/GdbRsp/GdbRspDebugServer.hpp"
|
||||
#include "../Feature.hpp"
|
||||
|
||||
using namespace Bloom::DebugServers::Gdb::CommandPackets;
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
namespace Bloom::DebugServers::Gdb::CommandPackets
|
||||
{
|
||||
using namespace Bloom::DebugServers::Gdb;
|
||||
|
||||
/**
|
||||
* The SupportedFeaturesQuery command packet is a query from the GDB client, requesting a list of GDB features
|
||||
* supported by the GDB server. The body of this packet also contains a list GDB features that are supported or
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include "WriteGeneralRegisters.hpp"
|
||||
#include "src/DebugServers/GdbRsp/GdbRspDebugServer.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
using namespace Bloom::DebugServers::Gdb::CommandPackets;
|
||||
using namespace Bloom::Exceptions;
|
||||
|
||||
void WriteGeneralRegisters::init() {
|
||||
// The P packet updates a single register
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
|
||||
namespace Bloom::DebugServers::Gdb::CommandPackets
|
||||
{
|
||||
using namespace Bloom::DebugServers::Gdb;
|
||||
using Bloom::Targets::TargetRegister;
|
||||
using Bloom::Targets::TargetRegisterMap;
|
||||
|
||||
/**
|
||||
* The WriteGeneralRegisters class implements the structure for "G" and "P" packets. Upon receiving this packet,
|
||||
* server is expected to write register values to the target.
|
||||
@@ -21,7 +17,7 @@ namespace Bloom::DebugServers::Gdb::CommandPackets
|
||||
void init();
|
||||
|
||||
public:
|
||||
TargetRegisterMap registerMap;
|
||||
Bloom::Targets::TargetRegisterMap registerMap;
|
||||
int registerNumber;
|
||||
std::vector<unsigned char> registerValue;
|
||||
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
namespace Bloom::DebugServers::Gdb::CommandPackets
|
||||
{
|
||||
using namespace Bloom::DebugServers::Gdb;
|
||||
using Bloom::Targets::TargetMemoryBuffer;
|
||||
|
||||
/**
|
||||
* The WriteMemory class implements the structure for "M" packets. Upon receiving this packet, the server is
|
||||
* expected to write data to the target's memory, at the specified start address.
|
||||
@@ -27,7 +24,7 @@ namespace Bloom::DebugServers::Gdb::CommandPackets
|
||||
*/
|
||||
std::uint32_t startAddress;
|
||||
|
||||
TargetMemoryBuffer buffer;
|
||||
Targets::TargetMemoryBuffer buffer;
|
||||
|
||||
WriteMemory(std::vector<unsigned char> rawPacket): CommandPacket(rawPacket) {
|
||||
init();
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "CommandPackets/CommandPacketFactory.hpp"
|
||||
|
||||
using namespace Bloom::DebugServers::Gdb;
|
||||
using namespace Bloom::DebugServers::Gdb::CommandPackets;
|
||||
using namespace Bloom::DebugServers::Gdb::ResponsePackets;
|
||||
using namespace Bloom::DebugServers::Gdb::Exceptions;
|
||||
using namespace Bloom::Exceptions;
|
||||
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
|
||||
namespace Bloom::DebugServers::Gdb
|
||||
{
|
||||
using namespace CommandPackets;
|
||||
using namespace ResponsePackets;
|
||||
|
||||
/**
|
||||
* The Connection class represents an active connection between the GDB RSP server and client.
|
||||
*
|
||||
@@ -46,7 +43,7 @@ namespace Bloom::DebugServers::Gdb
|
||||
*
|
||||
* @param interruptible
|
||||
* If this flag is set to false, no other component within Bloom will be able to gracefully interrupt
|
||||
* the read (via means of this->interruptEventNotifier). This flag has no affect if this->readInterruptEnabled
|
||||
* the read (via means of this->interruptEventNotifier). This flag has no effect if this->readInterruptEnabled
|
||||
* is false.
|
||||
*
|
||||
* @param msTimeout
|
||||
@@ -121,14 +118,14 @@ namespace Bloom::DebugServers::Gdb
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
std::vector<std::unique_ptr<CommandPacket>> readPackets();
|
||||
std::vector<std::unique_ptr<CommandPackets::CommandPacket>> readPackets();
|
||||
|
||||
/**
|
||||
* Sends a response packet to the client.
|
||||
*
|
||||
* @param packet
|
||||
*/
|
||||
void writePacket(const ResponsePacket& packet);
|
||||
void writePacket(const ResponsePackets::ResponsePacket& packet);
|
||||
|
||||
int getMaxPacketSize() {
|
||||
return this->maxPacketSize;
|
||||
|
||||
@@ -4,22 +4,20 @@
|
||||
|
||||
namespace Bloom::DebugServers::Gdb::Exceptions
|
||||
{
|
||||
using namespace Bloom::Exceptions;
|
||||
|
||||
/**
|
||||
* In the event that communication between the GDB RSP client and Bloom fails, a ClientCommunicationFailure
|
||||
* exception should be thrown. The GDB debug server handles this by severing the connection.
|
||||
*
|
||||
* See GdbRspDebugServer::serve() for handling code.
|
||||
*/
|
||||
class ClientCommunicationError: public Exception
|
||||
class ClientCommunicationError: public Bloom::Exceptions::Exception
|
||||
{
|
||||
public:
|
||||
explicit ClientCommunicationError(const std::string& message): Exception(message) {
|
||||
explicit ClientCommunicationError(const std::string& message): Bloom::Exceptions::Exception(message) {
|
||||
this->message = message;
|
||||
}
|
||||
|
||||
explicit ClientCommunicationError(const char* message): Exception(message) {
|
||||
explicit ClientCommunicationError(const char* message): Bloom::Exceptions::Exception(message) {
|
||||
this->message = std::string(message);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
namespace Bloom::DebugServers::Gdb::Exceptions
|
||||
{
|
||||
using namespace Bloom::Exceptions;
|
||||
|
||||
/**
|
||||
* When a GDB RSP client unexpectedly drops the connection in the middle of an IO operation, a ClientDisconnected
|
||||
* exception should be thrown. The GDB debug server handles this by clearing the connection and waiting for a new
|
||||
@@ -13,14 +11,14 @@ namespace Bloom::DebugServers::Gdb::Exceptions
|
||||
*
|
||||
* See GdbRspDebugServer::serve() for handling code.
|
||||
*/
|
||||
class ClientDisconnected: public Exception
|
||||
class ClientDisconnected: public Bloom::Exceptions::Exception
|
||||
{
|
||||
public:
|
||||
explicit ClientDisconnected(const std::string& message): Exception(message) {
|
||||
explicit ClientDisconnected(const std::string& message): Bloom::Exceptions::Exception(message) {
|
||||
this->message = message;
|
||||
}
|
||||
|
||||
explicit ClientDisconnected(const char* message): Exception(message) {
|
||||
explicit ClientDisconnected(const char* message): Bloom::Exceptions::Exception(message) {
|
||||
this->message = std::string(message);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,22 +4,20 @@
|
||||
|
||||
namespace Bloom::DebugServers::Gdb::Exceptions
|
||||
{
|
||||
using namespace Bloom::Exceptions;
|
||||
|
||||
/**
|
||||
* In the event that the GDB debug server determines that the connected client cannot be served,
|
||||
* the ClientNotSupported exception should be thrown.
|
||||
*
|
||||
* See GdbRspDebugServer::serve() for handling code.
|
||||
*/
|
||||
class ClientNotSupported: public Exception
|
||||
class ClientNotSupported: public Bloom::Exceptions::Exception
|
||||
{
|
||||
public:
|
||||
explicit ClientNotSupported(const std::string& message): Exception(message) {
|
||||
explicit ClientNotSupported(const std::string& message): Bloom::Exceptions::Exception(message) {
|
||||
this->message = message;
|
||||
}
|
||||
|
||||
explicit ClientNotSupported(const char* message): Exception(message) {
|
||||
explicit ClientNotSupported(const char* message): Bloom::Exceptions::Exception(message) {
|
||||
this->message = std::string(message);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,17 @@
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
using namespace Bloom::DebugServers::Gdb;
|
||||
using namespace Exceptions;
|
||||
using namespace Bloom::DebugServers::Gdb::CommandPackets;
|
||||
using namespace Bloom::DebugServers::Gdb::ResponsePackets;
|
||||
using namespace Bloom::DebugServers::Gdb::Exceptions;
|
||||
using namespace Bloom::Events;
|
||||
using namespace Bloom::Exceptions;
|
||||
|
||||
using Bloom::Targets::TargetRegister;
|
||||
using Bloom::Targets::TargetRegisterType;
|
||||
using Bloom::Targets::TargetRegisterDescriptor;
|
||||
using Bloom::Targets::TargetRegisterDescriptors;
|
||||
using Bloom::Targets::TargetBreakpoint;
|
||||
|
||||
void GdbRspDebugServer::init() {
|
||||
auto ipAddress = this->debugServerConfig.jsonObject.find("ipAddress")->toString().toStdString();
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
|
||||
namespace Bloom::DebugServers::Gdb
|
||||
{
|
||||
using Bloom::Targets::TargetRegisterType;
|
||||
using Bloom::Targets::TargetRegisterDescriptor;
|
||||
|
||||
/**
|
||||
* The GdbRspDebugServer is an implementation of a GDB server using the GDB Remote Serial Protocol.
|
||||
*
|
||||
@@ -123,7 +120,7 @@ namespace Bloom::DebugServers::Gdb
|
||||
* @param address
|
||||
* @return
|
||||
*/
|
||||
virtual TargetMemoryType getMemoryTypeFromGdbAddress(std::uint32_t address) = 0;
|
||||
virtual Targets::TargetMemoryType getMemoryTypeFromGdbAddress(std::uint32_t address) = 0;
|
||||
|
||||
/**
|
||||
* Removes memory type information from memory address.
|
||||
@@ -143,7 +140,10 @@ namespace Bloom::DebugServers::Gdb
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
virtual BiMap<GdbRegisterNumber, TargetRegisterDescriptor> getRegisterNumberToDescriptorMapping() = 0;
|
||||
virtual BiMap<
|
||||
GdbRegisterNumber,
|
||||
Targets::TargetRegisterDescriptor
|
||||
> getRegisterNumberToDescriptorMapping() = 0;
|
||||
|
||||
/**
|
||||
* Obtains the appropriate register descriptor from a register number.
|
||||
@@ -151,12 +151,12 @@ namespace Bloom::DebugServers::Gdb
|
||||
* @param number
|
||||
* @return
|
||||
*/
|
||||
virtual TargetRegisterDescriptor getRegisterDescriptorFromNumber(GdbRegisterNumber number) {
|
||||
virtual Targets::TargetRegisterDescriptor getRegisterDescriptorFromNumber(GdbRegisterNumber number) {
|
||||
auto mapping = this->getRegisterNumberToDescriptorMapping();
|
||||
|
||||
if (!mapping.contains(number)) {
|
||||
throw Exception("Unknown register from GDB - register number (" + std::to_string(number)
|
||||
+ ") not mapped to any register descriptor.");
|
||||
throw Exceptions::Exception("Unknown register from GDB - register number ("
|
||||
+ std::to_string(number) + ") not mapped to any register descriptor.");
|
||||
}
|
||||
|
||||
return mapping.valueAt(number).value();
|
||||
@@ -173,7 +173,7 @@ namespace Bloom::DebugServers::Gdb
|
||||
* If the GDB client is currently waiting for the target execution to stop, this event handler will issue
|
||||
* a "stop reply" packet to the client once the target execution stops.
|
||||
*/
|
||||
void onTargetExecutionStopped(EventPointer<Events::TargetExecutionStopped>);
|
||||
void onTargetExecutionStopped(Events::EventPointer<Events::TargetExecutionStopped>);
|
||||
|
||||
/**
|
||||
* Handles any other GDB command packet that has not been promoted to a more specific type.
|
||||
@@ -181,7 +181,7 @@ namespace Bloom::DebugServers::Gdb
|
||||
*
|
||||
* @param packet
|
||||
*/
|
||||
virtual void handleGdbPacket(CommandPacket& packet);
|
||||
virtual void handleGdbPacket(CommandPackets::CommandPacket& packet);
|
||||
|
||||
/**
|
||||
* Handles the supported features query ("qSupported") command packet.
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
namespace Bloom::DebugServers::Gdb::ResponsePackets
|
||||
{
|
||||
using Bloom::Targets::TargetRegisterMap;
|
||||
|
||||
/**
|
||||
* The TargetStopped class implements the response packet structure for any commands that expect a "StopReply"
|
||||
* packet in response.
|
||||
@@ -17,7 +15,7 @@ namespace Bloom::DebugServers::Gdb::ResponsePackets
|
||||
{
|
||||
public:
|
||||
Signal signal;
|
||||
std::optional<TargetRegisterMap> registerMap;
|
||||
std::optional<Targets::TargetRegisterMap> registerMap;
|
||||
std::optional<StopReason> stopReason;
|
||||
|
||||
TargetStopped(Signal signal): signal(signal) {}
|
||||
|
||||
Reference in New Issue
Block a user