Author: David Spickett
Date: 2024-09-25T14:31:57Z
New Revision: 26e0b5077236064d9ab0548e049dffce4d476c06

URL: 
https://github.com/llvm/llvm-project/commit/26e0b5077236064d9ab0548e049dffce4d476c06
DIFF: 
https://github.com/llvm/llvm-project/commit/26e0b5077236064d9ab0548e049dffce4d476c06.diff

LOG: [lldb][lldb-dap] Fix compilation error on 32 bit platforms

https://github.com/llvm/llvm-project/pull/109485 tried to std::min
between size_t and uint64_t. size_t on 32 bit is 32 bits.

https://lab.llvm.org/buildbot/#/builders/18/builds/4430/steps/4/logs/stdio

Explicitly select the size_t template to fix this.

This will truncate one of the arguments but that's the count_requested.
If you're debugging from a 32 bit host and you asked it to read
> 32 bit range of memory from a 64 bit target, you weren't going
to have any success anyway.

The final result needs to be size_t to resize the vector with.

Added: 
    

Modified: 
    lldb/tools/lldb-dap/lldb-dap.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/tools/lldb-dap/lldb-dap.cpp 
b/lldb/tools/lldb-dap/lldb-dap.cpp
index f692d77347038c..db4dbbd6f6200a 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -4451,7 +4451,7 @@ void request_readMemory(const llvm::json::Object 
&request) {
     g_dap.SendJSON(llvm::json::Value(std::move(response)));
     return;
   }
-  buf.resize(std::min(count_result, count_requested));
+  buf.resize(std::min<size_t>(count_result, count_requested));
 
   llvm::json::Object body;
   std::string formatted_addr = "0x" + llvm::utohexstr(addr_int);


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to