1 | //===-- PauseRequestHandler.cpp -------------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include "DAP.h" |
10 | #include "EventHelper.h" |
11 | #include "JSONUtils.h" |
12 | #include "RequestHandler.h" |
13 | |
14 | namespace lldb_dap { |
15 | |
16 | // "PauseRequest": { |
17 | // "allOf": [ { "$ref": "#/definitions/Request" }, { |
18 | // "type": "object", |
19 | // "description": "Pause request; value of command field is 'pause'. The |
20 | // request suspenses the debuggee. The debug adapter first sends the |
21 | // PauseResponse and then a StoppedEvent (event type 'pause') after the |
22 | // thread has been paused successfully.", "properties": { |
23 | // "command": { |
24 | // "type": "string", |
25 | // "enum": [ "pause" ] |
26 | // }, |
27 | // "arguments": { |
28 | // "$ref": "#/definitions/PauseArguments" |
29 | // } |
30 | // }, |
31 | // "required": [ "command", "arguments" ] |
32 | // }] |
33 | // }, |
34 | // "PauseArguments": { |
35 | // "type": "object", |
36 | // "description": "Arguments for 'pause' request.", |
37 | // "properties": { |
38 | // "threadId": { |
39 | // "type": "integer", |
40 | // "description": "Pause execution for this thread." |
41 | // } |
42 | // }, |
43 | // "required": [ "threadId" ] |
44 | // }, |
45 | // "PauseResponse": { |
46 | // "allOf": [ { "$ref": "#/definitions/Response" }, { |
47 | // "type": "object", |
48 | // "description": "Response to 'pause' request. This is just an |
49 | // acknowledgement, so no body field is required." |
50 | // }] |
51 | // } |
52 | void PauseRequestHandler::operator()(const llvm::json::Object &request) const { |
53 | llvm::json::Object response; |
54 | FillResponse(request, response); |
55 | lldb::SBProcess process = dap.target.GetProcess(); |
56 | lldb::SBError error = process.Stop(); |
57 | dap.SendJSON(json: llvm::json::Value(std::move(response))); |
58 | } |
59 | |
60 | } // namespace lldb_dap |
61 | |