Skip to content

Commit 010bad7

Browse files
committed
[lldb][lldb-dap] add helper function SendThreadGotoEvent
LLDB currently does not have a `StopReason` for goto so I cannot use `SendThreadStoppedEvent` as I need to put the goto reason. Signed-off-by: Ebuka Ezike <[email protected]>
1 parent 66316f9 commit 010bad7

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@
1212

1313
namespace lldb_dap {
1414

15+
/// Creates an \p StoppedEvent with the reason \a goto
16+
static void SendThreadGotoEvent(DAP &dap, lldb::tid_t thread_id) {
17+
18+
llvm::json::Object event(CreateEventObject("stopped"));
19+
llvm::json::Object body;
20+
body.try_emplace("reason", "goto");
21+
body.try_emplace("description", "Paused on Jump To Cursor");
22+
body.try_emplace("threadId", thread_id);
23+
body.try_emplace("preserveFocusHint", false);
24+
body.try_emplace("allThreadsStopped", true);
25+
26+
event.try_emplace("body", std::move(body));
27+
dap.SendJSON(llvm::json::Value(std::move(event)));
28+
}
29+
1530
// "GotoRequest": {
1631
// "allOf": [ { "$ref": "#/definitions/Request" }, {
1732
// "type": "object",
@@ -98,7 +113,7 @@ void GoToRequestHandler::operator()(const llvm::json::Object &request) const {
98113

99114
dap.SendJSON(llvm::json::Value(std::move(response)));
100115

101-
SendThreadStoppedEvent(dap);
116+
SendThreadGotoEvent(dap, current_thread.GetThreadID());
102117
}
103118

104119
} // namespace lldb_dap

0 commit comments

Comments
 (0)