-
Notifications
You must be signed in to change notification settings - Fork 36
[GSoC 2025] Setup: Debugger Headers & Out-of-Process Kernel #365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,121 @@ | ||||||
/************************************************************************************ | ||||||
* Copyright (c) 2023, xeus-cpp contributors * | ||||||
* * | ||||||
* 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 | ||||||
|
||||||
#ifdef __GNUC__ | ||||||
#pragma GCC diagnostic push | ||||||
#pragma GCC diagnostic ignored "-Wattributes" | ||||||
#endif | ||||||
|
||||||
#include <map> | ||||||
#include <mutex> | ||||||
#include <set> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: included header mutex is not used directly [misc-include-cleaner]
Suggested change
|
||||||
#include <string> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: included header set is not used directly [misc-include-cleaner]
Suggested change
|
||||||
|
||||||
#include "nlohmann/json.hpp" | ||||||
#include "xeus-cpp/xinterpreter.hpp" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: included header json.hpp is not used directly [misc-include-cleaner]
Suggested change
|
||||||
#include "xeus-zmq/xdebugger_base.hpp" | ||||||
#include "xeus_cpp_config.hpp" | ||||||
|
||||||
namespace xcpp | ||||||
{ | ||||||
class xdebuglldb_client; | ||||||
|
||||||
class XEUS_CPP_API debugger : public xeus::xdebugger_base | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: class 'debugger' defines a destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions] class XEUS_CPP_API debugger : public xeus::xdebugger_base
^ |
||||||
{ | ||||||
public: | ||||||
|
||||||
using base_type = xeus::xdebugger_base; | ||||||
|
||||||
debugger( | ||||||
xeus::xcontext& context, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "xeus::xcontext" is directly included [misc-include-cleaner] include/xeus-cpp/xdebugger.hpp:11: - #ifdef __GNUC__
+ #include <xeus/xeus_context.hpp>
+ #ifdef __GNUC__ |
||||||
const xeus::xconfiguration& config, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "xeus::xconfiguration" is directly included [misc-include-cleaner] include/xeus-cpp/xdebugger.hpp:11: - #ifdef __GNUC__
+ #include <xeus/xkernel_configuration.hpp>
+ #ifdef __GNUC__ |
||||||
const std::string& user_name, | ||||||
const std::string& session_id, | ||||||
const nl::json& debugger_config | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "nlohmann::json" is directly included [misc-include-cleaner] include/xeus-cpp/xdebugger.hpp:11: - #ifdef __GNUC__
+ #include <nlohmann/json_fwd.hpp>
+ #ifdef __GNUC__ |
||||||
); | ||||||
|
||||||
virtual ~debugger(); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [cppcoreguidelines-explicit-virtual-functions]
Suggested change
|
||||||
|
||||||
private: | ||||||
|
||||||
nl::json inspect_variables_request(const nl::json& message); | ||||||
nl::json stack_trace_request(const nl::json& message); | ||||||
nl::json attach_request(const nl::json& message); | ||||||
nl::json configuration_done_request(const nl::json& message); | ||||||
nl::json set_breakpoints_request(const nl::json& message); | ||||||
nl::json dump_cell_request(const nl::json& message); | ||||||
nl::json rich_inspect_variables_request(const nl::json& message); | ||||||
nl::json copy_to_globals_request(const nl::json& message); | ||||||
nl::json source_request(const nl::json& message); | ||||||
|
||||||
bool get_variable_info_from_lldb( | ||||||
const std::string& var_name, | ||||||
int frame_id, | ||||||
nl::json& data, | ||||||
nl::json& metadata, | ||||||
int sequence | ||||||
); | ||||||
void get_container_info( | ||||||
const std::string& var_name, | ||||||
int frame_id, | ||||||
const std::string& var_type, | ||||||
nl::json& data, | ||||||
nl::json& metadata, | ||||||
int sequence, | ||||||
int size | ||||||
); | ||||||
bool is_container_type(const std::string& type) const; | ||||||
|
||||||
bool start_lldb(); | ||||||
bool start() override; | ||||||
void stop() override; | ||||||
xeus::xdebugger_info get_debugger_info() const override; | ||||||
virtual std::string get_cell_temporary_file(const std::string& code) const override; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: 'virtual' is redundant since the function is already declared 'override' [cppcoreguidelines-explicit-virtual-functions]
Suggested change
|
||||||
|
||||||
bool connect_to_lldb_tcp(); | ||||||
std::string send_dap_message(const nl::json& message); | ||||||
std::string receive_dap_response(); | ||||||
|
||||||
xdebuglldb_client* p_debuglldb_client; | ||||||
std::string m_lldb_host; | ||||||
std::string m_lldb_port; | ||||||
nl::json m_debugger_config; | ||||||
bool m_is_running; | ||||||
int m_tcp_socket; | ||||||
bool m_tcp_connected; | ||||||
pid_t jit_process_pid; | ||||||
|
||||||
using breakpoint_list_t = std::map<std::string, std::vector<nl::json>>; | ||||||
breakpoint_list_t m_breakpoint_list; | ||||||
|
||||||
xcpp::interpreter* m_interpreter; | ||||||
|
||||||
std::unordered_map<std::string, std::vector<std::string>> m_hash_to_sequential; | ||||||
std::unordered_map<std::string, std::string> m_sequential_to_hash; | ||||||
|
||||||
bool m_copy_to_globals_available; | ||||||
}; | ||||||
|
||||||
XEUS_CPP_API | ||||||
std::unique_ptr<xeus::xdebugger> make_cpp_debugger( | ||||||
xeus::xcontext& context, | ||||||
const xeus::xconfiguration& config, | ||||||
const std::string& user_name, | ||||||
const std::string& session_id, | ||||||
const nl::json& debugger_config | ||||||
); | ||||||
} | ||||||
|
||||||
#ifdef __GNUC__ | ||||||
#pragma GCC diagnostic pop | ||||||
#endif | ||||||
|
||||||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"display_name": "C++17-Debugger", | ||
"env": { | ||
"PATH":"@XEUS_CPP_PATH@", | ||
"LD_LIBRARY_PATH":"@XEUS_CPP_LD_LIBRARY_PATH@" | ||
}, | ||
"argv": [ | ||
"@XEUS_CPP_KERNELSPEC_PATH@xcpp", | ||
"-f", | ||
"{connection_file}", | ||
"-g", | ||
"-O0", | ||
"--use-oop-jit", | ||
"-resource-dir", "@XEUS_CPP_RESOURCE_DIR@", | ||
"-I", "@XEUS_CPP_INCLUDE_DIR@", | ||
"-std=c++17" | ||
], | ||
"language": "cpp", | ||
"metadata": {"debugger": true | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"display_name": "C++20-Debugger", | ||
"env": { | ||
"PATH":"@XEUS_CPP_PATH@", | ||
"LD_LIBRARY_PATH":"@XEUS_CPP_LD_LIBRARY_PATH@" | ||
}, | ||
"argv": [ | ||
"@XEUS_CPP_KERNELSPEC_PATH@xcpp", | ||
"-f", | ||
"{connection_file}", | ||
"-g", | ||
"-O0", | ||
"--use-oop-jit", | ||
"-resource-dir", "@XEUS_CPP_RESOURCE_DIR@", | ||
"-I", "@XEUS_CPP_INCLUDE_DIR@", | ||
"-std=c++20" | ||
], | ||
"language": "cpp", | ||
"metadata": {"debugger": true | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"display_name": "C++23-Debugger", | ||
"env": { | ||
"PATH":"@XEUS_CPP_PATH@", | ||
"LD_LIBRARY_PATH":"@XEUS_CPP_LD_LIBRARY_PATH@" | ||
}, | ||
"argv": [ | ||
"@XEUS_CPP_KERNELSPEC_PATH@xcpp", | ||
"-f", | ||
"{connection_file}", | ||
"-g", | ||
"-O0", | ||
"--use-oop-jit", | ||
"-resource-dir", "@XEUS_CPP_RESOURCE_DIR@", | ||
"-I", "@XEUS_CPP_INCLUDE_DIR@", | ||
"-std=c++23" | ||
], | ||
"language": "cpp", | ||
"metadata": {"debugger": true | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: header guard does not follow preferred style [llvm-header-guard]