Skip to content

Commit a29da42

Browse files
committed
[lldb][lldb-dap] Remove old functionality
1 parent b71343f commit a29da42

File tree

6 files changed

+17
-168
lines changed

6 files changed

+17
-168
lines changed

lldb/tools/lldb-dap/DAP.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -523,17 +523,6 @@ lldb::SBFrame DAP::GetLLDBFrame(uint64_t frame_id) {
523523
return thread.GetFrameAtIndex(GetLLDBFrameID(frame_id));
524524
}
525525

526-
llvm::json::Value DAP::CreateTopLevelScopes() {
527-
llvm::json::Array scopes;
528-
scopes.emplace_back(
529-
CreateScope("Locals", VARREF_LOCALS, variables.locals.GetSize(), false));
530-
scopes.emplace_back(CreateScope("Globals", VARREF_GLOBALS,
531-
variables.globals.GetSize(), false));
532-
scopes.emplace_back(CreateScope("Registers", VARREF_REGS,
533-
variables.registers.GetSize(), false));
534-
return llvm::json::Value(std::move(scopes));
535-
}
536-
537526
ReplMode DAP::DetectReplMode(lldb::SBFrame frame, std::string &expression,
538527
bool partial_expression) {
539528
// Check for the escape hatch prefix.

lldb/tools/lldb-dap/DAP.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,6 @@ struct DAP {
277277

278278
lldb::SBFrame GetLLDBFrame(uint64_t frame_id);
279279

280-
llvm::json::Value CreateTopLevelScopes();
281-
282280
void PopulateExceptionBreakpoints();
283281

284282
/// Attempt to determine if an expression is a variable expression or

lldb/tools/lldb-dap/Handler/RequestHandler.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,6 @@ class ScopesRequestHandler final
434434
Run(const protocol::ScopesArguments &args) const override;
435435
};
436436

437-
class ScopesRequestHandler2 : public LegacyRequestHandler {
438-
public:
439-
using LegacyRequestHandler::LegacyRequestHandler;
440-
static llvm::StringLiteral GetCommand() { return "scopesr"; }
441-
void operator()(const llvm::json::Object &request) const override;
442-
};
443-
444437
class SetVariableRequestHandler : public LegacyRequestHandler {
445438
public:
446439
using LegacyRequestHandler::LegacyRequestHandler;

lldb/tools/lldb-dap/Handler/ScopesRequestHandler.cpp

Lines changed: 17 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,23 @@ namespace lldb_dap {
6565
// }]
6666
// }
6767

68+
/// Create a "Scope" JSON object as described in the debug adapter definition.
69+
///
70+
/// \param[in] name
71+
/// The value to place into the "name" key
72+
//
73+
/// \param[in] variablesReference
74+
/// The value to place into the "variablesReference" key
75+
//
76+
/// \param[in] namedVariables
77+
/// The value to place into the "namedVariables" key
78+
//
79+
/// \param[in] expensive
80+
/// The value to place into the "expensive" key
81+
///
82+
/// \return
83+
/// A "Scope" JSON object with that follows the formal JSON
84+
/// definition outlined by Microsoft.
6885
protocol::Scope CreateScope2(const llvm::StringRef name,
6986
int64_t variablesReference, int64_t namedVariables,
7087
bool expensive) {
@@ -133,48 +150,6 @@ ScopesRequestHandler::Run(const protocol::ScopesArguments &args) const {
133150
dap.variables.registers = frame.GetRegisters();
134151

135152
return protocol::ScopesResponseBody{CreateTopLevelScopes(dap)};
136-
};
137-
void ScopesRequestHandler2::operator()(
138-
const llvm::json::Object &request) const {
139-
llvm::json::Object response;
140-
FillResponse(request, response);
141-
llvm::json::Object body;
142-
const auto *arguments = request.getObject("arguments");
143-
144-
const uint64_t frame_id =
145-
GetInteger<uint64_t>(arguments, "frameId").value_or(UINT64_MAX);
146-
lldb::SBFrame frame = dap.GetLLDBFrame(frame_id);
147-
// As the user selects different stack frames in the GUI, a "scopes" request
148-
// will be sent to the DAP. This is the only way we know that the user has
149-
// selected a frame in a thread. There are no other notifications that are
150-
// sent and VS code doesn't allow multiple frames to show variables
151-
// concurrently. If we select the thread and frame as the "scopes" requests
152-
// are sent, this allows users to type commands in the debugger console
153-
// with a backtick character to run lldb commands and these lldb commands
154-
// will now have the right context selected as they are run. If the user
155-
// types "`bt" into the debugger console and we had another thread selected
156-
// in the LLDB library, we would show the wrong thing to the user. If the
157-
// users switches threads with a lldb command like "`thread select 14", the
158-
// GUI will not update as there are no "event" notification packets that
159-
// allow us to change the currently selected thread or frame in the GUI that
160-
// I am aware of.
161-
if (frame.IsValid()) {
162-
frame.GetThread().GetProcess().SetSelectedThread(frame.GetThread());
163-
frame.GetThread().SetSelectedFrame(frame.GetFrameID());
164-
}
165-
166-
dap.variables.locals = frame.GetVariables(/*arguments=*/true,
167-
/*locals=*/true,
168-
/*statics=*/false,
169-
/*in_scope_only=*/true);
170-
dap.variables.globals = frame.GetVariables(/*arguments=*/false,
171-
/*locals=*/false,
172-
/*statics=*/true,
173-
/*in_scope_only=*/true);
174-
dap.variables.registers = frame.GetRegisters();
175-
body.try_emplace("scopes", dap.CreateTopLevelScopes());
176-
response.try_emplace("body", std::move(body));
177-
dap.SendJSON(llvm::json::Value(std::move(response)));
178153
}
179154

180155
} // namespace lldb_dap

lldb/tools/lldb-dap/JSONUtils.cpp

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -269,91 +269,6 @@ void FillResponse(const llvm::json::Object &request,
269269
response.try_emplace("success", true);
270270
}
271271

272-
// "Scope": {
273-
// "type": "object",
274-
// "description": "A Scope is a named container for variables. Optionally
275-
// a scope can map to a source or a range within a source.",
276-
// "properties": {
277-
// "name": {
278-
// "type": "string",
279-
// "description": "Name of the scope such as 'Arguments', 'Locals'."
280-
// },
281-
// "presentationHint": {
282-
// "type": "string",
283-
// "description": "An optional hint for how to present this scope in the
284-
// UI. If this attribute is missing, the scope is shown
285-
// with a generic UI.",
286-
// "_enum": [ "arguments", "locals", "registers" ],
287-
// },
288-
// "variablesReference": {
289-
// "type": "integer",
290-
// "description": "The variables of this scope can be retrieved by
291-
// passing the value of variablesReference to the
292-
// VariablesRequest."
293-
// },
294-
// "namedVariables": {
295-
// "type": "integer",
296-
// "description": "The number of named variables in this scope. The
297-
// client can use this optional information to present
298-
// the variables in a paged UI and fetch them in chunks."
299-
// },
300-
// "indexedVariables": {
301-
// "type": "integer",
302-
// "description": "The number of indexed variables in this scope. The
303-
// client can use this optional information to present
304-
// the variables in a paged UI and fetch them in chunks."
305-
// },
306-
// "expensive": {
307-
// "type": "boolean",
308-
// "description": "If true, the number of variables in this scope is
309-
// large or expensive to retrieve."
310-
// },
311-
// "source": {
312-
// "$ref": "#/definitions/Source",
313-
// "description": "Optional source for this scope."
314-
// },
315-
// "line": {
316-
// "type": "integer",
317-
// "description": "Optional start line of the range covered by this
318-
// scope."
319-
// },
320-
// "column": {
321-
// "type": "integer",
322-
// "description": "Optional start column of the range covered by this
323-
// scope."
324-
// },
325-
// "endLine": {
326-
// "type": "integer",
327-
// "description": "Optional end line of the range covered by this scope."
328-
// },
329-
// "endColumn": {
330-
// "type": "integer",
331-
// "description": "Optional end column of the range covered by this
332-
// scope."
333-
// }
334-
// },
335-
// "required": [ "name", "variablesReference", "expensive" ]
336-
// }
337-
llvm::json::Value CreateScope(const llvm::StringRef name,
338-
int64_t variablesReference,
339-
int64_t namedVariables, bool expensive) {
340-
llvm::json::Object object;
341-
EmplaceSafeString(object, "name", name.str());
342-
343-
// TODO: Support "arguments" scope. At the moment lldb-dap includes the
344-
// arguments into the "locals" scope.
345-
if (variablesReference == VARREF_LOCALS) {
346-
object.try_emplace("presentationHint", "locals");
347-
} else if (variablesReference == VARREF_REGS) {
348-
object.try_emplace("presentationHint", "registers");
349-
}
350-
351-
object.try_emplace("variablesReference", variablesReference);
352-
object.try_emplace("expensive", expensive);
353-
object.try_emplace("namedVariables", namedVariables);
354-
return llvm::json::Value(std::move(object));
355-
}
356-
357272
// "Breakpoint": {
358273
// "type": "object",
359274
// "description": "Information about a Breakpoint created in setBreakpoints

lldb/tools/lldb-dap/JSONUtils.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -294,27 +294,6 @@ llvm::json::Object CreateEventObject(const llvm::StringRef event_name);
294294
protocol::ExceptionBreakpointsFilter
295295
CreateExceptionBreakpointFilter(const ExceptionBreakpoint &bp);
296296

297-
/// Create a "Scope" JSON object as described in the debug adapter definition.
298-
///
299-
/// \param[in] name
300-
/// The value to place into the "name" key
301-
//
302-
/// \param[in] variablesReference
303-
/// The value to place into the "variablesReference" key
304-
//
305-
/// \param[in] namedVariables
306-
/// The value to place into the "namedVariables" key
307-
//
308-
/// \param[in] expensive
309-
/// The value to place into the "expensive" key
310-
///
311-
/// \return
312-
/// A "Scope" JSON object with that follows the formal JSON
313-
/// definition outlined by Microsoft.
314-
llvm::json::Value CreateScope(const llvm::StringRef name,
315-
int64_t variablesReference,
316-
int64_t namedVariables, bool expensive);
317-
318297
/// Create a "Source" JSON object as described in the debug adapter definition.
319298
///
320299
/// \param[in] file

0 commit comments

Comments
 (0)