From 038b07e7cdcbdea2b30bcea7b18db74f5fcc715d Mon Sep 17 00:00:00 2001 From: kr-2003 Date: Sat, 22 Mar 2025 15:54:20 +0530 Subject: [PATCH] added base files --- CMakeLists.txt | 2 + include/xeus-cpp/xdebugger.hpp | 52 +++++++++++++++++++++++++ src/xdebugger.cpp | 70 ++++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 include/xeus-cpp/xdebugger.hpp create mode 100644 src/xdebugger.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 25e22a5f..3181c88d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,6 +201,7 @@ set(XEUS_CPP_HEADERS include/xeus-cpp/xmagics.hpp include/xeus-cpp/xoptions.hpp include/xeus-cpp/xpreamble.hpp + include/xeus-cpp/xdebugger.hpp #src/xinspect.hpp #src/xsystem.hpp #src/xparser.hpp @@ -215,6 +216,7 @@ set(XEUS_CPP_SRC src/xparser.cpp src/xutils.cpp src/xmagics/os.cpp + src/xdebugger.cpp ) if(NOT EMSCRIPTEN) diff --git a/include/xeus-cpp/xdebugger.hpp b/include/xeus-cpp/xdebugger.hpp new file mode 100644 index 00000000..40d86907 --- /dev/null +++ b/include/xeus-cpp/xdebugger.hpp @@ -0,0 +1,52 @@ +/************************************************************************************ + * Copyright (c) 2023, xeus-cpp contributors * + * Copyright (c) 2023, Johan Mabille, Loic Gouarin, Sylvain Corlay, Wolf Vollprecht * + * * + * Distributed under the terms of the BSD 3-Clause License. * + * * + * The full license is in the file LICENSE, distributed with this software. * + ************************************************************************************/ + + +#ifndef XEUS_CPP_DEBUGGER_HPP +#define XEUS_CPP_DEBUGGER_HPP + +#include +#include +#include + +#include "xeus_cpp_config.hpp" +#include +#include "xeus-zmq/xdebugger_base.hpp" + +namespace nl = nlohmann; + +namespace xcpp +{ + class xllDB_dap_client; + + class XEUS_CPP_API debugger : public xeus::xdebugger_base + { + public: + debugger(xeus::xcontext& context, const xeus::xconfiguration& config, + const std::string& user_name, const std::string& session_id, + const nl::json& lldb_config); + + virtual ~debugger(); + + private: + bool start() override; + void stop() override; + xeus::xdebugger_info get_debugger_info() const override; + std::string get_cell_temporary_file(const std::string& code) const override; + + private: + xllDB_dap_client* p_lldb_dap_client; + std::string m_lldb_host{"localhost"}; + std::string m_lldb_port{"12345"}; + nl::json m_lldb_config; + }; + std::unique_ptr make_cpp_debugger(...); +} + +#endif diff --git a/src/xdebugger.cpp b/src/xdebugger.cpp new file mode 100644 index 00000000..954fb7f8 --- /dev/null +++ b/src/xdebugger.cpp @@ -0,0 +1,70 @@ +/************************************************************************************ + * Copyright (c) 2023, xeus-cpp contributors * + * Copyright (c) 2023, Johan Mabille, Loic Gouarin, Sylvain Corlay, Wolf Vollprecht * + * * + * Distributed under the terms of the BSD 3-Clause License. * + * * + * The full license is in the file LICENSE, distributed with this software. * + ************************************************************************************/ + + +#include "xeus-cpp/xdebugger.hpp" +#include "xeus-zmq/xmiddleware.hpp" +#include "xeus/xinterpreter.hpp" +#include "xeus/xsystem.hpp" +#include "xeus-zmq/xmiddleware.hpp" + +namespace xcpp +{ + debugger::debugger(xeus::xcontext& context, const xeus::xconfiguration& config, + const std::string& user_name, const std::string& session_id, + const nl::json& lldb_config) + : xdebugger_base(context) + , p_lldb_dap_client(nullptr) + , m_lldb_host("localhost") + , m_lldb_port("12345") + , m_lldb_config(lldb_config) + { + } + + debugger::~debugger() + { + // delete p_lldb_dap_client; + // p_lldb_dap_client = nullptr; + } + + bool debugger::start() + { + return true; + } + + void debugger::stop() + { + return; + } + + xeus::xdebugger_info debugger::get_debugger_info() const + { + // return temporary values + return xeus::xdebugger_info(1, + "temp_prefix", + "temp_suffix", + true, + {"Temporary Exceptions"}, + true); + } + + std::string debugger::get_cell_temporary_file(const std::string& code) const + { + return ""; + } + + std::unique_ptr make_cpp_debugger(xeus::xcontext& context, + const xeus::xconfiguration& config, + const std::string& user_name, + const std::string& session_id, + const nl::json& lldb_config) + { + return std::unique_ptr(new debugger(context, config, user_name, session_id, lldb_config)); + } +} \ No newline at end of file