Skip to content

Commit 50a2bc2

Browse files
committed
Merge branch 'main' of github.com:santhoshe447/llvm-project into main
2 parents 6f676bb + 1f77293 commit 50a2bc2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,11 @@ def writeMemory(self, memoryReference, data=None, offset=None, allowPartial=None
536536
# This function accepts data in decimal and hexadecimal format,
537537
# converts it to a Base64 string, and send it to the DAP,
538538
# which expects Base64 encoded data.
539-
encodedData = "" if data is None else base64.b64encode(data.to_bytes()).decode()
540-
response = self.dap_server.request_writeMemory(memoryReference, encodedData, offset=offset, allowPartial=allowPartial)
539+
encodedData = "" if data is None else base64.b64encode(
540+
# (bit_length + 7 (rounding up to nearest byte) ) //8 = converts to bytes.
541+
data.to_bytes((data.bit_length() + 7) // 8, "little")
542+
).decode()
543+
response = self.dap_server.request_writeMemory(
544+
memoryReference, encodedData, offset=offset, allowPartial=allowPartial
545+
)
541546
return response

lldb/tools/lldb-dap/DAP.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,8 @@ llvm::StringMap<bool> DAP::GetCapabilities() {
11731173
return capabilities;
11741174
}
11751175

1176-
void DAP::SendErrorResponse(llvm::json::Object &response, llvm::StringRef message) {
1176+
void DAP::SendErrorResponse(llvm::json::Object &response,
1177+
llvm::StringRef message) {
11771178
response["success"] = false;
11781179
EmplaceSafeString(response, "message", message);
11791180
SendJSON(llvm::json::Value(std::move(response)));

0 commit comments

Comments
 (0)