Skip to content

[wip] Implementing debugger in xeus-cpp #354

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

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

kr-2003
Copy link
Contributor

@kr-2003 kr-2003 commented Jun 19, 2025

Description

Please include a summary of changes, motivation and context for this PR.

Fixes # (issue)

Type of change

Please tick all options which are relevant.

  • Bug fix
  • New feature
  • Added/removed dependencies
  • Required documentation updates

@kr-2003 kr-2003 marked this pull request as draft June 19, 2025 15:33
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 122. Check the log or trigger a new build to see more.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 103. Check the log or trigger a new build to see more.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 22.33010% with 80 lines in your changes missing coverage. Please review.

Project coverage is 77.15%. Comparing base (951e670) to head (3c6be4e).

Files with missing lines Patch % Lines
src/xinterpreter.cpp 24.44% 68 Missing ⚠️
src/main.cpp 7.69% 12 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #354      +/-   ##
==========================================
- Coverage   81.78%   77.15%   -4.64%     
==========================================
  Files          20       20              
  Lines         950     1011      +61     
  Branches       87       94       +7     
==========================================
+ Hits          777      780       +3     
- Misses        173      231      +58     
Files with missing lines Coverage Δ
src/main.cpp 47.05% <7.69%> (+6.38%) ⬆️
src/xinterpreter.cpp 66.53% <24.44%> (-23.58%) ⬇️
Files with missing lines Coverage Δ
src/main.cpp 47.05% <7.69%> (+6.38%) ⬆️
src/xinterpreter.cpp 66.53% <24.44%> (-23.58%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 93. Check the log or trigger a new build to see more.

Copy link

@Vipul-Cariappa Vipul-Cariappa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have put some comments. We can discuss this in detail during the meeting today.

CMakeLists.txt Outdated
Comment on lines 568 to 572
if(XEUS_CPP_USE_DEBUGGER)
add_definitions(
-DXEUS_CPP_USE_DEBUGGER
)
endif()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is a good idea. I need to know the purpose.

Comment on lines 66 to 67
std::string m_lldb_port;
std::string m_lldbdap_port;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between m_lldb_port & m_lldbdap_port?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like m_lldbdap_port is unused?

src/main.cpp Outdated
Comment on lines 63 to 68
#ifdef XEUS_CPP_USE_DEBUGGER
nl::json debugger_config;
debugger_config["lldb"]["initCommands"] = {
"settings set plugin.jit-loader.gdb.enable on"
};
#endif

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not look correct. The use of ifdef. Let's discuss it in the meeting.
We need to do this based on the metadata of the kernel.json.

Comment on lines +96 to +102
int fd = open(log_file.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd != -1)
{
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
close(fd);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need some explanation here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is used to run lldb-dap and redirect its output to a file. might be useful for debugging

<< std::endl;
nl::json reply = {
{"type", "response"},
{"request_seq", message["seq"]},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is request_seq and message["seq"]?

Comment on lines 194 to 201
{{"variables",
{{{"name", "a"}, {"value", "100"}, {"type", "int"}, {"evaluateName", "a"}, {"variablesReference", 0}},
{{"name", "b"},
{"value", "1000"},
{"type", "int"},
{"evaluateName", "b"},
{"variablesReference", 0}}}}}}
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that this is not yet implemented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, its the major feature to discuss and work upon

Comment on lines 262 to 270
std::string debugger::get_cell_temporary_file(const std::string& code) const
{
// Placeholder: Return a dummy temporary file path
std::string tmp_file = get_tmp_prefix() + "/cell_tmp.cpp";
std::ofstream out(tmp_file);
out << code;
out.close();
return tmp_file;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully, we don't need this.

Comment on lines 56 to 61
std::string highlight(const std::string& code)
{
// Placeholder: No syntax highlighting implemented
// In a real implementation, use a C++ library (e.g., libclang or a custom highlighter)
return code;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How and where do you plan to use this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

highlighting lines when breakpoint hit, step ins and outs

@@ -330,6 +359,112 @@ __get_cxx_version ()
restore_output();
}

nl::json interpreter::internal_request_impl(const nl::json& content)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i forgot to remove it. i was using previously. no need of this now.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 99. Check the log or trigger a new build to see more.

#include "nlohmann/json.hpp"
#include "xeus-zmq/xdebugger_base.hpp"
#include "xeus_cpp_config.hpp"
#include "xeus-cpp/xinterpreter.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: #includes are not sorted properly [llvm-include-order]

Suggested change
#include "xeus-cpp/xinterpreter.hpp"
#include "xeus-cpp/xinterpreter.hpp"
#include "xeus-zmq/xdebugger_base.hpp"
#include "xeus_cpp_config.hpp"

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;
Copy link
Contributor

Choose a reason for hiding this comment

The 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
virtual std::string get_cell_temporary_file(const std::string& code) const override;
std::string get_cell_temporary_file(const std::string& code) const override;

bool m_tcp_connected;
pid_t jit_process_pid;

using breakpoint_list_t = std::map<std::string, std::vector<nl::json>>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::vector" is directly included [misc-include-cleaner]

include/xeus-cpp/xdebugger.hpp:12:

- #ifdef __GNUC__
+ #include <vector>
+ #ifdef __GNUC__


xcpp::interpreter* m_interpreter;

std::unordered_map<std::string, std::vector<std::string>> m_hash_to_sequential;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::unordered_map" is directly included [misc-include-cleaner]

include/xeus-cpp/xdebugger.hpp:12:

- #ifdef __GNUC__
+ #include <unordered_map>
+ #ifdef __GNUC__

const std::string& user_name,
const std::string& session_id,
const nl::json& debugger_config);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: namespace 'xcpp' not terminated with a closing comment [llvm-namespace-comment]

Suggested change
}
} // namespace xcpp
Additional context

