mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 02:38:07 +08:00
[lldb-dap] start all sent protocol message from number one. (#170378)
This aligns with the DAP [specification](https://microsoft.github.io/debug-adapter-protocol//specification.html#Base_Protocol_ProtocolMessage) Force it to be an error in test cases.
This commit is contained in:
@@ -391,7 +391,7 @@ class DebugCommunication(object):
|
||||
with self._recv_condition:
|
||||
for packet in self._recv_packets:
|
||||
if packet and ("seq" not in packet or packet["seq"] == 0):
|
||||
warnings.warn(
|
||||
raise ValueError(
|
||||
f"received a malformed packet, expected 'seq != 0' for {packet!r}"
|
||||
)
|
||||
# Handle events that may modify any stateful properties of
|
||||
|
||||
@@ -274,8 +274,11 @@ Id DAP::Send(const Message &message) {
|
||||
std::lock_guard<std::mutex> guard(call_mutex);
|
||||
Message msg = std::visit(
|
||||
[this](auto &&msg) -> Message {
|
||||
if (msg.seq == kCalculateSeq)
|
||||
msg.seq = seq++;
|
||||
if (msg.seq == kCalculateSeq) {
|
||||
seq++;
|
||||
msg.seq = seq;
|
||||
}
|
||||
assert(msg.seq > 0 && "message sequence must be greater than zero.");
|
||||
return msg;
|
||||
},
|
||||
Message(message));
|
||||
|
||||
@@ -31,11 +31,11 @@ namespace lldb_dap::protocol {
|
||||
// MARK: Base Protocol
|
||||
|
||||
/// Message unique identifier type.
|
||||
using Id = int64_t;
|
||||
using Id = uint64_t;
|
||||
|
||||
/// A unique identifier that indicates the `seq` field should be calculated by
|
||||
/// the current session.
|
||||
static constexpr Id kCalculateSeq = INT64_MAX;
|
||||
static constexpr Id kCalculateSeq = UINT64_MAX;
|
||||
|
||||
/// A client or debug adapter initiated request.
|
||||
struct Request {
|
||||
|
||||
Reference in New Issue
Block a user