[Lldb-commits] [lldb] [lldb] Support integer registers with more than 64 bits. (PR #166363)

Matej Košík via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 7 06:50:15 PST 2025


================
@@ -206,7 +206,30 @@ Status RegisterValue::SetValueFromData(const RegisterInfo &reg_info,
         int128.x[0] = data2;
         int128.x[1] = data1;
       }
-      SetUInt128(llvm::APInt(128, int128.x));
+      SetUIntN(llvm::APInt(128, int128.x));
+    } else {
+      std::vector<uint8_t> bytes(src_len, 0);
+      for (size_t i = 0; i < src_len; i++)
+        bytes[i] = src.GetU8(&src_offset);
+
+      if (src.GetByteOrder() == eByteOrderBig)
+        // Transform the big-endian input to little-endian
+        // because that is what the "llvm::LoadIntFromMemory" function
+        // we call below expects.
+        std::reverse(bytes.begin(), bytes.end());
----------------
sedymrak wrote:

Thank for the tip! By using the `DataExtractor::ExtractBytes` method instead of my boiler-plate, I was able to simplify the code.

However, I had to remove the asserts from the `DataExtractor::ExtractBytes` method.
I am not sure why they were previously present.
I think that the method is able to handle inputs of arbitrary length.

https://github.com/llvm/llvm-project/pull/166363


More information about the lldb-commits mailing list