Skip to content

Commit f9f5b56

Browse files
committed
Add default values
1 parent 734747e commit f9f5b56

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lldb/tools/lldb-dap/EventHelper.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,11 @@ void SendInvalidatedEvent(
287287
void SendMemoryEvent(DAP &dap, lldb::SBValue variable) {
288288
if (!dap.clientFeatures.contains(protocol::eClientFeatureMemoryEvent))
289289
return;
290-
const lldb::addr_t addr = variable.GetLoadAddress();
291-
if (addr == LLDB_INVALID_ADDRESS)
292-
return;
293290
protocol::MemoryEventBody body;
294-
body.memoryReference = addr;
291+
body.memoryReference = variable.GetLoadAddress();
295292
body.count = variable.GetByteSize();
293+
if (body.memoryReference == LLDB_INVALID_ADDRESS)
294+
return;
296295
dap.Send(protocol::Event{"memory", std::move(body)});
297296
}
298297

lldb/tools/lldb-dap/Protocol/ProtocolEvents.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define LLDB_TOOLS_LLDB_DAP_PROTOCOL_PROTOCOL_EVENTS_H
2222

2323
#include "Protocol/ProtocolTypes.h"
24+
#include "lldb/lldb-defines.h"
2425
#include "lldb/lldb-types.h"
2526
#include "llvm/Support/JSON.h"
2627
#include <cstdint>
@@ -106,13 +107,13 @@ llvm::json::Value toJSON(const InvalidatedEventBody &);
106107
/// many events.
107108
struct MemoryEventBody {
108109
/// Memory reference of a memory range that has been updated.
109-
lldb::addr_t memoryReference;
110+
lldb::addr_t memoryReference = LLDB_INVALID_ADDRESS;
110111

111112
/// Starting offset in bytes where memory has been updated. Can be negative.
112113
int64_t offset = 0;
113114

114115
/// Number of bytes updated.
115-
uint64_t count;
116+
uint64_t count = 0;
116117
};
117118
llvm::json::Value toJSON(const MemoryEventBody &);
118119

0 commit comments

Comments
 (0)