-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Open
Labels
Description
Summary
The DataBreakpiontInforRequest
handler seems to violate the DAP spec by requiring frame ID be sent in the request body. This causes two problems
- There's no way to specify a global scope for expressions
- The handler always responds with an error when request uses a variable reference to distinguish the scope being used
FrameId Specification
/**
* When `name` is an expression, evaluate it in the scope of this stack frame.
* If not specified, the expression is evaluated in the global scope. When
* `variablesReference` is specified, this property has no effect.
*/
frameId?: number;
Bug lldb-dap/Protocol/ProtocolRequest.cpp:461
The bug is caused below because frameId
is not mapped as an optional. Please note that this isn't the only violation for this request handler, variablesReference
, bytes
, asAddresss
and mode
should all be optional as well (everything except the name
field should be an optional).
bool fromJSON(const json::Value &Params, DataBreakpointInfoArguments &DBIA,
json::Path P) {
json::ObjectMapper O(Params, P);
return O && O.map("variablesReference", DBIA.variablesReference) &&
O.map("name", DBIA.name) && O.map("frameId", DBIA.frameId) &&
O.map("bytes", DBIA.bytes) && O.map("asAddress", DBIA.asAddress) &&
O.map("mode", DBIA.mode);
}
Dap logs showing error (With Zed)
{
"type": "request",
"seq": 21,
"command": "dataBreakpointInfo",
"arguments": {
"variablesReference": 10,
"name": "c",
"asAddress": false
}
}
// Receive
{
"body": {
"error": {
"format": "invalid arguments for request 'dataBreakpointInfo': missing value at arguments.frameId\n/* error: missing value */\n{\n \"asAddress\": false,\n \"name\": \"c\",\n \"variablesReference\": 10\n}",
"id": 3,
"showUser": true
}
},
"command": "dataBreakpointInfo",
"request_seq": 21,
"seq": 0,
"success": false,
"type": "response"
}
osiewicz