-
Notifications
You must be signed in to change notification settings - Fork 0
GSOC Debugger #2
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?
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Can't recieve multiple responses from lldb-dap. |
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.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 98. Check the log or trigger a new build to see more.
// Register request handlers | ||
register_request_handler( | ||
"inspectVariables", | ||
std::bind(&debugger::inspect_variables_request, this, _1), |
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: 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), |
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: prefer a lambda to std::bind [modernize-avoid-bind]
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("stackTrace", std::bind(&debugger::stack_trace_request, this, _1), false); |
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: prefer a lambda to std::bind [modernize-avoid-bind]
register_request_handler("stackTrace", std::bind(&debugger::stack_trace_request, this, _1), false); | |
register_request_handler("stackTrace", [this](auto && PH1) { return stack_trace_request(std::forward<decltype(PH1)>(PH1)); }, false); |
false | ||
); | ||
register_request_handler("stackTrace", std::bind(&debugger::stack_trace_request, this, _1), false); | ||
register_request_handler("attach", std::bind(&debugger::attach_request, this, _1), 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: prefer a lambda to std::bind [modernize-avoid-bind]
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), |
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: prefer a lambda to std::bind [modernize-avoid-bind]
std::bind(&debugger::configuration_done_request, this, _1), | |
[this](auto && PH1) { return configuration_done_request(std::forward<decltype(PH1)>(PH1)); }, |
true | ||
); | ||
|
||
std::cout << "Debugger initialized with config: " << m_debugger_config.dump() << std::endl; |
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: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]
std::cout << "Debugger initialized with config: " << m_debugger_config.dump() << std::endl; | |
std::cout << "Debugger initialized with config: " << m_debugger_config.dump() << '\n'; |
|
||
debugger::~debugger() | ||
{ | ||
std::cout << "Stopping debugger..........." << std::endl; |
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: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]
std::cout << "Stopping debugger..........." << std::endl; | |
std::cout << "Stopping debugger..........." << '\n'; |
m_lldb_port = xeus::find_free_port(100, 9999, 10099); | ||
if (m_lldb_port.empty()) | ||
{ | ||
std::cout << "Failed to find a free port for LLDB-DAP" << std::endl; |
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: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]
std::cout << "Failed to find a free port for LLDB-DAP" << std::endl; | |
std::cout << "Failed to find a free port for LLDB-DAP" << '\n'; |
if (std::getenv("XEUS_LOG") != nullptr) | ||
{ | ||
std::ofstream out("xeus.log", std::ios_base::app); | ||
out << "===== DEBUGGER CONFIG =====" << std::endl; |
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: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]
out << "===== DEBUGGER CONFIG =====" << std::endl; | |
out << "===== DEBUGGER CONFIG =====" << '\n'; |
{ | ||
std::ofstream out("xeus.log", std::ios_base::app); | ||
out << "===== DEBUGGER CONFIG =====" << std::endl; | ||
out << m_debugger_config.dump() << std::endl; |
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: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]
out << m_debugger_config.dump() << std::endl; | |
out << m_debugger_config.dump() << '\n'; |
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.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 96. Check the log or trigger a new build to see more.
#include "xeus-cpp/xdebugger.hpp" | ||
|
||
#include <arpa/inet.h> // For inet_pton(), htons() | ||
#include <chrono> // For std::chrono (used in sleep_for) |
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: included header inet.h is not used directly [misc-include-cleaner]
#include <chrono> // For std::chrono (used in sleep_for) | |
#include <chrono> // For std::chrono (used in sleep_for) |
|
||
#include <arpa/inet.h> // For inet_pton(), htons() | ||
#include <chrono> // For std::chrono (used in sleep_for) | ||
#include <cstdlib> |
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: included header chrono is not used directly [misc-include-cleaner]
#include <cstdlib> | |
#include <cstdlib> |
#include <chrono> // For std::chrono (used in sleep_for) | ||
#include <cstdlib> | ||
#include <fcntl.h> | ||
#include <fstream> |
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: included header fcntl.h is not used directly [misc-include-cleaner]
#include <fstream> | |
#include <fstream> |
#include <fstream> | ||
#include <iostream> | ||
#include <netinet/in.h> // For sockaddr_in, AF_INET | ||
#include <sys/socket.h> // For socket(), connect(), send(), recv() |
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: included header in.h is not used directly [misc-include-cleaner]
#include <sys/socket.h> // For socket(), connect(), send(), recv() | |
#include <sys/socket.h> // For socket(), connect(), send(), recv() |
#include <iostream> | ||
#include <netinet/in.h> // For sockaddr_in, AF_INET | ||
#include <sys/socket.h> // For socket(), connect(), send(), recv() | ||
#include <sys/types.h> |
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: included header socket.h is not used directly [misc-include-cleaner]
#include <sys/types.h> | |
#include <sys/types.h> |
#include <sys/socket.h> // For socket(), connect(), send(), recv() | ||
#include <sys/types.h> | ||
#include <sys/wait.h> | ||
#include <thread> |
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: included header wait.h is not used directly [misc-include-cleaner]
#include <thread> | |
#include <thread> |
#include <sys/wait.h> | ||
#include <thread> | ||
#include <unistd.h> | ||
|
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: included header unistd.h is not used directly [misc-include-cleaner]
|
||
namespace xcpp | ||
{ | ||
debugger::debugger( |
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: constructor does not initialize these fields: m_tcp_socket, m_tcp_connected [cppcoreguidelines-pro-type-member-init]
include/xeus-cpp/xdebugger.hpp:69:
- int m_tcp_socket;
- bool m_tcp_connected;
+ int m_tcp_socket{};
+ bool m_tcp_connected{};
namespace xcpp | ||
{ | ||
debugger::debugger( | ||
xeus::xcontext& context, |
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: 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, |
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: no header providing "xeus::xconfiguration" is directly included [misc-include-cleaner]
src/xdebugger.cpp:14:
+ #include <xeus/xkernel_configuration.hpp>
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.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 85. Check the log or trigger a new build to see more.
debugger::debugger( | ||
xeus::xcontext& context, | ||
const xeus::xconfiguration& config, | ||
const std::string& user_name, |
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: no header providing "std::string" is directly included [misc-include-cleaner]
src/xdebugger.cpp:9:
- #include <sys/socket.h> // For socket(), connect(), send(), recv()
+ #include <string>
+ #include <sys/socket.h> // For socket(), connect(), send(), recv()
const xeus::xconfiguration& config, | ||
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 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> // For socket(), connect(), send(), recv()
+ #include <nlohmann/json_fwd.hpp>
+ #include <sys/socket.h> // For socket(), connect(), send(), recv()
const xeus::xconfiguration& config, | ||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
warning: pass by value and use std::move [modernize-pass-by-value]
src/xdebugger.cpp:13:
- #include <unistd.h>
+ #include <utility>
+ #include <unistd.h>
const nl::json& debugger_config | |
nl::json debugger_config |
src/xdebugger.cpp:42:
- , m_debugger_config(debugger_config)
+ , m_debugger_config(std::move(debugger_config))
include/xeus-cpp/xdebugger.hpp:40:
- const nl::json& debugger_config);
+ nl::json debugger_config);
const std::string& session_id, | ||
const nl::json& debugger_config | ||
) | ||
: xdebugger_base(context) |
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: 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), |
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: no header providing "xeus::dap_tcp_type" is directly included [misc-include-cleaner]
src/xdebugger.cpp:14:
+ #include <xeus-zmq/xdap_tcp_client.hpp>
// Register request handlers | ||
register_request_handler( | ||
"inspectVariables", | ||
std::bind(&debugger::inspect_variables_request, this, _1), |
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: no header providing "std::bind" is directly included [misc-include-cleaner]
src/xdebugger.cpp:7:
- #include <iostream>
+ #include <functional>
+ #include <iostream>
|
||
bool debugger::start_lldb() | ||
{ | ||
std::cout << "debugger::start_lldb" << std::endl; |
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: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]
std::cout << "debugger::start_lldb" << std::endl; | |
std::cout << "debugger::start_lldb" << '\n'; |
code += "int main() {\n"; | ||
|
||
// Construct LLDB-DAP command arguments | ||
code += " vector<string> lldb_args = {\"lldb-dap\", \"--port\", \"" + m_lldb_port + "\"};\n"; |
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: escaped string literal can be written as a raw string literal [modernize-raw-string-literal]
code += " vector<string> lldb_args = {\"lldb-dap\", \"--port\", \"" + m_lldb_port + "\"};\n"; | |
code += R"( vector<string> lldb_args = {"lldb-dap", "--port", ")" + m_lldb_port + "\"};\n"; |
{ | ||
if (it->contains("initCommands")) | ||
{ | ||
std::cout << "Adding init commands to lldb-dap command" << std::endl; |
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: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]
std::cout << "Adding init commands to lldb-dap command" << std::endl; | |
std::cout << "Adding init commands to lldb-dap command" << '\n'; |
if (it->contains("initCommands")) | ||
{ | ||
std::cout << "Adding init commands to lldb-dap command" << std::endl; | ||
for (const auto& cmd : it->at("initCommands").get<std::vector<std::string>>()) |
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: no header providing "std::vector" is directly included [misc-include-cleaner]
src/xdebugger.cpp:14:
+ #include <vector>
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.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 227. Check the log or trigger a new build to see more.
@@ -0,0 +1,147 @@ | |||
#pragma once |
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 is missing header guard [llvm-header-guard]
#pragma once | |
#ifndef XEUS_CPP_XSHARED_MEMORY_HPP | |
#define XEUS_CPP_XSHARED_MEMORY_HPP | |
#pragma once |
include/xeus-cpp/xshared_memory.hpp:-1:
+
+ #endif
@@ -0,0 +1,147 @@ | |||
#pragma once | |||
|
|||
#include <string> |
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: #includes are not sorted properly [llvm-include-order]
#include <string> | |
#include <atomic> |
include/xeus-cpp/xshared_memory.hpp:4:
- #include <atomic>
- #include <vector>
- #include <sstream>
+ #include <sstream>
+ #include <string>
+ #include <vector>
static constexpr size_t MAX_ERROR_SIZE = 8 * 1024; // 8KB for errors | ||
static constexpr size_t MAX_COMPLETION_SIZE = 8 * 1024; // 8KB for completions | ||
|
||
enum class RequestType : uint32_t { |
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: enum 'RequestType' uses a larger base type ('uint32_t' (aka 'unsigned int'), size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size [performance-enum-size]
enum class RequestType : uint32_t {
^
static constexpr size_t MAX_ERROR_SIZE = 8 * 1024; // 8KB for errors | ||
static constexpr size_t MAX_COMPLETION_SIZE = 8 * 1024; // 8KB for completions | ||
|
||
enum class RequestType : uint32_t { |
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: no header providing "uint32_t" is directly included [misc-include-cleaner]
include/xeus-cpp/xshared_memory.hpp:2:
- #include <string>
+ #include <cstdint>
+ #include <string>
SHUTDOWN | ||
}; | ||
|
||
enum class ResponseStatus : uint32_t { |
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: enum 'ResponseStatus' uses a larger base type ('uint32_t' (aka 'unsigned int'), size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size [performance-enum-size]
enum class ResponseStatus : uint32_t {
^
std::atomic<RequestType> request_type{RequestType::NONE}; | ||
std::atomic<ResponseStatus> response_status{ResponseStatus::NONE}; | ||
|
||
char code_buffer[MAX_CODE_SIZE]; |
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: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays]
char code_buffer[MAX_CODE_SIZE];
^
uint32_t code_length; | ||
int cursor_pos; | ||
|
||
char output_buffer[MAX_OUTPUT_SIZE]; |
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: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays]
char output_buffer[MAX_OUTPUT_SIZE];
^
int cursor_pos; | ||
|
||
char output_buffer[MAX_OUTPUT_SIZE]; | ||
char error_buffer[MAX_ERROR_SIZE]; |
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: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays]
char error_buffer[MAX_ERROR_SIZE];
^
uint32_t output_length; | ||
uint32_t error_length; | ||
bool compilation_result; | ||
int64_t evaluation_result; |
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: no header providing "int64_t" is directly included [misc-include-cleaner]
int64_t evaluation_result;
^
bool compilation_result; | ||
int64_t evaluation_result; | ||
|
||
char completion_buffer[MAX_COMPLETION_SIZE]; // Use separate size constant |
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: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays]
char completion_buffer[MAX_COMPLETION_SIZE]; // Use separate size constant
^
No description provided.