Browse Source

add Boost 1.70 dependency

develop
Eyck Jentzsch 1 month ago
parent
commit
c9e4efcba2
5 changed files with 19 additions and 11 deletions
  1. +4
    -1
      CMakeLists.txt
  2. +3
    -1
      incl/iss/debugger/gdb_session.h
  3. +2
    -1
      incl/iss/debugger/serialized_connection.h
  4. +9
    -7
      incl/iss/debugger/server.h
  5. +1
    -1
      src/gdb_session.cpp

+ 4
- 1
CMakeLists.txt View File

@ -4,7 +4,9 @@ project("dbt-core" VERSION 1.0.0)
include(GNUInstallDirs)
find_package(Boost COMPONENTS thread REQUIRED)
set(Boost_NO_BOOST_CMAKE ON) # Don't do a find_package in config mode before searching for a regular boost install.
set(BOOST_ROOT ${CONAN_BOOST_ROOT})
find_package(Boost 1.70 COMPONENTS thread REQUIRED)
if(WITH_LLVM)
if(DEFINED ENV{LLVM_HOME})
@ -32,6 +34,7 @@ if(WITH_LLVM)
target_include_directories(dbt-core PRIVATE ${LLVM_INCLUDE_DIRS})
endif()
target_include_directories(dbt-core PUBLIC ${PROJECT_SOURCE_DIR}/incl)
target_include_directories(dbt-core PUBLIC ${Boost_INCLUDE_DIRS})
target_link_libraries(dbt-core PRIVATE scc-util)
target_link_libraries(dbt-core PUBLIC CONAN_PKG::tcc CONAN_PKG::fmt ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
set_target_properties(dbt-core PROPERTIES

+ 3
- 1
incl/iss/debugger/gdb_session.h View File

@ -36,12 +36,14 @@
#define _GDB_SESSION_H_
#include <boost/asio.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/bind.hpp>
#include <chrono>
#include <cstdlib>
#include <iostream>
#include <iss/debugger/serialized_connection.h>
#include <thread>
#include <functional>
#include "cmdhandler.h"
#include "serialized_connection.h"
@ -55,7 +57,7 @@ using boost::asio::ip::tcp;
class gdb_session : public connection<std::string, std::string>::async_listener {
public:
gdb_session(server_if *server_, boost::asio::io_service &io_service);
gdb_session(server_if *server_, boost::asio::io_context &io_service);
virtual ~gdb_session() = default;

+ 2
- 1
incl/iss/debugger/serialized_connection.h View File

@ -36,6 +36,7 @@
#define _SERIALIZED_CONNECTION_H_
#include <boost/asio.hpp>
#include <boost/asio/io_context.hpp>
#ifdef USE_TEXT
#include <boost/archive/text_iarchive.hpp>
@ -286,7 +287,7 @@ public:
virtual bool message_completed(std::vector<char> &buffer) { return true; };
};
/// Constructor.
connection(boost::asio::io_service &io_service)
connection(boost::asio::io_context &io_service)
: socket_(io_service) {}
/// Get the underlying socket. Used for making a connection or for accepting
/// an incoming connection.

+ 9
- 7
incl/iss/debugger/server.h View File

@ -37,6 +37,7 @@
#include "server_base.h"
#include <boost/asio.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/thread.hpp>
#include <sys/time.h>
#include <util/logging.h>
@ -79,7 +80,7 @@ protected:
, acceptor(io_service, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port)) {
// Create a pool of threads to run all of the io_services.
std::size_t thread_pool_size_ = 2;
work_ctrl = new boost::asio::io_service::work(io_service);
work_ctrl = new boost::asio::io_context::work(io_service);
boost::thread::hardware_concurrency();
for (std::size_t i = 0; i < thread_pool_size_; ++i) {
threads.create_thread([this]() -> void { io_service.run(); });
@ -88,21 +89,22 @@ protected:
};
void createNewSession() {
boost::shared_ptr<SESSION> new_session(new SESSION(this, acceptor.get_io_service()));
acceptor.async_accept(new_session->socket(), boost::bind(&server<SESSION>::handle_accept, this,
boost::asio::placeholders::error, new_session));
boost::shared_ptr<SESSION> new_session(new SESSION(this, io_service));
acceptor.async_accept(new_session->socket(),
boost::bind(&server<SESSION>::handle_accept, this, new_session,
boost::asio::placeholders::error));
}
void shutDown() {
// request shutdown of simulation
server_base::shutdown();
// stop the io acceptor
acceptor.get_io_service().stop();
io_service.stop();
}
private:
/// Handle completion of a accept operation by starting a session.
void handle_accept(const boost::system::error_code &e, boost::shared_ptr<SESSION> session) {
void handle_accept(boost::shared_ptr<SESSION> session, const boost::system::error_code &e) {
if (!e) {
// Start an accept operation for a new connection. If it finishes create a
// new session
@ -115,7 +117,7 @@ private:
}
}
// server related members
boost::asio::io_service io_service;
boost::asio::io_context io_service;
boost::asio::io_service::work *work_ctrl;
boost::asio::ip::tcp::acceptor acceptor;
boost::thread_group threads;

+ 1
- 1
src/gdb_session.cpp View File

@ -120,7 +120,7 @@ protected:
const char start_char = '$';
};
gdb_session::gdb_session(server_if *server_, boost::asio::io_service &io_service)
gdb_session::gdb_session(server_if *server_, boost::asio::io_context &io_service)
: stop_callback([this](unsigned handle) {
gdb_resp_msg resp;
resp << (handle > 0 ? "S05" : "S02");

Loading…
Cancel
Save