include/xeus-cpp/xdebugger.hpp:27: namespace 'xcpp' starts here

namespace xcpp
          ^

@@ -40,6 +40,18 @@ namespace xcpp
void publish_stdout(const std::string&);
void publish_stderr(const std::string&);

static pid_t get_current_pid();

std::vector<int> get_execution_count(const std::string& code) const
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'get_execution_count' should be marked [[nodiscard]] [modernize-use-nodiscard]

Suggested change
std::vector<int> get_execution_count(const std::string& code) const
[[nodiscard]] std::vector<int> get_execution_count(const std::string& code) const

@@ -85,6 +97,8 @@

xoutput_buffer m_cout_buffer;
xoutput_buffer m_cerr_buffer;

std::map<std::string, std::vector<int>> m_code_to_execution_count_map;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::map" is directly included [misc-include-cleaner]

include/xeus-cpp/xinterpreter.hpp:13:

- #include <memory>
+ #include <map>
+ #include <memory>

#include "xeus-cpp/xeus_cpp_config.hpp"
#include "xeus-cpp/xinterpreter.hpp"
#include "xeus-cpp/xutils.hpp"
#include "xeus-cpp/xdebugger.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: #includes are not sorted properly [llvm-include-order]

Suggested change
#include "xeus-cpp/xdebugger.hpp"
#include "xeus-cpp/xdebugger.hpp"
#include "xeus-cpp/xeus_cpp_config.hpp"
#include "xeus-cpp/xinterpreter.hpp"
#include "xeus-cpp/xutils.hpp"
#include "xeus-zmq/xzmq_context.hpp"
#include <xeus-zmq/xserver_zmq.hpp>
#include <xeus/xhelper.hpp>
#include <xeus/xkernel.hpp>
#include <xeus/xkernel_configuration.hpp>

@@ -62,6 +64,12 @@
auto interpreter = std::make_unique<xcpp::interpreter>(argc, argv);
std::unique_ptr<xeus::xcontext> context = xeus::make_zmq_context();

nl::json debugger_config;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "nlohmann::json" is directly included [misc-include-cleaner]

src/main.cpp:9:

- #include <string>
+ #include <nlohmann/json_fwd.hpp>
+ #include <string>

debugger_config["lldb"]["initCommands"] = {
"settings set plugin.jit-loader.gdb.enable on"
};
debugger_config["interpreter_ptr"] = reinterpret_cast<std::uintptr_t>(interpreter.get());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]

    debugger_config["interpreter_ptr"] = reinterpret_cast<std::uintptr_t>(interpreter.get());
                                         ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 103. Check the log or trigger a new build to see more.

debugger_config["lldb"]["initCommands"] = {
"settings set plugin.jit-loader.gdb.enable on"
};
debugger_config["interpreter_ptr"] = reinterpret_cast<std::uintptr_t>(interpreter.get());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::uintptr_t" is directly included [misc-include-cleaner]

src/main.cpp:8:

- #include <memory>
+ #include <cstdint>
+ #include <memory>

using namespace std::placeholders;

// ***** ONLY FOR DEBUGGING PURPOSES. NOT TO BE COMMITTED *****
static std::ofstream log_stream("/Users/abhinavkumar/Desktop/Coding/CERN_HSF_COMPILER_RESEARCH/xeus-cpp/build/xeus-cpp-logs.log", std::ios::app);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: initializing non-local variable with non-const expression depending on uninitialized non-local variable 'app' [cppcoreguidelines-interfaces-global-init]

