[Lldb-commits] [PATCH] D24124: [LLDB][MIPS] Fix register read/write for big endian

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 1 10:15:20 PDT 2016


clayborg requested changes to this revision.

================
Comment at: source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp:659-660
@@ -651,4 +658,4 @@
     {
-        uint8_t *dst;
+        uint8_t *dst, byte_size;
         uint64_t *src;
 
----------------
Please initialize these. Note that "byte_size" will be used with an random value since it isn't initialized in the else clause below.

================
Comment at: source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp:673
@@ -664,3 +672,3 @@
         {
             assert (reg_info->byte_offset < sizeof(UserArea));
             dst = (uint8_t *)&m_msa + reg_info->byte_offset - (sizeof(m_gpr) + sizeof(m_fpr));
----------------
set "byte_size" in else clause.

================
Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:1845
@@ -1843,1 +1844,3 @@
+    uint64_t value;
+    value = reg_size == 4 ? *(uint32_t *)reg_bytes : *(uint64_t *)reg_bytes;
 
----------------
There is coded that can do what you want in:

```
    lldb::offset_t
    DataExtractor::CopyByteOrderedData (lldb::offset_t src_offset,
                         lldb::offset_t src_len,
                         void *dst, 
                         lldb::offset_t dst_len,
                         lldb::ByteOrder dst_byte_order) const;
```

It lets you say "I want to copy 4 big endian bytes over into 8 little endian bytes. It will pad and do the right thing as long as the source data is the smaller or the same size as the destination". We can probably make this function available as a static function where you specify the source "void *", the src_len, and the src_byte_order, and the dst void *, dst_len and dst_byte_order. Then you can call this function.


https://reviews.llvm.org/D24124





More information about the lldb-commits mailing list