1515#include " Protocol/ProtocolRequests.h"
1616#include " Protocol/ProtocolTypes.h"
1717#include " lldb/API/SBFileSpec.h"
18+ #include " lldb/API/SBPlatform.h"
1819#include " llvm/Support/Error.h"
1920#include < utility>
2021
@@ -78,11 +79,9 @@ void SendExtraCapabilities(DAP &dap) {
7879// { "$ref": "#/definitions/Event" },
7980// {
8081// "type": "object",
81- // "description": "Event message for 'process' event type. The event
82- // indicates that the debugger has begun debugging a
83- // new process. Either one that it has launched, or one
84- // that it has attached to.",
85- // "properties": {
82+ // "description": "The event indicates that the debugger has begun
83+ // debugging a new process. Either one that it has launched, or one that
84+ // it has attached to.", "properties": {
8685// "event": {
8786// "type": "string",
8887// "enum": [ "process" ]
@@ -93,31 +92,37 @@ void SendExtraCapabilities(DAP &dap) {
9392// "name": {
9493// "type": "string",
9594// "description": "The logical name of the process. This is
96- // usually the full path to process's executable
97- // file. Example: /home/myproj/program.js."
95+ // usually the full path to process's executable file. Example:
96+ // /home/example /myproj/program.js."
9897// },
9998// "systemProcessId": {
10099// "type": "integer",
101- // "description": "The system process id of the debugged process.
102- // This property will be missing for non-system
103- // processes."
100+ // "description": "The process ID of the debugged process, as
101+ // assigned by the operating system. This property should be
102+ // omitted for logical processes that do not map to operating
103+ // system processes on the machine."
104104// },
105105// "isLocalProcess": {
106106// "type": "boolean",
107107// "description": "If true, the process is running on the same
108- // computer as the debug adapter."
108+ // computer as the debug adapter."
109109// },
110110// "startMethod": {
111111// "type": "string",
112112// "enum": [ "launch", "attach", "attachForSuspendedLaunch" ],
113113// "description": "Describes how the debug engine started
114- // debugging this process.",
115- // "enumDescriptions": [
114+ // debugging this process.", "enumDescriptions": [
116115// "Process was launched under the debugger.",
117116// "Debugger attached to an existing process.",
118- // "A project launcher component has launched a new process in
119- // a suspended state and then asked the debugger to attach."
117+ // "A project launcher component has launched a new process in a
118+ // suspended state and then asked the debugger to attach."
120119// ]
120+ // },
121+ // "pointerSize": {
122+ // "type": "integer",
123+ // "description": "The size of a pointer or address for this
124+ // process, in bits. This value may be used by clients when
125+ // formatting addresses for display."
121126// }
122127// },
123128// "required": [ "name" ]
@@ -126,7 +131,7 @@ void SendExtraCapabilities(DAP &dap) {
126131// "required": [ "event", "body" ]
127132// }
128133// ]
129- // }
134+ // },
130135void SendProcessEvent (DAP &dap, LaunchMethod launch_method) {
131136 lldb::SBFileSpec exe_fspec = dap.target .GetExecutable ();
132137 char exe_path[PATH_MAX];
@@ -136,7 +141,8 @@ void SendProcessEvent(DAP &dap, LaunchMethod launch_method) {
136141 EmplaceSafeString (body, " name" , exe_path);
137142 const auto pid = dap.target .GetProcess ().GetProcessID ();
138143 body.try_emplace (" systemProcessId" , (int64_t )pid);
139- body.try_emplace (" isLocalProcess" , true );
144+ body.try_emplace (" isLocalProcess" , dap.target .GetPlatform ().IsHost ());
145+ body.try_emplace (" pointerSize" , dap.target .GetAddressByteSize () * 8 );
140146 const char *startMethod = nullptr ;
141147 switch (launch_method) {
142148 case Launch:
0 commit comments