fix: c++ function signature in extern C

This commit is contained in:
xinyangli 2024-08-13 19:20:50 +08:00
parent b96a280e10
commit 810178e3f2
Signed by: xin
SSH key fingerprint: SHA256:qZ/tzd8lYRtUFSrfBDBMcUqV4GHKxqeqRA3huItgvbk

View file

@ -1,4 +1,3 @@
#include "api.hpp"
#include <CLI/App.hpp> #include <CLI/App.hpp>
#include <CLI/Error.hpp> #include <CLI/Error.hpp>
#include <cstring> #include <cstring>
@ -7,7 +6,19 @@
#include <sstream> #include <sstream>
extern "C" { extern "C" {
#include <gdbstub.h> #include <gdbstub.h>
}
static std::vector<std::string> split_into_args(const std::string &command) {
std::istringstream iss(command);
std::vector<std::string> args;
std::string token;
while (iss >> token) {
args.push_back(token);
}
return args;
}
extern "C" {
static void difftest_cont(void *args, gdb_action_t *res) { static void difftest_cont(void *args, gdb_action_t *res) {
Difftest *diff = (Difftest *)args; Difftest *diff = (Difftest *)args;
*res = diff->cont(); *res = diff->cont();
@ -54,16 +65,6 @@ static void difftest_on_interrupt(void *args) {
diff->halt(); diff->halt();
} }
std::vector<std::string> split_into_args(const std::string &command) {
std::istringstream iss(command);
std::vector<std::string> args;
std::string token;
while (iss >> token) {
args.push_back(token);
}
return args;
}
static char *gdbstub_monitor(void *args, const char *s) { static char *gdbstub_monitor(void *args, const char *s) {
Difftest *diff = (Difftest *)args; Difftest *diff = (Difftest *)args;
spdlog::trace("monitor"); spdlog::trace("monitor");