-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[lldb-dap] Member variable cleanup in DAP.{cpp,h} (NFC) #140390
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
JDevlieghere
commented
May 17, 2025
- Use in-class member initialization to simplify the constructor.
- Remove unimplemented SetConfigurationDone.
- Consistently use Doxygen-style comments.
- Use in-class member initialization to simplify the constructor. - Remove unimplemented SetConfigurationDone. - Consistently use Doxygen-style comments.
@llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) Changes
Full diff: https://github.com/llvm/llvm-project/pull/140390.diff 2 Files Affected:
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 0d5eba6c40961..d813cdb0b9074 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -118,13 +118,9 @@ llvm::StringRef DAP::debug_adapter_path = "";
DAP::DAP(Log *log, const ReplMode default_repl_mode,
std::vector<std::string> pre_init_commands, Transport &transport)
: log(log), transport(transport), broadcaster("lldb-dap"),
- exception_breakpoints(), focus_tid(LLDB_INVALID_THREAD_ID),
- stop_at_entry(false), is_attach(false),
- restarting_process_id(LLDB_INVALID_PROCESS_ID), configuration_done(false),
- waiting_for_run_in_terminal(false),
progress_event_reporter(
[&](const ProgressEvent &event) { SendJSON(event.ToJSON()); }),
- reverse_request_seq(0), repl_mode(default_repl_mode) {
+ repl_mode(default_repl_mode) {
configuration.preInitCommands = std::move(pre_init_commands);
RegisterRequests();
}
diff --git a/lldb/tools/lldb-dap/DAP.h b/lldb/tools/lldb-dap/DAP.h
index 8f24c6cf82924..975e2b290e1f9 100644
--- a/lldb/tools/lldb-dap/DAP.h
+++ b/lldb/tools/lldb-dap/DAP.h
@@ -162,10 +162,16 @@ struct DAP {
lldb::SBFile in;
OutputRedirector out;
OutputRedirector err;
+
/// Configuration specified by the launch or attach commands.
protocol::Configuration configuration;
+
+ /// The debugger instance for this DAP session.
lldb::SBDebugger debugger;
+
+ /// The target instance for this DAP session.
lldb::SBTarget target;
+
Variables variables;
lldb::SBBroadcaster broadcaster;
llvm::StringMap<SourceBreakpointMap> source_breakpoints;
@@ -173,39 +179,53 @@ struct DAP {
InstructionBreakpointMap instruction_breakpoints;
std::optional<std::vector<ExceptionBreakpoint>> exception_breakpoints;
llvm::once_flag init_exception_breakpoints_flag;
- // Map step in target id to list of function targets that user can choose.
+
+ /// Map step in target id to list of function targets that user can choose.
llvm::DenseMap<lldb::addr_t, std::string> step_in_targets;
- // A copy of the last LaunchRequest so we can reuse its arguments if we get a
- // RestartRequest. Restarting an AttachRequest is not supported.
+
+ /// A copy of the last LaunchRequest so we can reuse its arguments if we get a
+ /// RestartRequest. Restarting an AttachRequest is not supported.
std::optional<protocol::LaunchRequestArguments> last_launch_request;
- lldb::tid_t focus_tid;
+
+ /// The focused thread for this DAP session.
+ lldb::tid_t focus_tid = LLDB_INVALID_THREAD_ID;
+
bool disconnecting = false;
llvm::once_flag terminated_event_flag;
- bool stop_at_entry;
- bool is_attach;
- // The process event thread normally responds to process exited events by
- // shutting down the entire adapter. When we're restarting, we keep the id of
- // the old process here so we can detect this case and keep running.
- lldb::pid_t restarting_process_id;
+ bool stop_at_entry = false;
+ bool is_attach = false;
+
+ /// The process event thread normally responds to process exited events by
+ /// shutting down the entire adapter. When we're restarting, we keep the id of
+ /// the old process here so we can detect this case and keep running.
+ lldb::pid_t restarting_process_id = LLDB_INVALID_PROCESS_ID;
+
+ /// Whether we have received the ConfigurationDone request, indicating that
+ /// the client has finished initialization of the debug adapter.
bool configuration_done;
- bool waiting_for_run_in_terminal;
+
+ bool waiting_for_run_in_terminal = false;
ProgressEventReporter progress_event_reporter;
- // Keep track of the last stop thread index IDs as threads won't go away
- // unless we send a "thread" event to indicate the thread exited.
+
+ /// Keep track of the last stop thread index IDs as threads won't go away
+ /// unless we send a "thread" event to indicate the thread exited.
llvm::DenseSet<lldb::tid_t> thread_ids;
- uint32_t reverse_request_seq;
+
+ uint32_t reverse_request_seq = 0;
std::mutex call_mutex;
llvm::SmallDenseMap<int64_t, std::unique_ptr<ResponseHandler>>
inflight_reverse_requests;
ReplMode repl_mode;
lldb::SBFormat frame_format;
lldb::SBFormat thread_format;
- // This is used to allow request_evaluate to handle empty expressions
- // (ie the user pressed 'return' and expects the previous expression to
- // repeat). If the previous expression was a command, this string will be
- // empty; if the previous expression was a variable expression, this string
- // will contain that expression.
+
+ /// This is used to allow request_evaluate to handle empty expressions
+ /// (ie the user pressed 'return' and expects the previous expression to
+ /// repeat). If the previous expression was a command, this string will be
+ /// empty; if the previous expression was a variable expression, this string
+ /// will contain that expression.
std::string last_nonempty_var_expression;
+
/// The set of features supported by the connected client.
llvm::DenseSet<ClientFeature> clientFeatures;
@@ -257,8 +277,6 @@ struct DAP {
/// Configures the debug adapter for launching/attaching.
void SetConfiguration(const protocol::Configuration &confing, bool is_attach);
- void SetConfigurationDone();
-
/// Configure source maps based on the current `DAPConfiguration`.
void ConfigureSourceMaps();
|
ashgti
approved these changes
May 18, 2025
da-viper
approved these changes
May 18, 2025
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/197/builds/5499 Here is the relevant piece of the build log for the reference
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.