static std::ofstream log_stream("/Users/abhinavkumar/Desktop/Coding/CERN_HSF_COMPILER_RESEARCH/xeus-cpp/build/xeus-cpp-logs.log", std::ios::app);
                     ^

using namespace std::placeholders;

// ***** ONLY FOR DEBUGGING PURPOSES. NOT TO BE COMMITTED *****
static std::ofstream log_stream("/Users/abhinavkumar/Desktop/Coding/CERN_HSF_COMPILER_RESEARCH/xeus-cpp/build/xeus-cpp-logs.log", std::ios::app);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'log_stream' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

static std::ofstream log_stream("/Users/abhinavkumar/Desktop/Coding/CERN_HSF_COMPILER_RESEARCH/xeus-cpp/build/xeus-cpp-logs.log", std::ios::app);
                     ^

// ***** ONLY FOR DEBUGGING PURPOSES. NOT TO BE COMMITTED *****
static std::ofstream log_stream("/Users/abhinavkumar/Desktop/Coding/CERN_HSF_COMPILER_RESEARCH/xeus-cpp/build/xeus-cpp-logs.log", std::ios::app);

void log_debug(const std::string& msg) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'log_debug' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]

Suggested change
void log_debug(const std::string& msg) {
static void log_debug(const std::string& msg) {

// ***** ONLY FOR DEBUGGING PURPOSES. NOT TO BE COMMITTED *****
static std::ofstream log_stream("/Users/abhinavkumar/Desktop/Coding/CERN_HSF_COMPILER_RESEARCH/xeus-cpp/build/xeus-cpp-logs.log", std::ios::app);

void log_debug(const std::string& msg) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::string" is directly included [misc-include-cleaner]

src/xdebugger.cpp:9:

- #include <sys/socket.h>
+ #include <string>
+ #include <sys/socket.h>

static std::ofstream log_stream("/Users/abhinavkumar/Desktop/Coding/CERN_HSF_COMPILER_RESEARCH/xeus-cpp/build/xeus-cpp-logs.log", std::ios::app);

void log_debug(const std::string& msg) {
log_stream << "[xeus-cpp] " << msg << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]

Suggested change
log_stream << "[xeus-cpp] " << msg << std::endl;
log_stream << "[xeus-cpp] " << msg << '\n';


namespace xcpp
{
debugger::debugger(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: constructor does not initialize these fields: m_is_running, m_tcp_socket, m_tcp_connected, jit_process_pid, m_copy_to_globals_available [cppcoreguidelines-pro-type-member-init]

include/xeus-cpp/xdebugger.hpp:72:

-         bool m_is_running;
-         int m_tcp_socket;
-         bool m_tcp_connected;
-         pid_t jit_process_pid;
+         bool m_is_running{};
+         int m_tcp_socket{};
+         bool m_tcp_connected{};
+         pid_t jit_process_pid{};

include/xeus-cpp/xdebugger.hpp:85:

-         bool m_copy_to_globals_available;
+         bool m_copy_to_globals_available{};

namespace xcpp
{
debugger::debugger(
xeus::xcontext& context,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "xeus::xcontext" is directly included [misc-include-cleaner]

src/xdebugger.cpp:14:

+ #include <xeus/xeus_context.hpp>

{
debugger::debugger(
xeus::xcontext& context,
const xeus::xconfiguration& config,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "xeus::xconfiguration" is directly included [misc-include-cleaner]

src/xdebugger.cpp:14:

+ #include <xeus/xkernel_configuration.hpp>

const xeus::xconfiguration& config,
const std::string& user_name,
const std::string& session_id,
const nl::json& debugger_config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "nlohmann::json" is directly included [misc-include-cleaner]

src/xdebugger.cpp:9:

- #include <sys/socket.h>
+ #include <nlohmann/json_fwd.hpp>
+ #include <sys/socket.h>

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 93. Check the log or trigger a new build to see more.

const std::string& session_id,
const nl::json& debugger_config
)
: xdebugger_base(context)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "xeus::xdebugger_base" is directly included [misc-include-cleaner]

src/xdebugger.cpp:14:

+ #include <xeus-zmq/xdebugger_base.hpp>

context,
config,
xeus::get_socket_linger(),
xdap_tcp_configuration(xeus::dap_tcp_type::client, xeus::dap_init_type::parallel, user_name, session_id),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "xeus::dap_init_type" is directly included [misc-include-cleaner]

              xdap_tcp_configuration(xeus::dap_tcp_type::client, xeus::dap_init_type::parallel, user_name, session_id),
                                                                       ^

context,
config,
xeus::get_socket_linger(),
xdap_tcp_configuration(xeus::dap_tcp_type::client, xeus::dap_init_type::parallel, user_name, session_id),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "xeus::dap_tcp_type" is directly included [misc-include-cleaner]

src/xdebugger.cpp:14:

+ #include <xeus-zmq/xdap_tcp_client.hpp>

get_event_callback()
))
, m_lldb_host("127.0.0.1")
, m_lldb_port("")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: redundant string initialization [readability-redundant-string-init]

Suggested change
, m_lldb_port("")
,

// Register request handlers
register_request_handler(
"inspectVariables",
std::bind(&debugger::inspect_variables_request, this, _1),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::bind" is directly included [misc-include-cleaner]

src/xdebugger.cpp:7:

- #include <iostream>
+ #include <functional>
+ #include <iostream>

// Register request handlers
register_request_handler(
"inspectVariables",
std::bind(&debugger::inspect_variables_request, this, _1),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::placeholders::_1" is directly included [misc-include-cleaner]

            std::bind(&debugger::inspect_variables_request, this, _1),
                                                                  ^

// Register request handlers
register_request_handler(
"inspectVariables",
std::bind(&debugger::inspect_variables_request, this, _1),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: prefer a lambda to std::bind [modernize-avoid-bind]

Suggested change
std::bind(&debugger::inspect_variables_request, this, _1),
[this](auto && PH1) { return inspect_variables_request(std::forward<decltype(PH1)>(PH1)); },

std::bind(&debugger::inspect_variables_request, this, _1),
false
);
register_request_handler("attach", std::bind(&debugger::attach_request, this, _1), true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: prefer a lambda to std::bind [modernize-avoid-bind]

Suggested change
register_request_handler("attach", std::bind(&debugger::attach_request, this, _1), true);
register_request_handler("attach", [this](auto && PH1) { return attach_request(std::forward<decltype(PH1)>(PH1)); }, true);

register_request_handler("attach", std::bind(&debugger::attach_request, this, _1), true);
register_request_handler(
"configurationDone",
std::bind(&debugger::configuration_done_request, this, _1),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: prefer a lambda to std::bind [modernize-avoid-bind]

Suggested change
std::bind(&debugger::configuration_done_request, this, _1),
[this](auto && PH1) { return configuration_done_request(std::forward<decltype(PH1)>(PH1)); },

std::bind(&debugger::configuration_done_request, this, _1),
true
);
register_request_handler("richInspectVariables", std::bind(&debugger::rich_inspect_variables_request, this, _1), true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: prefer a lambda to std::bind [modernize-avoid-bind]

Suggested change
register_request_handler("richInspectVariables", std::bind(&debugger::rich_inspect_variables_request, this, _1), true);
register_request_handler("richInspectVariables", [this](auto && PH1) { return rich_inspect_variables_request(std::forward<decltype(PH1)>(PH1)); }, true);

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 102. Check the log or trigger a new build to see more.

@@ -25,6 +25,8 @@
#include "xbuffer.hpp"
#include "xeus_cpp_config.hpp"
#include "xmanager.hpp"
#include <thread>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header thread is not used directly [misc-include-cleaner]

Suggested change

return {};
}

std::string get_code_from_execution_count(int execution_count) const
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'get_code_from_execution_count' should be marked [[nodiscard]] [modernize-use-nodiscard]

Suggested change
std::string get_code_from_execution_count(int execution_count) const
[[nodiscard]] std::string get_code_from_execution_count(int execution_count) const

#include "xeus-cpp/xeus_cpp_config.hpp"
#include "xeus-cpp/xinterpreter.hpp"
#include "xeus-cpp/xutils.hpp"
#include "xeus-cpp/xdebugger.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: #includes are not sorted properly [llvm-include-order]

Suggested change
#include "xeus-cpp/xdebugger.hpp"
#include "xeus-cpp/xdebugger.hpp"
#include "xeus-cpp/xeus_cpp_config.hpp"
#include "xeus-cpp/xinterpreter.hpp"
#include "xeus-cpp/xutils.hpp"
#include "xeus-zmq/xserver_zmq_split.hpp"
#include "xeus-zmq/xzmq_context.hpp"
#include <xeus-zmq/xserver_zmq.hpp>
#include <xeus/xhelper.hpp>
#include <xeus/xkernel.hpp>
#include <xeus/xkernel_configuration.hpp>


namespace xcpp
{
debugger::debugger(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: constructor does not initialize these fields: m_is_running, m_tcp_socket, m_tcp_connected, jit_process_pid, m_copy_to_globals_available [cppcoreguidelines-pro-type-member-init]

include/xeus-cpp/xdebugger.hpp:76:

-         bool m_is_running;
-         int m_tcp_socket;
-         bool m_tcp_connected;
-         pid_t jit_process_pid;
+         bool m_is_running{};
+         int m_tcp_socket{};
+         bool m_tcp_connected{};
+         pid_t jit_process_pid{};

include/xeus-cpp/xdebugger.hpp:89:

-         bool m_copy_to_globals_available;
+         bool m_copy_to_globals_available{};

true
);
register_request_handler("richInspectVariables", std::bind(&debugger::rich_inspect_variables_request, this, _1), true);
register_request_handler("setBreakpoints", std::bind(&debugger::set_breakpoints_request, this, _1), true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: prefer a lambda to std::bind [modernize-avoid-bind]

Suggested change
register_request_handler("setBreakpoints", std::bind(&debugger::set_breakpoints_request, this, _1), true);
register_request_handler("setBreakpoints", [this](auto && PH1) { return set_breakpoints_request(std::forward<decltype(PH1)>(PH1)); }, true);

);
register_request_handler("richInspectVariables", std::bind(&debugger::rich_inspect_variables_request, this, _1), true);
register_request_handler("setBreakpoints", std::bind(&debugger::set_breakpoints_request, this, _1), true);
register_request_handler("dumpCell", std::bind(&debugger::dump_cell_request, this, _1), true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: prefer a lambda to std::bind [modernize-avoid-bind]

Suggested change
register_request_handler("dumpCell", std::bind(&debugger::dump_cell_request, this, _1), true);
register_request_handler("dumpCell", [this](auto && PH1) { return dump_cell_request(std::forward<decltype(PH1)>(PH1)); }, true);

register_request_handler("richInspectVariables", std::bind(&debugger::rich_inspect_variables_request, this, _1), true);
register_request_handler("setBreakpoints", std::bind(&debugger::set_breakpoints_request, this, _1), true);
register_request_handler("dumpCell", std::bind(&debugger::dump_cell_request, this, _1), true);
register_request_handler("copyToGlobals", std::bind(&debugger::copy_to_globals_request, this, _1), true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: prefer a lambda to std::bind [modernize-avoid-bind]

Suggested change
register_request_handler("copyToGlobals", std::bind(&debugger::copy_to_globals_request, this, _1), true);
register_request_handler("copyToGlobals", [this](auto && PH1) { return copy_to_globals_request(std::forward<decltype(PH1)>(PH1)); }, true);

register_request_handler("setBreakpoints", std::bind(&debugger::set_breakpoints_request, this, _1), true);
register_request_handler("dumpCell", std::bind(&debugger::dump_cell_request, this, _1), true);
register_request_handler("copyToGlobals", std::bind(&debugger::copy_to_globals_request, this, _1), true);
register_request_handler("stackTrace", std::bind(&debugger::stack_trace_request, this, _1), true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: prefer a lambda to std::bind [modernize-avoid-bind]

Suggested change
register_request_handler("stackTrace", std::bind(&debugger::stack_trace_request, this, _1), true);
register_request_handler("stackTrace", [this](auto && PH1) { return stack_trace_request(std::forward<decltype(PH1)>(PH1)); }, true);

register_request_handler("dumpCell", std::bind(&debugger::dump_cell_request, this, _1), true);
register_request_handler("copyToGlobals", std::bind(&debugger::copy_to_globals_request, this, _1), true);
register_request_handler("stackTrace", std::bind(&debugger::stack_trace_request, this, _1), true);
register_request_handler("source", std::bind(&debugger::source_request, this, _1), true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: prefer a lambda to std::bind [modernize-avoid-bind]

Suggested change
register_request_handler("source", std::bind(&debugger::source_request, this, _1), true);
register_request_handler("source", [this](auto && PH1) { return source_request(std::forward<decltype(PH1)>(PH1)); }, true);

register_request_handler("stackTrace", std::bind(&debugger::stack_trace_request, this, _1), true);
register_request_handler("source", std::bind(&debugger::source_request, this, _1), true);

m_interpreter = reinterpret_cast<xcpp::interpreter*>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]

        m_interpreter = reinterpret_cast<xcpp::interpreter*>(
                        ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants