Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions lldb/tools/lldb-dap/DAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
60 changes: 39 additions & 21 deletions lldb/tools/lldb-dap/DAP.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,50 +162,70 @@ 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;
FunctionBreakpointMap function_breakpoints;
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;

Expand Down Expand Up @@ -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();

Expand Down
Loading