[Lldb-commits] [PATCH] D25021: [LLDB][MIPS] Fix qProcessInfo to return correct pointer size based on ELF ABI

Nitesh Jain via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 28 07:33:45 PDT 2016


nitesh.jain created this revision.
nitesh.jain added reviewers: clayborg, labath.
nitesh.jain added subscribers: jaydeep, bhushan, slthakur, lldb-commits.
nitesh.jain set the repository for this revision to rL LLVM.

In case of MIPS64, the pointer size depends on ELF abi. The MIPS64 currently support following abi's

1) N32 : - The pointer size is 4 byte
2) N64 :- The pointer size is 8 byte

This patch add one more key (eflags) in qProcessInfo which will be use to get correct pointer size based on abi.

Repository:
  rL LLVM

https://reviews.llvm.org/D25021

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp

Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -1212,9 +1212,15 @@
       // Nothing.
       break;
     }
-
-    if (proc_triple.isArch64Bit())
-      response.PutCString("ptrsize:8;");
+    // In case of MIPS64, pointer size is depend on ELF ABI
+    // For N32 the pointer size is 4 and for N64 it is 8 
+    response.Printf("eflags:%" PRIx32 ";", proc_arch.GetFlags());
+    if (proc_triple.isArch64Bit()) {
+       if (proc_arch.IsMIPS()) {
+         response.Printf("ptrsize:%d;", proc_arch.GetAddressByteSize()); 
+       } else
+         response.PutCString("ptrsize:8;");
+    }
     else if (proc_triple.isArch32Bit())
       response.PutCString("ptrsize:4;");
     else if (proc_triple.isArch16Bit())
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1847,6 +1847,7 @@
       std::string os_name;
       std::string vendor_name;
       std::string triple;
+      uint32_t proc_arch_eflags = 0;
       uint32_t pointer_byte_size = 0;
       StringExtractor extractor;
       ByteOrder byte_order = eByteOrderInvalid;
@@ -1883,6 +1884,9 @@
         } else if (name.equals("pid")) {
           if (!value.getAsInteger(16, pid))
             ++num_keys_decoded;
+        } else if (name.equals("eflags")) {
+          if (!value.getAsInteger(16,proc_arch_eflags))
+            ++num_keys_decoded;
         }
       }
       if (num_keys_decoded > 0)
@@ -1895,6 +1899,7 @@
       // Set the ArchSpec from the triple if we have it.
       if (!triple.empty()) {
         m_process_arch.SetTriple(triple.c_str());
+        m_process_arch.SetFlags(proc_arch_eflags);
         if (pointer_byte_size) {
           assert(pointer_byte_size == m_process_arch.GetAddressByteSize());
         }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25021.72823.patch
Type: text/x-patch
Size: 2188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160928/7fd38296/attachment.bin>


More information about the lldb-commits mailing list