Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
10 changes: 4 additions & 6 deletions lldb/tools/lldb-dap/DAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ using namespace lldb_dap;

namespace lldb_dap {

DAP g_dap;

DAP::DAP()
: broadcaster("lldb-dap"), exception_breakpoints(),
focus_tid(LLDB_INVALID_THREAD_ID), stop_at_entry(false), is_attach(false),
Expand Down Expand Up @@ -693,15 +691,15 @@ bool DAP::HandleObject(const llvm::json::Object &object) {
if (packet_type == "request") {
const auto command = GetString(object, "command");
auto handler_pos = request_handlers.find(command);
if (handler_pos != request_handlers.end()) {
handler_pos->second(object);
return true; // Success
} else {
if (handler_pos == request_handlers.end()) {
if (log)
*log << "error: unhandled command \"" << command.data() << "\""
<< std::endl;
return false; // Fail
}

handler_pos->second(*this, object);
return true; // Success
}

if (packet_type == "response") {
Expand Down
4 changes: 1 addition & 3 deletions lldb/tools/lldb-dap/DAP.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ enum DAPBroadcasterBits {
eBroadcastBitStopProgressThread = 1u << 1
};

typedef void (*RequestCallback)(const llvm::json::Object &command);
typedef void (*RequestCallback)(DAP &dap, const llvm::json::Object &command);
typedef void (*ResponseCallback)(llvm::Expected<llvm::json::Value> value);

enum class PacketStatus {
Expand Down Expand Up @@ -353,8 +353,6 @@ struct DAP {
void SendJSON(const std::string &json_str);
};

extern DAP g_dap;

} // namespace lldb_dap

#endif
Loading
Loading