[llvm-branch-commits] [lldb] r287747 - Merging r284001:

Nitesh Jain via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Nov 23 00:18:43 PST 2016


Author: nitesh.jain
Date: Wed Nov 23 02:18:42 2016
New Revision: 287747

URL: http://llvm.org/viewvc/llvm-project?rev=287747&view=rev
Log:
Merging r284001:
------------------------------------------------------------------------
r284001 | nitesh.jain | 2016-10-12 15:51:09 +0530 (Wed, 12 Oct 2016) | 7 lines

[LLDB][MIPS] Fix qProcessInfo to return correct pointer size based on ELF ABI

Reviewers: clayborg, labath

Subscribers: jaydeep, bhushan, slthakur, lldb-commits

Differential Revision: https://reviews.llvm.org/D25021
------------------------------------------------------------------------

Modified:
    lldb/branches/release_39/   (props changed)
    lldb/branches/release_39/include/lldb/Core/ArchSpec.h
    lldb/branches/release_39/source/Core/ArchSpec.cpp
    lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp

Propchange: lldb/branches/release_39/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 23 02:18:42 2016
@@ -1,3 +1,3 @@
 /lldb/branches/apple/python-GIL:156467-162159
 /lldb/branches/iohandler:198360-200250
-/lldb/trunk:277343,277426,277997,277999,278001,283728-283729,284003
+/lldb/trunk:277343,277426,277997,277999,278001,283728-283729,284001,284003

Modified: lldb/branches/release_39/include/lldb/Core/ArchSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_39/include/lldb/Core/ArchSpec.h?rev=287747&r1=287746&r2=287747&view=diff
==============================================================================
--- lldb/branches/release_39/include/lldb/Core/ArchSpec.h (original)
+++ lldb/branches/release_39/include/lldb/Core/ArchSpec.h Wed Nov 23 02:18:42 2016
@@ -382,6 +382,14 @@ public:
         return m_core >= eCore_arm_generic && m_core < kNumCores;
     }
 
+    //------------------------------------------------------------------
+    /// Return a string representing target application ABI.
+    ///
+    /// @return A string representing target application ABI.
+    //------------------------------------------------------------------
+    std::string GetTargetABI() const;
+
+
     bool
     TripleVendorWasSpecified() const
     {
@@ -677,6 +685,8 @@ public:
         m_flags = flags;
     }
 
+  void SetFlags(std::string elf_abi);
+
 protected:
     bool
     IsEqualTo (const ArchSpec& rhs, bool exact_match) const;

Modified: lldb/branches/release_39/source/Core/ArchSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_39/source/Core/ArchSpec.cpp?rev=287747&r1=287746&r2=287747&view=diff
==============================================================================
--- lldb/branches/release_39/source/Core/ArchSpec.cpp (original)
+++ lldb/branches/release_39/source/Core/ArchSpec.cpp Wed Nov 23 02:18:42 2016
@@ -519,11 +519,46 @@ ArchSpec::IsMIPS() const
     return false;
 }
 
-std::string
-ArchSpec::GetClangTargetCPU ()
-{
-    std::string cpu;
-    const llvm::Triple::ArchType machine = GetMachine();
+
+std::string ArchSpec::GetTargetABI() const {
+
+  std::string abi;
+
+  if (IsMIPS()) {
+    switch (GetFlags() & ArchSpec::eMIPSABI_mask) {
+    case ArchSpec::eMIPSABI_N64:
+      abi = "n64";
+      return abi;
+    case ArchSpec::eMIPSABI_N32:
+      abi = "n32";
+      return abi;
+    case ArchSpec::eMIPSABI_O32:
+      abi = "o32";
+      return abi;
+    default:
+      return abi;
+    }
+  }
+  return abi;
+}
+
+void ArchSpec::SetFlags(std::string elf_abi) {
+
+  uint32_t flag = GetFlags();
+  if (IsMIPS()) {
+    if (elf_abi == "n64")
+      flag |= ArchSpec::eMIPSABI_N64;
+    else if (elf_abi == "n32")
+      flag |= ArchSpec::eMIPSABI_N32;
+    else if (elf_abi == "o32")
+      flag |= ArchSpec::eMIPSABI_O32;
+  }
+  SetFlags(flag);
+}
+
+std::string ArchSpec::GetClangTargetCPU() {
+  std::string cpu;
+  const llvm::Triple::ArchType machine = GetMachine();
 
     if (machine == llvm::Triple::mips ||
         machine == llvm::Triple::mipsel ||

Modified: lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=287747&r1=287746&r2=287747&view=diff
==============================================================================
--- lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Wed Nov 23 02:18:42 2016
@@ -2856,6 +2856,7 @@ GDBRemoteCommunicationClient::GetCurrent
             std::string os_name;
             std::string vendor_name;
             std::string triple;
+            std::string elf_abi;
             uint32_t pointer_byte_size = 0;
             StringExtractor extractor;
             ByteOrder byte_order = eByteOrderInvalid;
@@ -2917,6 +2918,11 @@ GDBRemoteCommunicationClient::GetCurrent
                     if (pid != LLDB_INVALID_PROCESS_ID)
                         ++num_keys_decoded;
                 }
+                else if (name.compare("elf_abi") == 0)
+                {
+                    elf_abi = value;
+                    ++num_keys_decoded;
+                }
             }
             if (num_keys_decoded > 0)
                 m_qProcessInfo_is_valid = eLazyBoolYes;
@@ -2930,6 +2936,7 @@ GDBRemoteCommunicationClient::GetCurrent
             if (!triple.empty ())
             {
                 m_process_arch.SetTriple (triple.c_str ());
+                m_process_arch.SetFlags(elf_abi);
                 if (pointer_byte_size)
                 {
                     assert (pointer_byte_size == m_process_arch.GetAddressByteSize());

Modified: lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp?rev=287747&r1=287746&r2=287747&view=diff
==============================================================================
--- lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp (original)
+++ lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp Wed Nov 23 02:18:42 2016
@@ -1235,12 +1235,12 @@ GDBRemoteCommunicationServerCommon::Crea
                 break;
         }
 
-        if (proc_triple.isArch64Bit ())
-            response.PutCString ("ptrsize:8;");
-        else if (proc_triple.isArch32Bit ())
-            response.PutCString ("ptrsize:4;");
-        else if (proc_triple.isArch16Bit ())
-            response.PutCString ("ptrsize:2;");
+        // In case of MIPS64, pointer size is depend on ELF ABI
+        // For N32 the pointer size is 4 and for N64 it is 8
+        std::string abi = proc_arch.GetTargetABI();
+        if (!abi.empty())
+            response.Printf("elf_abi:%s;", abi.c_str());
+        response.Printf("ptrsize:%d;", proc_arch.GetAddressByteSize());
     }
 }
 




More information about the llvm-branch-commits mailing list