[Lldb-commits] [lldb] [lldb][debugserver] Read/write SME registers on arm64 (PR #119171)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 12 09:20:39 PST 2024


================
@@ -2582,27 +2586,31 @@ void register_value_in_hex_fixed_width(std::ostream &ostrm, nub_process_t pid,
     if (reg_value_ptr) {
       append_hex_value(ostrm, reg_value_ptr->value.v_uint8, reg->nub_info.size,
                        false);
-    } else {
-      // If we fail to read a register value, check if it has a default
-      // fail value. If it does, return this instead in case some of
-      // the registers are not available on the current system.
-      if (reg->nub_info.size > 0) {
-        std::vector<uint8_t> zeros(reg->nub_info.size, '\0');
-        append_hex_value(ostrm, zeros.data(), zeros.size(), false);
-      }
+      return true;
     }
+    if (!fail_value || reg->nub_info.size == 0)
+      return false;
+
+    // Pad out the reply to the correct size to maintain correct offsets,
+    // even if we could not read the register value.
+    std::vector<uint8_t> zeros(reg->nub_info.size, *fail_value);
----------------
JDevlieghere wrote:

Nit: You call the `vector` zeros assuming that's the fail value, but maybe `failed` would be more generic. 

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


More information about the lldb-commits mailing list