From 810178e3f22f0f42844842b71931364d45682d59 Mon Sep 17 00:00:00 2001 From: xinyangli Date: Tue, 13 Aug 2024 19:20:50 +0800 Subject: [PATCH] fix: c++ function signature in extern C --- src/gdbstub.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/gdbstub.cpp b/src/gdbstub.cpp index 4bb585c..2f62a60 100644 --- a/src/gdbstub.cpp +++ b/src/gdbstub.cpp @@ -1,4 +1,3 @@ -#include "api.hpp" #include #include #include @@ -7,7 +6,19 @@ #include extern "C" { #include +} +static std::vector split_into_args(const std::string &command) { + std::istringstream iss(command); + std::vector 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) { Difftest *diff = (Difftest *)args; *res = diff->cont(); @@ -54,16 +65,6 @@ static void difftest_on_interrupt(void *args) { diff->halt(); } -std::vector split_into_args(const std::string &command) { - std::istringstream iss(command); - std::vector args; - std::string token; - while (iss >> token) { - args.push_back(token); - } - return args; -} - static char *gdbstub_monitor(void *args, const char *s) { Difftest *diff = (Difftest *)args; spdlog::trace("monitor");