Skip to content

Commit 2f5855a

Browse files
committed
GDBServer: Get rid of <map> usage
1 parent cd694c0 commit 2f5855a

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/core/gdb_server.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414

1515
#include "util/sockets.h"
1616

17-
#include <functional>
1817
#include <iomanip>
19-
#include <map>
2018
#include <optional>
2119
#include <sstream>
2220
#include <string>
@@ -94,7 +92,7 @@ static const std::array<u32*, 38> REGISTERS{
9492
};
9593

9694
/// List of all GDB remote protocol packets supported by us.
97-
static const std::map<const char*, std::function<std::optional<std::string>(std::string_view)>> COMMANDS{
95+
static constexpr std::pair<std::string_view, std::optional<std::string> (*)(std::string_view)> COMMANDS[] = {
9896
{"?", Cmd$_questionMark},
9997
{"g", Cmd$g},
10098
{"G", Cmd$G},
@@ -379,7 +377,7 @@ std::string GDBServer::ProcessPacket(std::string_view data)
379377
DEV_LOG("Processing command '{}'", command.first);
380378

381379
// Invoke command, remove command name from payload.
382-
reply = command.second(packet->substr(strlen(command.first)));
380+
reply = command.second(packet->substr(command.first.size()));
383381
processed = true;
384382
break;
385383
}

0 commit comments

Comments
 (0)